+++ This bug was initially created as a clone of Bug #233852 +++ [ Original RHEL3 source from Bug #189607 . ] After a fix of `Bug 232837: utrace: PTRACE_ATTACH of SIGSTOPped process hangs' to update the ptrace(2) syscall behavior back to the kernel.org one GDB will start to hang during attaching to a SIGSTOPped process. A prophecy of mine. sleep 1h & pid=$! kill -STOP $pid gdb sleep $pid [WILL HANG]
This bugzilla has Keywords: Regression. Since no regressions are allowed between releases, it is also being proposed as a blocker for this release. Please resolve ASAP.
Fix available; Jan, tested by?
There are two new testcases for it: Running ../../../gdb/testsuite/gdb.threads/attach-into-signal.exp ... FAIL: gdb.threads/attach-into-signal.exp: nonthreaded: attach (pass 1), pending signal catch PASS: gdb.threads/attach-into-signal.exp: successfully compiled posix threads test case Running ../../../gdb/testsuite/gdb.threads/attach-stopped.exp ... PASS: gdb.threads/attach-stopped.exp: nonthreaded: set file, before attach1 to stopped process (re-read) PASS: gdb.threads/attach-stopped.exp: nonthreaded: attach1 to stopped, after setting file PASS: gdb.threads/attach-stopped.exp: nonthreaded: attach1 to stopped bt PASS: gdb.threads/attach-stopped.exp: nonthreaded: attach1, exit leaves process stopped PASS: gdb.threads/attach-stopped.exp: nonthreaded: attach2 to stopped, after setting file PASS: gdb.threads/attach-stopped.exp: nonthreaded: attach2 to stopped bt PASS: gdb.threads/attach-stopped.exp: continue (nonthreaded: attach2 continue) PASS: gdb.threads/attach-stopped.exp: nonthreaded: attach2 stop interrupt PASS: gdb.threads/attach-stopped.exp: nonthreaded: attach2, exit leaves process sleeping PASS: gdb.threads/attach-stopped.exp: successfully compiled posix threads test case PASS: gdb.threads/attach-stopped.exp: threaded: set file, before attach1 to stopped process (re-read) PASS: gdb.threads/attach-stopped.exp: threaded: attach1 to stopped, after setting file PASS: gdb.threads/attach-stopped.exp: threaded: attach1 to stopped bt PASS: gdb.threads/attach-stopped.exp: threaded: attach1, exit leaves process stopped PASS: gdb.threads/attach-stopped.exp: threaded: attach2 to stopped, after setting file PASS: gdb.threads/attach-stopped.exp: threaded: attach2 to stopped bt PASS: gdb.threads/attach-stopped.exp: continue (threaded: attach2 continue) PASS: gdb.threads/attach-stopped.exp: threaded: attach2 stop interrupt PASS: gdb.threads/attach-stopped.exp: threaded: attach2, exit leaves process sleeping It makes no sense to test it on utrace kernels (FC6/F7/RHEL5.0), one needs to test it on either upstream or RHEL-4 kernels. It should be fixed for RHEL5.1. The first testcase runs 100 attempts and sometimes it does not have the chance to test redelivery of the signal if it does not catch it pending at all. It is FAIl for now - as in the build system result above - but such cases could be probably marked rather as UNRESOLVED. To be fixed for the next upstream submissions. It was tested by hand on RHEL4.ppc that it PASSes (usually on about the 5th-20th run).
The current patch may occasionally detach an originally normal process as a stopped one, investigating.
Created attachment 158166 [details] Fix the gdb-6.5-23.el5 testcase `gdb.threads/attach-into-signal'. Code looks correct but the testcase was wrong. Also the code must be tested on some RHEL-5.1 kernel, I was developing/testing it on upstream 2.6.22-rc4-git7.x86_64. RHEL-4.5 2.6.9-55.ELsmp.x86_64 kernel is definitely incompatible. Still the testcase will probably fail with (depending on the kernel version): UNRESOLVED: gdb.threads/attach-into-signal.exp: nonthreaded: attach (pass 1), pending signal catch UNRESOLVED: gdb.threads/attach-into-signal.exp: threaded: attach (pass 1), pending signal catch It just means test unreproducibility, not a real failure.
The current RHEL-5 patch is incompatible with RHEL-4 kernels (it races there). But it is more conservative change since the mostly unchanged Jeff Johnston's patch in RHEL-5.0 `gdb-6.3-attach-stop-20051011.patch'. RHEL-4 kernels incompatible change was posted upstream before: http://sources.redhat.com/ml/gdb-patches/2007-07/msg00003.html
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on the solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2007-0554.html