This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/18653] spawn changes SIGPIPE SIG_DFL to SIG_IGN


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

Jan Kratochvil <jan.kratochvil at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #6 from Jan Kratochvil <jan.kratochvil at redhat dot com> ---
I think the fix is incomplete:
 - it does fix spawned inferiors
 - it does not fix "shell" commands:
grep SigIgn /proc/self/status;./gdb -data-directory data-directory/ -batch -ex
'! grep SigIgn /proc/self/status' -ex start -ex 'call (int)system("grep SigIgn
/proc/self/status")' --args echo
SigIgn: 0000000000000000
SigIgn: 0000000001001000
Temporary breakpoint 1 at 0x1420: file ../src/echo.c, line 109.
Temporary breakpoint 1, main (argc=1, argv=0x7fffffffd768) at ../src/echo.c:109
109     {
SigIgn: 0000000000000000
$1 = 0


A second issue:
https://bugzilla.redhat.com/show_bug.cgi?id=1473411#c2

The all-zeros SigIgn is a bit weak. You really want to make sure that if gdb
starts with something ignored, then the child process ALSO gets started with
that same signal ignored.  With working gdb, here's a slightly stronger test:

$ ( trap - BUS; sleep 30& grep SigIgn /proc/$!/status )
SigIgn: 0000000000000006
$ ( trap '' BUS; sleep 30& grep SigIgn /proc/$!/status )
SigIgn: 0000000000000046

Proof that we can control whether 0x40 is ignored during sleep using just the
shell (the shell also ignores SIGINT and SIGQUIT during background tasks;
that's life, hence why I used SIGBUS to show what I'm actually toggling)

$ ( trap '' BUS; gdb --args sleep 30 )
GNU gdb (GDB) Fedora 8.0-13.fc26
...
(gdb) ! grep SigIgn /proc/self/status
SigIgn: 0000000001001040

# So gdb started with SIGBUS ignored, and additionally ignores SIGPIPE
itself...

(gdb) b main
Breakpoint 1 at 0x1590
(gdb) r
Starting program: /usr/bin/sleep 30

Breakpoint 1, 0x0000555555555590 in main ()
(gdb) info thread
  Id   Target Id         Frame 
* 1    process 27153 "sleep" 0x0000555555555590 in main ()
(gdb) ! grep SigIgn /proc/27153/status
SigIgn: 0000000000000040

# ...but the child process sees JUST SIGBUS ignored (ie. the exact environment
that we started gdb with, prior to gdb fudging things around)

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]