Unable to ptrace(PTRACE_TRACEME) without sudo

Bug #1897187 reported by Gabriel Burca
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gdb (Ubuntu)
New
Undecided
Unassigned

Bug Description

The call to ptrace(PTRACE_TRACEME) fails in gdbserver in spite of ptrace_scope being 0. As a result gdbserver hangs and is impossible to use. When run with sudo it works fine. This seems to be a kernel bug.

# which gdbserver
/usr/bin/gdbserver

# cat /proc/sys/kernel/yama/ptrace_scope
0

# gdbserver :9091 /bin/true
<no output>

# sudo gdbserver :9091 /bin/true
Process /bin/true created; pid = 31071
Listening on port 9091

# strace -f gdbserver :9091 /bin/true
...
ptrace(PTRACE_TRACEME) = -1 EPERM (Operation not permitted)
...

# getcap /usr/bin/gdbserver
<no output>

Adding "setcap cap_sys_ptrace=+eip" to gdbserver doesn't change anything.

Further details:

# lsb_release -rd
Description: Ubuntu 18.04.5 LTS
Release: 18.04

# apt-cache policy linux-generic
linux-generic:
  Installed: 4.15.0.118.105
  Candidate: 4.15.0.118.105
  Version table:
 *** 4.15.0.118.105 500
        500 http://aptrepo/ubuntu bionic-updates/main amd64 Packages
        500 http://aptrepo/ubuntu bionic-security/main amd64 Packages
        100 /var/lib/dpkg/status
     4.15.0.20.23 500
        500 http://aptrepo/ubuntu bionic/main amd64 Package

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.