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

Denys Vlasenko dvlasenk at
Wed Jan 18 14:58:44 UTC 2012

On 01/18/2012 01:33 PM, Vangelis Koukis wrote:
> 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.

This is a known bug in kernel ptrace API, and the fix seems to be ready
and is being pushed into mainline. Concurrent changes for strace are
ready too.


More information about the Strace-devel mailing list