aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/signal_32.c
diff options
context:
space:
mode:
authorAurelien Jarno <aurelien@aurel32.net>2008-03-05 13:14:24 -0500
committerIngo Molnar <mingo@elte.hu>2008-03-07 10:39:14 -0500
commite40cd10ccff3d9fbffd57b93780bee4b7b9bff51 (patch)
treebdc58b9f84e7e4bd37da3bfb1f9a445a1560c0c3 /arch/x86/kernel/signal_32.c
parentce4796d1e16cf3761dc2a02b8d588667d05b3078 (diff)
x86: clear DF before calling signal handler
The Linux kernel currently does not clear the direction flag before calling a signal handler, whereas the x86/x86-64 ABI requires that. Linux had this behavior/bug forever, but this becomes a real problem with gcc version 4.3, which assumes that the direction flag is correctly cleared at the entry of a function. This patches changes the setup_frame() functions to clear the direction before entering the signal handler. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Ingo Molnar <mingo@elte.hu> Acked-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/x86/kernel/signal_32.c')
-rw-r--r--arch/x86/kernel/signal_32.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/kernel/signal_32.c b/arch/x86/kernel/signal_32.c
index caee1f002fe..0157a6f0f41 100644
--- a/arch/x86/kernel/signal_32.c
+++ b/arch/x86/kernel/signal_32.c
@@ -407,7 +407,7 @@ static int setup_frame(int sig, struct k_sigaction *ka,
407 * The tracer may want to single-step inside the 407 * The tracer may want to single-step inside the
408 * handler too. 408 * handler too.
409 */ 409 */
410 regs->flags &= ~TF_MASK; 410 regs->flags &= ~(TF_MASK | X86_EFLAGS_DF);
411 if (test_thread_flag(TIF_SINGLESTEP)) 411 if (test_thread_flag(TIF_SINGLESTEP))
412 ptrace_notify(SIGTRAP); 412 ptrace_notify(SIGTRAP);
413 413
@@ -500,7 +500,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
500 * The tracer may want to single-step inside the 500 * The tracer may want to single-step inside the
501 * handler too. 501 * handler too.
502 */ 502 */
503 regs->flags &= ~TF_MASK; 503 regs->flags &= ~(TF_MASK | X86_EFLAGS_DF);
504 if (test_thread_flag(TIF_SINGLESTEP)) 504 if (test_thread_flag(TIF_SINGLESTEP))
505 ptrace_notify(SIGTRAP); 505 ptrace_notify(SIGTRAP);
506 506