child being strace'd does not hang at raise(SIGTSTP)

Vangelis Koukis vkoukis at cslab.ece.ntua.gr
Wed Jan 18 12:33:30 UTC 2012


Hello,

I've been running into a problem where a child running under strace does
not stop when it reaches raise(SIGSTOP). This was unexpected at first...
The attached program [strace-test.c] demoes this behavior,
and runs differently when being traced.

$ ./strace-test
Parent: sleeping for a while...
Parent: SUCCESS. Child killed, sig = 9

$ strace -f ./strace-test 2>/dev/null
Parent: sleeping for a while...
Child: FAIL.
Parent: FAIL. Child exited, status = 1

After quite some experimentation, I came to this, in the manual page:

       A traced process ignores SIGSTOP except on SVR4 platforms.

which I understand is a limitation coming from the way ptrace() works
under Linux?

So, I tried with SIGTSTP instead. Again, it seems a child process being
traced will not hang when doing a raise(SIGTSTP) [the signal to use can
be #defined in strace-test.c]

I've tried with

Linux hostname 2.6.26-2-amd64 #1 SMP Tue Jan 25 05:59:43 UTC 2011 x86_64 GNU/Linux
and Debian-provided "strace -- version 4.5.17",

as well as

Linux hostname 3.0.4 #1 SMP Tue Aug 30 12:55:46 EEST 2011 i686 GNU/Linux
with latest strace, compiled from git master, commit
e73a89d99921f7b9dc3f1350a4eb97c7fdc6032a.

To summarize, is there anything I can do to have straced processes stop
on reception of a signal? If not, is it a matter of the way ptrace()
works? Then perhaps the manpage should not mention SIGSTOP only.

Thank you,
Vangelis.

-- 
Vangelis Koukis
vkoukis at cslab.ece.ntua.gr
OpenPGP public key ID:
pub  1024D/1D038E97 2003-07-13 Vangelis Koukis <vkoukis at cslab.ece.ntua.gr>
     Key fingerprint = C5CD E02E 2C78 7C10 8A00  53D8 FBFC 3799 1D03 8E97

Our greatest glory is not in never failing,
but in rising up every time we fail.
        -- Ralph Waldo Emerson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: strace-test.c
Type: text/x-csrc
Size: 1148 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20120118/a8edca5a/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20120118/a8edca5a/attachment-0001.bin>


More information about the Strace-devel mailing list