NetBSD-Bugs archive

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

bin/49165: gdb can't get registers



>Number:         49165
>Category:       bin
>Synopsis:       gdb can't get registers
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Aug 30 05:40:00 +0000 2014
>Originator:     Martin Husemann
>Release:        NetBSD 7.99.1
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD whoever-brings-the-night.aprisoft.de 7.99.1 NetBSD 7.99.1 
(WHOEVER) #11: Thu Aug 28 09:25:11 CEST 2014 
martin%seven-days-to-the-wolves.aprisoft.de@localhost:/usr/src/sys/arch/sparc64/compile/WHOEVER
 sparc64
Architecture: sparc64
Machine: sparc64
>Description:

Debugging threaded programs on sparc64 stopped working.
Simple programs (like /bin/ls) work, but all threaded ones seem to fail.

The problem seems to be a bogus pid argument to ptrace:

  4043      1 gdb      CALL  ptrace(PT_GETREGS,1,0xffffffffffff9ea0,1)
  4043      1 gdb      RET   ptrace -1 errno 1 Operation not permitted

where a previously working PT_GETREGS says:

  4043      1 gdb      CALL  ptrace(PT_GETREGS,0xe2b,0xffffffffffff98b0,0)
  4043      1 gdb      RET   ptrace 0

this is from trying to debug firefox, see below for an easy repeatable case:

  4043      1 gdb      CALL  __sigprocmask14(1,0,0xfffffffffde03140)
  4043      1 gdb      RET   __sigprocmask14 0
  4043      1 gdb      CALL  __sigaltstack14(0,0xfffffffffde03110)
  4043      1 gdb      RET   __sigaltstack14 0
  4043      1 gdb      CALL  ptrace(PT_IO,0xe2b,0xffffffffffff9020,0)
  4043      1 gdb      RET   ptrace 0
  4043      1 gdb      CALL  ptrace(PT_GETREGS,0xe2b,0xffffffffffff98b0,0)
  4043      1 gdb      RET   ptrace 0
  4043      1 gdb      CALL  ptrace(PT_IO,0xe2b,0xffffffffffff9060,0)
  4043      1 gdb      RET   ptrace 0
  4043      1 gdb      CALL  ptrace(PT_IO,0xe2b,0xffffffffffff9060,0)
  4043      1 gdb      RET   ptrace 0
  4043      1 gdb      CALL  ptrace(PT_IO,0xe2b,0xffffffffffff9060,0)
  4043      1 gdb      RET   ptrace 0
  4043      1 gdb      CALL  ptrace(PT_IO,0xe2b,0xffffffffffff9060,0)
  4043      1 gdb      RET   ptrace 0
  4043      1 gdb      CALL  ptrace(PT_IO,0xe2b,0xffffffffffff9060,0)
  4043      1 gdb      RET   ptrace 0
  4043      1 gdb      CALL  ptrace(PT_IO,0xe2b,0xffffffffffff9060,0)
  4043      1 gdb      RET   ptrace 0
  4043      1 gdb      CALL  ptrace(PT_IO,0xe2b,0xffffffffffff9060,0)
  4043      1 gdb      RET   ptrace 0
  4043      1 gdb      CALL  ptrace(PT_IO,0xe2b,0xffffffffffff9060,0)
  4043      1 gdb      RET   ptrace 0
  4043      1 gdb      CALL  ptrace(PT_IO,0xe2b,0xffffffffffff9060,0)
  4043      1 gdb      RET   ptrace 0
  4043      1 gdb      CALL  ptrace(PT_IO,0xe2b,0xffffffffffff9060,0)
  4043      1 gdb      RET   ptrace 0
  4043      1 gdb      CALL  ptrace(PT_IO,0xe2b,0xffffffffffff9060,0)
  4043      1 gdb      RET   ptrace 0
  4043      1 gdb      CALL  ptrace(PT_IO,0xe2b,0xffffffffffff9060,0)
  4043      1 gdb      RET   ptrace 0
  4043      1 gdb      CALL  ptrace(PT_IO,0xe2b,0xffffffffffff9060,0)
  4043      1 gdb      RET   ptrace 0
  4043      1 gdb      CALL  ptrace(PT_IO,0xe2b,0xffffffffffff9060,0)
  4043      1 gdb      RET   ptrace 0
  4043      1 gdb      CALL  ptrace(PT_IO,0xe2b,0xffffffffffff9060,0)
  4043      1 gdb      RET   ptrace 0
  4043      1 gdb      CALL  ptrace(PT_IO,0xe2b,0xffffffffffff9060,0)
  4043      1 gdb      RET   ptrace 0
  4043      1 gdb      CALL  ptrace(PT_IO,0xe2b,0xffffffffffff9510,0)
  4043      1 gdb      RET   ptrace 0
  4043      1 gdb      CALL  ptrace(PT_IO,0xe2b,0xffffffffffff93b0,0)
  4043      1 gdb      RET   ptrace 0
  4043      1 gdb      CALL  ptrace(PT_IO,0xe2b,0xffffffffffff90e0,0)
  4043      1 gdb      RET   ptrace 0
  4043      1 gdb      CALL  ptrace(PT_IO,0xe2b,0xffffffffffff91e0,0)
  4043      1 gdb      RET   ptrace 0
  4043      1 gdb      CALL  ptrace(PT_CONTINUE,0xe2b,1,0)
  4043      1 gdb      RET   ptrace 0
  4043      1 gdb      CALL  
__wait450(0xffffffffffffffff,0xffffffffffffa2ec,0,0)
  4043      1 gdb      RET   __wait450 3627/0xe2b
  4043      1 gdb      CALL  
ptrace(PT_GET_PROCESS_STATE,0xe2b,0xffffffffffffa2f0,8)
  4043      1 gdb      RET   ptrace 0
  4043      1 gdb      CALL  ptrace(PT_LWPINFO,0xe2b,0xffffffffffffa2f8,8)
  4043      1 gdb      RET   ptrace 0
  4043      1 gdb      CALL  ptrace(PT_GETREGS,1,0xffffffffffff9ea0,1)
  4043      1 gdb      RET   ptrace -1 errno 1 Operation not permitted
  4043      1 gdb      CALL  issetugid
  4043      1 gdb      RET   issetugid 0
  4043      1 gdb      CALL  open(0xffffffffffff8b68,0x400000,0x295660)
  4043      1 gdb      NAMI  "/usr/share/nls/nls.alias.db"
  4043      1 gdb      RET   open -1 errno 2 No such file or directory
  4043      1 gdb      CALL  open(0xfffffffffe05d9e0,0x400000,0x7c00)
  4043      1 gdb      NAMI  "/usr/share/nls/nls.alias"
  4043      1 gdb      RET   open 5
  4043      1 gdb      CALL  __fstat50(5,0xffffffffffff8ed8)
  4043      1 gdb      RET   __fstat50 0
  4043      1 gdb      CALL  mmap(0,0x5f0,1,2,5,0,0)
  4043      1 gdb      RET   mmap -8962048/0xffffffffff774000
  4043      1 gdb      CALL  close(5)
  4043      1 gdb      RET   close 0
  4043      1 gdb      CALL  munmap(0xffffffffff774000,0x5f0)
  4043      1 gdb      RET   munmap 0
  4043      1 gdb      CALL  open(0xffffffffffff95a0,0,0x7c00)
  4043      1 gdb      NAMI  "/usr/share/nls/C/libc.cat"
  4043      1 gdb      RET   open 5
  4043      1 gdb      CALL  __fstat50(5,0xffffffffffff9058)
  4043      1 gdb      RET   __fstat50 0
  4043      1 gdb      CALL  mmap(0,0x10be,1,1,5,0,0)
  4043      1 gdb      RET   mmap -8962048/0xffffffffff774000
  4043      1 gdb      CALL  close(5)
  4043      1 gdb      RET   close 0
  4043      1 gdb      CALL  munmap(0xffffffffff774000,0x10be)
  4043      1 gdb      RET   munmap 0
  4043      1 gdb      CALL  __sigprocmask14(3,0xfffffffffde03000,0)
  4043      1 gdb      RET   __sigprocmask14 0
  4043      1 gdb      CALL  setcontext(0xffffffffffff9760)
  4043      1 gdb      RET   setcontext JUSTRETURN
  4043      1 gdb      CALL  
__sigaction_sigtramp(SIGTTOU,0xffffffffffffae40,0xffffffffffffae60,0xfffffffffe053860,2)
  4043      1 gdb      RET   __sigaction_sigtramp 0
  4043      1 gdb      CALL  ioctl(0,TIOCGETA,0xfffffffffdc0e230)
  4043      1 gdb      GIO   fd 0 read 44 bytes
       "\0\0#\^F\0\0\0\^C\0\0\v\0 \0\^E\M-O\^D\M^?\M^?\^?\^W\^U\^R\0\^C\^\\^Z\
        \^Y\^Q\^S\^V\^O\^A\0\0\0\0\0\M^V\0\0\0\M^V\0"
  4043      1 gdb      RET   ioctl 0
  4043      1 gdb      CALL  ioctl(0,TIOCGPGRP,0xffffffffffffae7c)
  4043      1 gdb      GIO   fd 0 read 4 bytes
       "\0\0\^N+"
  4043      1 gdb      RET   ioctl 0
  4043      1 gdb      CALL  ioctl(0,TIOCSETA,0xffffffffffffada4)
  4043      1 gdb      GIO   fd 0 wrote 44 bytes
       "\0\0#\^F\0\0\0\^C\0\0\v\0\0\0\^E\M-O\^D\M^?\M^?\^?\^W\^U\^R\0\^C\^\\^Z\
        \^Y\^Q\^S\^V\^O\^A\0\0\0\0\0\M^V\0\0\0\M^V\0"
  4043      1 gdb      RET   ioctl 0
  4043      1 gdb      CALL  ioctl(0,TIOCSPGRP,0xffffffffffffae7c)
  4043      1 gdb      GIO   fd 0 wrote 4 bytes
       "\0\0\^O\M-K"
  4043      1 gdb      RET   ioctl 0
  4043      1 gdb      CALL  
__sigaction_sigtramp(SIGTTOU,0xffffffffffffae40,0xffffffffffffae60,0xfffffffffe053860,2)
  4043      1 gdb      RET   __sigaction_sigtramp 0
  4043      1 gdb      CALL  fcntl(0,3,0)
  4043      1 gdb      RET   fcntl 2
  4043      1 gdb      CALL  fcntl(0,4,2)
  4043      1 gdb      RET   fcntl 0
  4043      1 gdb      CALL  fcntl(0,4,2)
  4043      1 gdb      RET   fcntl 0
  4043      1 gdb      CALL  ioctl(1,TIOCDRAIN,0)
  4043      1 gdb      RET   ioctl 0
  4043      1 gdb      CALL  write(2,0xfffffffffdd626c0,0x30)
  4043      1 gdb      GIO   fd 2 wrote 48 bytes
       "Couldn't get registers: Operation not permitted."
  4043      1 gdb      RET   write 48/0x30
  4043      1 gdb      CALL  write(2,0xfffffffffde0e3e8,1)
  4043      1 gdb      GIO   fd 2 wrote 1 bytes
       "\n"
  4043      1 gdb      RET   write 1

>How-To-Repeat:

gdb /usr/tests/fs/vfs/t_unpriv
[..]
(gdb) run
Starting program: /usr/tests/fs/vfs/t_unpriv 
Couldn't get registers: Operation not permitted.

>Fix:
n/a



Home | Main Index | Thread Index | Old Index