x86/signals: Clear RF EFLAGS bit for signal handler
authorJiri Olsa <[email protected]>
Wed, 1 May 2013 15:25:42 +0000 (17:25 +0200)
committerIngo Molnar <[email protected]>
Tue, 28 May 2013 06:46:52 +0000 (08:46 +0200)
Clearing RF EFLAGS bit for signal handler. The reason is
that this flag is set by debug exception code to prevent
the recursive exception entry.

Leaving it set for signal handler might prevent debug
exception of the signal handler itself.

Signed-off-by: Jiri Olsa <[email protected]>
Tested-by: Oleg Nesterov <[email protected]>
Reviewed-by: Frederic Weisbecker <[email protected]>
Originally-Reported-by: Vince Weaver <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Corey Ashford <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Vince Weaver <[email protected]>
Cc: Stephane Eranian <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
arch/x86/kernel/signal.c

index 9df4c0b5ecac54afac6f0d4f9d30c51973290ecb..cb12fc9c0642052a8306a77f0425e03af2f2c08c 100644 (file)
@@ -664,6 +664,12 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs)
                 * Clear the direction flag as per the ABI for function entry.
                 */
                regs->flags &= ~X86_EFLAGS_DF;
+               /*
+                * Clear RF when entering the signal handler, because
+                * it might disable possible debug exception from the
+                * signal handler.
+                */
+               regs->flags &= ~X86_EFLAGS_RF;
                /*
                 * Clear TF when entering the signal handler, but
                 * notify any tracer that was single-stepping it.