[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120426132203.GA14401@redhat.com>
Date: Thu, 26 Apr 2012 15:22:03 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Al Viro <viro@...IV.linux.org.uk>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
linux-arch@...r.kernel.org, linux-kernel@...r.kernel.org,
Russell King <linux@....linux.org.uk>,
Tejun Heo <tj@...nel.org>, Arnd Bergmann <arnd@...db.de>,
Roland McGrath <roland@...k.frob.com>
Subject: Re: [RFC] TIF_NOTIFY_RESUME, arch/*/*/*signal*.c and all such
On 04/25, Al Viro wrote:
>
> do_signal()
> {
> if (we have any business doing restarts)
> // note: we won't get here on subsequent calls of do_signal()
> // due to the checks above; same logics that currently prevents
> // double restarts
> set NEED_RESTART flag
> sig = get_signal_to_deliver(...)
> if (sig) {
> if (NEED_RESTART set) {
> clear NEED_RESTART
> same thing we do at that spot now - restart or EINTR
> handle_signal(...)
> ...
> return;
> }
> }
> /* no handler */
> if (test_and_clear_...(RESTORE_SIGMASK))
> set_current_blocked(¤t->saved_sigmask);
> }
OK,
> and in asm glue,
Ah. So we are going to change the ret_from_sys_call-like code.
> check
> NEED_RESTART and if it's set do what we currently do for restarts on
> handlerless signal.
and probably we should clear NEED_RESTART?
OK, thanks, I am starting to understand.
However. Perhaps I missed something, but this doesn't look 100% correct.
Although even _if_ I am right I guess this is pure theoretical problem.
Suppose that we restart the syscall which returned ERESTARTNOHAND. I mean,
the task has already returned to the user-mode and CPU is going to execute
the syscall insn.
What if, say, reschedule interrupt comes before the task enters the kernel
again? The new signal can come before this task returns to the user-mode,
ret_from_intr: will notice it and it is still possible to run a signal
handler before re-entering the syscall.
No?
Oleg.
--
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