NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/54029: gdb attach says "Couldn't get registers: Device busy"



>Number:         54029
>Category:       bin
>Synopsis:       gdb attach says "Couldn't get registers: Device busy"
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 01 17:00:00 +0000 2019
>Originator:     Andreas Gustafsson
>Release:        NetBSD 8.0, also -current
>Organization:

>Environment:
System: NetBSD
Architecture: x86_64
Machine: amd64
>Description:

When attaching to a running process with gdb under 8.0 or -current,
it prints the error message "Couldn't get registers: Device busy."

Also, after the attach, there is no "(gdb)" prompt at the end of the
output - instead, it appears several lines above it.

>How-To-Repeat:

# ps -glaxw|grep getty
  0 415  402   275  85  0 11128   520 pipe_rd R+   tty00  0:00.02 grep getty 
  0 398    1   898  85  0 12116  1288 ttyraw  Is+  ttyE1  0:00.09 /usr/libexec/getty Pc ttyE1 
  0 389    1   898  85  0 13212  1288 ttyraw  Is+  ttyE2  0:00.06 /usr/libexec/getty Pc ttyE2 
  0 382    1  1347  85  0 12116  1288 ttyraw  Is+  ttyE3  0:00.06 /usr/libexec/getty Pc ttyE3 

# gdb /usr/libexec/getty
[...verbose output elided...]
(gdb) attach 382 
Attaching to program: /usr/libexec/getty, process 382
Couldn't get registers: Device busy.
(gdb) [New LWP 1 of process 382]
Reading symbols from /usr/lib/libutil.so.7...(no debugging symbols found)...done.
Reading symbols from /usr/lib/libterminfo.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/libc.so.12...(no debugging symbols found)...done.
Reading symbols from /usr/libexec/ld.elf_so...(no debugging symbols found)...done.
[Switching to LWP 1 of process 382]
0x0000737c7b63e98a in read () from /usr/lib/libc.so.12

This happens despite disabling various gdb-unfriendly security
features with

  sysctl -w security.pax.mprotect.enabled=0
  sysctl -w security.pax.mprotect.ptrace=0

Despite the error message, gdb does appear to more or less work,
modulo the usual other open gdb bugs, once you realize that it's
actually waiting for your input despite there being no prompt at the
end.

For an example of another user affected by this, see
http://mail-index.netbsd.org/netbsd-users/2019/01/26/msg022112.html

>Fix:



Home | Main Index | Thread Index | Old Index