[PATCH] m68k: fix sigreturn decoding

Dmitry V. Levin ldv at altlinux.org
Thu Mar 12 12:25:27 UTC 2015


On Thu, Mar 12, 2015 at 11:13:22AM +0100, Andreas Schwab wrote:
> "Dmitry V. Levin" <ldv-u2l5PoMzF/Vg9hUCZPvPmw at public.gmane.org> writes:
> > On Wed, Mar 11, 2015 at 03:10:34PM +0100, Andreas Schwab wrote:
> >> * sigreturn.c (sys_sigreturn) [M68K]: Fetch the words of the
> >> signal mask from the proper place.
> >> ---
> >>  sigreturn.c | 14 +++++++++++++-
> >>  1 file changed, 13 insertions(+), 1 deletion(-)
> >> 
> >> diff --git a/sigreturn.c b/sigreturn.c
> >> index 648bd0a..a96257f 100644
> >> --- a/sigreturn.c
> >> +++ b/sigreturn.c
> >> @@ -128,8 +128,20 @@ sys_sigreturn(struct tcb *tcp)
> >>  		long addr;
> >>  		if (upeek(tcp->pid, 4*PT_USP, &addr) < 0)
> >>  			return 0;
> >> +		/* Fetch pointer to struct sigcontext.  */
> >> +		if (umove(tcp, addr + 2 * sizeof(int), &addr) < 0)
> >> +			return 0;
> >> +		unsigned long mask[NSIG / 8 / sizeof(long)];
> >> +		/* Fetch first word of signal mask.  */
> >> +		if (umove(tcp, addr, &mask[0]) < 0)
> >> +			return 0;
> >> +		/* Fetch remaining words of signal mask, located
> >> +		   immediately before.  */
> >> +		addr -= sizeof (mask) - sizeof(long);
> >> +		if (umoven(tcp, addr, sizeof (mask) - sizeof(long), (char *) &mask[1]) < 0)
> >> +			return 0;
> >
> > You might want to save a syscall here by fetching the whole sizeof(mask)
> > in a single umoven call.
> 
> They are not consecutive.

That would be too obvious if they were consecutive.

If you'd rather not optimize this, please replace
sizeof (x) with sizeof(x) and commit.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20150312/bc13b127/attachment.bin>


More information about the Strace-devel mailing list