[PATCH] display mask on enter to sigreturn, not exit

Jamie Lokier jamie at shareable.org
Wed Jan 11 00:11:41 UTC 2012

Dmitry V. Levin wrote:
> > While at it, I made it so that we do display returned value/errno.
> > I see no point in hiding it and showing uninformative "= ?" instead.
> Is there any actual difference?  Is there any case when sigreturn() may
> "return" something different from EINTR?

sigsuspend is special, because it returns to an arbitrary userspace

Won't the return value be whatever userspace random values were in
registers (may look like error, may not), for an asynchronous signal,
for example SIGALRM while running some calculations instead?

I haven't been so bold as to try the patch ;) but I'm thinking this
test shows EINTR because the signal interrupts rt_sigsuspend()
which is about to return EINTR.

> > Example of pause() being interrupted by ALRM which has installed handler
> > which re-arms ALRM:
> > After:
> > 
> > rt_sigsuspend([INT])                    = ? ERESTARTNOHAND (To be restarted)
> > --- {si_signo=SIGALRM, si_code=SI_KERNEL, si_value={int=134513920, ptr=0x8048500}} (Alarm clock) ---
> > rt_sigaction(SIGALRM, {0x807b18a, [ALRM], SA_RESTORER|SA_RESTART, 0x80486e3}, {0x807b18a, [ALRM], SA_RESTORER|SA_RESTART, 0x80486e3}, 8) = 0
> > alarm(1)                                = 0
> > sigreturn() (mask now [INT])            = -1 EINTR (Interrupted system call)
> > 
> > An open question is how exactly to display the mask.
> > "mask now"? "[sig]mask on stack?" Other ideas?
> Well, the new output is a bit odd.  Something meaningful between
> ")" and "=" is not what a strace user is used to deal with.
> I'd be glad if somebody would come up with a better idea how to
> display this.

sigreturn is special anyway, so how about mirroring the signal entry, like this:

--- Signal return (mask now [INT]) ---

If I were pushing the boat out, I'd change the entry text as well to match:

--- Signal (Alarm clock, mask now [INT +ALRM]) {si_signo=SIGALRM, si_code=SI_KERNEL, si_value={int=134513920, ptr=0x8048500}} ---

All the best,
-- Jamie

More information about the Strace-devel mailing list