[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <50C5BC05.6020502@imgtec.com>
Date: Mon, 10 Dec 2012 10:40:05 +0000
From: James Hogan <james.hogan@...tec.com>
To: Al Viro <viro@...IV.linux.org.uk>
CC: <linux-arch@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
"Arnd Bergmann" <arnd@...db.de>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [braindump][RFC] signals and syscall restarts (Re: [PATCH v2
19/44] metag: Signal handling)
On 06/12/12 22:09, Al Viro wrote:
> On Thu, Dec 06, 2012 at 11:17:34AM +0000, James Hogan wrote:
>
>> Agreed, it looks wrong. Looking at the sh version, is there a particular
>> reason to only check for -EFAULT and not the other errors that
>> do_sigaltstack can return (-EPERM, -EINVAL, and -ENOMEM)?
>
> See commit fae2ae2a900a5c7bb385fe4075f343e7e2d5daa2
Thanks :)
>
>>> BTW, what's to stop the syscall restart triggering if you catch a signal
>>> while in rt_sigreturn(2)?
>>
>> I'm not sure I understand how that could cause a problem. Could you
>> elaborate the sequence of events?
>>
>> The signal restart is triggered by the return value register, so
>> rt_sigreturn would have to return -ERESTART*. This could happen if the
>> signal handler overwrote the return value in the sigcontext (which as
>> far as I can tell could also happen on ARM), or if the syscall that was
>> originally interrupted by the signal has -ERESTARTNOINTR ||
>> (-ERESTARTSYS && SA_RESTART), but in that case rt_sigreturn has already
>> switched back to the context of the original syscall so that's the right
>> thing to do isn't it? I've probably missed something important :-)
>
> [we probably need something along the lines of braindump below in
> somewhere in Documentation/*; comments and improvements are very
> welcome - this is just a starting point. We *do* need some coherent
> explanation of signal semantics, judging by how often people step on
> the same landmines...]
Thanks, this helps a lot.
Cheers
James
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists