Hi,

On Mon, Jan 09, 2012 at 01:49:10PM +0100, Denys Vlasenko wrote:
> sys_sigreturn() performs ugly manipulations in order to show
> the signal mask which is restored by this syscall: on syscall entry,
> fetches it from the stack, saves it in tcp->u_arg[]
> (where it used to overflow this array - fixed sometime ago),
> then retrieves the mask and displays it on syscall exit.
> 
> Apparently, the motivation is to make it slightly more obvious
> to user that signal mask is restored only when this syscall returns.
> IMO, this hardly justifies the necessary hacks. It is much easier
> to display the mask at the point when we fetch it - on syscall entry.

I agree on this point, decoding on entering syscall results to much more
clear code.

> 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?

> Example of pause() being interrupted by ALRM which has installed handler
> which re-arms ALRM:
> Before the patch:
> 
> rt_sigsuspend([INT])                    = ? ERESTARTNOHAND (To be restarted)
> --- {si_signo=SIGALRM, si_code=SI_KERNEL} (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])
> 
> 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.


-- 
ldv

Attachment: pgpXxTdjC9T5v.pgp
Description: PGP signature

------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Strace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to