[PATCH] Set TIF_IRET in more places

From: Luca Barbieri (ldb@ldb.ods.org)
Date: Mon Jan 06 2003 - 09:46:01 EST


This patch adds code to set TIF_IRET in sigsuspend and rt_sigsuspend
(since they change registers to invoke signal handlers) and ptrace
setregs. This prevents clobbering of %ecx and %edx.

diff --exclude-from=/home/ldb/src/exclude -urNdp --exclude='speedtouch.*' --exclude='atmsar.*' linux-2.5.54/arch/i386/kernel/ptrace.c linux-2.5.54-ldb/arch/i386/kernel/ptrace.c
--- linux-2.5.54/arch/i386/kernel/ptrace.c 2003-01-02 04:21:29.000000000 +0100
+++ linux-2.5.54-ldb/arch/i386/kernel/ptrace.c 2003-01-04 19:06:07.000000000 +0100
@@ -74,6 +74,8 @@ static inline int put_stack_long(struct
 static int putreg(struct task_struct *child,
         unsigned long regno, unsigned long value)
 {
+ set_tsk_thread_flag(child, TIF_IRET);
+
         switch (regno >> 2) {
                 case FS:
                         if (value && (value & 3) != 3)
diff --exclude-from=/home/ldb/src/exclude -urNdp --exclude='speedtouch.*' --exclude='atmsar.*' linux-2.5.54/arch/i386/kernel/signal.c linux-2.5.54-ldb/arch/i386/kernel/signal.c
--- linux-2.5.54/arch/i386/kernel/signal.c 2003-01-02 04:21:53.000000000 +0100
+++ linux-2.5.54-ldb/arch/i386/kernel/signal.c 2003-01-04 19:06:07.000000000 +0100
@@ -44,6 +44,7 @@ sys_sigsuspend(int history0, int history
         spin_unlock_irq(&current->sig->siglock);
 
         regs->eax = -EINTR;
+ set_thread_flag(TIF_IRET);
         while (1) {
                 current->state = TASK_INTERRUPTIBLE;
                 schedule();
@@ -73,6 +74,7 @@ sys_rt_sigsuspend(sigset_t *unewset, siz
         spin_unlock_irq(&current->sig->siglock);
 
         regs->eax = -EINTR;
+ set_thread_flag(TIF_IRET);
         while (1) {
                 current->state = TASK_INTERRUPTIBLE;
                 schedule();



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Jan 07 2003 - 22:00:31 EST