public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug external/31520] New: [gdb/external] Handle kernel.yama.ptrace_scope != 0
Date: Thu, 21 Mar 2024 13:00:33 +0000	[thread overview]
Message-ID: <bug-31520-4717@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=31520

            Bug ID: 31520
           Summary: [gdb/external] Handle kernel.yama.ptrace_scope != 0
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: external
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

openSUSE Tumbleweed recently changed the default of the
kernel.yama.ptrace_scope setting from 0 to 1.

This causes attach-type test-cases to fail.

For me, it's easily fixable by manually overriding the default in say
/etc/sysctl.conf or /etc/sysctl.d/10-ptrace.conf.

But there may be users who either don't want to do this, or are not allowed to
do this on the system at hand.

Using sudo should still work, but that may also be considered unacceptable, or
an inconvenience because the user really wants to be debugging as user $USER,
not as root.

I found this link (  https://wiki.archlinux.org/title/Capabilities ) which
advertises a way to still run as user, while having increased priviliges:
...
$ sudo -E capsh --caps="cap_setpcap,cap_setuid,cap_setgid+ep
cap_sys_ptrace+eip" --keep=1 --user="$USER" --addamb="cap_sys_ptrace"
--shell=/usr/bin/gdb -- -p <pid>
...

This does not yet work for me on openSUSE Leap 15.4, I need to debug this
further.

But it occurred to me that:
- this setting and problem is unmentioned in our docs, and
- that a script that supports allowing ptrace capabilities that would work on
  any linux system (or indicate why not) would be useful.

Whether this script should be part of the gdb contrib scripts (there are other
tools than gdb who would need the same script), and delivered to users or not,
I'm not sure.  But it would be good to have it somewhere, and to be able to
point to its location in the docs.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2024-03-21 13:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-21 13:00 vries at gcc dot gnu.org [this message]
2024-03-21 13:28 ` [Bug external/31520] " vries at gcc dot gnu.org
2024-03-21 14:33 ` vries at gcc dot gnu.org
2024-03-21 16:52 ` vries at gcc dot gnu.org
2024-03-21 17:43 ` vries at gcc dot gnu.org
2024-03-22 14:16 ` vries at gcc dot gnu.org
2024-03-23  8:15 ` sam at gentoo dot org
2024-03-25 13:46 ` vries at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-31520-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).