Re: [PATCH] ARM: prevent multiple syscall restarts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 17, 2010 at 04:21:58PM +0100, Russell King wrote:
> Al Viro reports that calling "sys_sigsuspend(-ERESTARTNOHAND, 0, 0)"
> with two signals coming and being handled in kernel space results
> in the syscall restart being done twice.
> 
> Avoid this by clearing the 'why' flag when we call the signal handling
> code to prevent further syscall restarts after the first.

I'd like to add that while sigsuspend example is, certainly, cheating
(the first two arguments of sigsuspend(2) on arm are ignored for
historical reasons, and libc is not going to end up with that in
the first argument), the issue is real - existing code on arm relied
on the following assertion:

	no syscall called with -ERESTART... in the first argument will
ever return -ERESTART...

It happens to be true for most of the syscalls, since that value will lead
to -EBADF if the argument is a file descriptor and -EFAULT if it's a userland
pointer.  Ones that expect a syscall-specific enum will probably also just
fail with -EINVAL.  So most of the potential victims are actually OK.  However,
it's certainly better to have a straightforward prevention of that kind of
crap than keep relying on fairly subtle properties of code in core kernel
that has no idea about arch/arm relying on it - in undocumented way, at that.
--
To unsubscribe from this list: send the line "unsubscribe linux-arch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux