Re: [PATCH] Use ERESTARTNOHAND if poll() is interrupted by a signal

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

 



On 07/30, Andrew Morton wrote:
>
> On Sun, 29 Jul 2007 19:05:05 +0200
> Manfred Spraul <[email protected]> wrote:
> 
> > Hi Andrew,
> > 
> > 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.
> 
> hm.  Is this a fix against
> ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.23-rc1/2.6.23-rc1-mm1/broken-out/do_poll-return-eintr-when-signalled.patch
> only, or does mainline also need fixing?

That patch doesn't (at least shouldn't) change the behaviour.

> I guess the consequences of the thing-which-this-fixes aren't huge, s I ca
> queue this up for 2.6.24, after Oleg's
> do_poll-return-eintr-when-signalled.patch?
> 
> > Signed-off-by: Manfred Spraul <[email protected]>
> > 
> > --- 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.

Oleg.

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux