Thread (82 messages) flat view 82 messages, 11 authors, 2013-01-07

Re: [braindump][RFC] signals and syscall restarts (Re: [PATCH v2 19/44] metag: Signal handling)

From: James Hogan <hidden>
Date: 2012-12-10 10:41:12
Also in: lkml

On 06/12/12 22:09, Al Viro wrote:
On Thu, Dec 06, 2012 at 11:17:34AM +0000, James Hogan wrote:
quoted
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 :)
quoted
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help