On 07/31, Manfred Spraul wrote: > > Mainline has the same problem: poll() returns to user space if it's > interrupted by SIGSTOP/SIGCONT. > >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? > > > > > Yes, please queue it: most/all linux versions show this behavior. > Additionally, poll() is usually called in a loop and a spurious wakeup > has no consequences.
... and so the current behaviour is more or less correct, even if not optimal. But this patch in fact adds a bug. We don't even need the "special" signals like SIGSTOP/SIGCONT or freezer to hit this bug. Suppose that sys_poll() was interrupted by a "normal" signal which has a handler. It is quite possible that another thread can steal this signal before us. Now, ERESTARTNOHAND means we restart sys_poll() with the same (old) timeout, this means that sys_poll() does _not_ return when timeout expired (if no fds ready), and this is bug. Also, the false signal_wake_up() is possible, and again, the spurious -EINTR is better than restart with the same timeout. What we need is ERESTART_RESTARTBLOCK, and restart_block.arg2 should have the new timeout value, which takes the time we already slept into account. 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/