mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] UML - Fix setting of TIF_SIGPENDING
@ 2004-12-03 21:44 Jeff Dike
  0 siblings, 0 replies; only message in thread
From: Jeff Dike @ 2004-12-03 21:44 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, Blaisorblade, Bodo Stroesser

From: Bodo Stroesser <bstroesser@fujitsu-siemens.com>

My older patch, that sets TIF_SIGPENDING after an ptrace-interception
in syscall_trace() is wrong.
Some syscalls want to be called without any signal pending. If a signal
is pending on syscall-entry, they immediately return with -ERESTARTNOINTR.
Thus, on return to user, the pending signals can be processed and the
kernel will lower eip by 2 to have the syscall restarted after that.
Since my change sets TIF_SIGPENDING on the entry and exit interception,
stracing such a syscall looped! Try "strace ls" to see what happens.
Fix: set TIF_SIGPENDING on the exit interception only. This avoids the
loop and is enough for security.

Signed-off-by: Bodo Stroesser <bstroesser@fujitsu-siemens.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>

Index: 2.6.9/arch/um/kernel/ptrace.c
===================================================================
--- 2.6.9.orig/arch/um/kernel/ptrace.c	2004-12-01 23:43:11.000000000 -0500
+++ 2.6.9/arch/um/kernel/ptrace.c	2004-12-01 23:52:23.000000000 -0500
@@ -330,8 +330,8 @@
 	tracesysgood = (current->ptrace & PT_TRACESYSGOOD) && !is_singlestep;
 	ptrace_notify(SIGTRAP | (tracesysgood ? 0x80 : 0));
 
-	/* force do_signal() --> is_syscall() */
-	set_thread_flag(TIF_SIGPENDING);
+	if (entryexit) /* force do_signal() --> is_syscall() */
+		set_thread_flag(TIF_SIGPENDING);
 
 	/* this isn't the same as continuing with a signal, but it will do
 	 * for normal use.  strace only continues with a signal if the


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-12-03 19:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-03 21:44 [PATCH] UML - Fix setting of TIF_SIGPENDING Jeff Dike

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®