[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20111026151005.GA1413@flint.arm.linux.org.uk>
Date: Wed, 26 Oct 2011 16:10:05 +0100
From: Russell King <rmk@....linux.org.uk>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Oleg Nesterov <oleg@...hat.com>,
Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
Peter Zijlstra <peterz@...radead.org>,
"H. Peter Anvin" <hpa@...or.com>,
Steven Rostedt <rostedt@...dmis.org>,
Christoph Hellwig <hch@...radead.org>,
Ananth N Mavinakayanahalli <ananth@...ibm.com>,
Thomas Gleixner <tglx@...utronix.de>,
Andi Kleen <andi@...stfloor.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Jim Keniston <jkenisto@...ux.vnet.ibm.com>,
Roland McGrath <roland@...k.frob.com>,
Shuah Khan <shuah.khan@...com>, Ingo Molnar <mingo@...e.hu>,
Alexander van Heukelum <heukelum@...tmail.fm>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [RESEND] [RFC][PATCH X86_32 1/2]: Call do_notify_resume() with
interrupts enabled
On Wed, Oct 26, 2011 at 02:38:39PM +0200, Linus Torvalds wrote:
> Ingo, Thomas, I think this is your call, but it seems valid,
Hi Linus,
I guess I should've talked to you about this during a moment during the
kernel summit, but as I'm now back home it'll have to be email.
I've been toying with a similar patch for ARM, but I keep feeling uneasy
about having interrupts enabled in this path (even though they get enabled
in the depths of the signal handling code.)
I worry about are race condition like the following:
syscall enter
...
syscall returns -ERESTARTNOHAND
check for signal
signal pending, but no handler, setup for restart
interrupt happens, sets need_resched
need_resched set
switch to another thread
...
something happens which queues SIGIO
switch back to this thread
check for signal
signal pending, has handler, but we've setup for a restart
return to userspace
run SIGIO handler
restart syscall
This feels like it violates the expectations of the syscall being
restarted - which explicitly asks to be restarted only if there wasn't
a handler run.
I've been working on the assumption that this is a problem and we should
do something about it - but it's non-trivial to solve all the corner cases.
We can do a lot better with the restarting if we delay setting up for a
restart until either we setup the user stack for the sig handler or
immediately before returning to userspace (with a TIF flag.)
If you're interested in seeing where I got to, the patch is available at:
https://lkml.org/lkml/2011/8/25/231
However, that doesn't solve the (probably unsolvable) case where an
ERESTARTSYS syscall is interrupted by a SA_RESTART-marked handler, and
while that handler is running it is then interrupted by a non-SA_RESTART-
marked handler. I think that is far too an obscure case to care about
though.
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of:
--
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