From: Al Viro <viro@ZenIV.linux.org.uk>
To: linux-arch@vger.kernel.org
Subject: Re: [PATCH] ARM: prevent multiple syscall restarts
Date: Fri, 17 Sep 2010 16:44:25 +0100 [thread overview]
Message-ID: <20100917154425.GY31363@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20100917152158.GA20369@flint.arm.linux.org.uk>
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.
prev parent reply other threads:[~2010-09-17 15:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-17 15:21 [PATCH] ARM: prevent multiple syscall restarts Russell King
2010-09-17 15:44 ` Al Viro [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100917154425.GY31363@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=linux-arch@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox