lkml.org 
[lkml]   [2007]   [Jul]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Use ERESTARTNOHAND if poll() is interrupted by a signal
On 07/31, Oleg Nesterov wrote:
>
> > Manfred Spraul <manfred@colorfullife.com> wrote:
> >
> > > poll() returns -EINTR if a signal is pending.
> > > EINTR is a bad choice: it means that poll returns to user space if the
> > > task is stopped by SIGSTOP/SIGCONT or by the freezer.
> > > select() and ppoll() both use ERESTARTNOHAND, this avoids a return to
> > > user space for signals that are handled by the kernel.
> > >
> > > The patch switches poll() to ERESTARTNOHAND.
> > > Tested with FC6. Patch against 2.6.23-rc1-mm1.
> >
> > > --- 2.6/fs/select.c 2007-07-28 20:31:51.000000000 +0200
> > > +++ build-2.6/fs/select.c 2007-07-28 21:21:52.000000000 +0200
> > > @@ -621,7 +621,7 @@ static int do_poll(unsigned int nfds, s
> > > if (!count) {
> > > count = wait->error;
> > > if (signal_pending(current))
> > > - count = -EINTR;
> > > + count = -ERESTARTNOHAND;
>
> I am not sure. This means we restart sys_poll() with the same timeout
> if there is no pending signal. I think we need ERESTART_RESTARTBLOCK
> logic.

Forgot to mention, sys_select() can use ERESTARTNOHAND because it
modifies "struct timeval __user *tvp" before return, but sys_poll()
gets timeout_msecs by value.

Oleg.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-07-31 02:21    [W:0.071 / U:0.620 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site