Patch for arch/i386/kernel/ptrace.c

From: Ralph Loader (suckfish@ihug.co.nz)
Date: Sat Jan 15 2000 - 02:39:19 EST


Hi,

In both 2.3.39 and 2.2.14 on i386, sys_ptrace appears to be able to return
without unlocking the kernel.

Patch included - not tested (I don't have a SMP machine).

Ralph.

--- arch/i386/kernel/ptrace.c.orig Wed Oct 13 06:05:53 1999
+++ arch/i386/kernel/ptrace.c Sat Jan 15 20:32:40 2000
@@ -258,15 +258,15 @@
                      have to be selective about what portions we allow someone
                      to modify. */
 
+ ret = -EIO;
                   if(addr >= (long) &dummy->u_debugreg[0] &&
                      addr <= (long) &dummy->u_debugreg[7]){
 
- if(addr == (long) &dummy->u_debugreg[4]) return -EIO;
- if(addr == (long) &dummy->u_debugreg[5]) return -EIO;
+ if(addr == (long) &dummy->u_debugreg[4]) goto out;
+ if(addr == (long) &dummy->u_debugreg[5]) goto out;
                           if(addr < (long) &dummy->u_debugreg[4] &&
- ((unsigned long) data) >= TASK_SIZE-3) return -EIO;
+ ((unsigned long) data) >= TASK_SIZE-3) goto out;
                           
- ret = -EIO;
                           if(addr == (long) &dummy->u_debugreg[7]) {
                                   data &= ~DR_CONTROL_RESERVED;
                                   for(i=0; i<4; i++)
@@ -280,7 +280,6 @@
                           ret = 0;
                           goto out;
                   };
- ret = -EIO;
                   goto out;
 
                 case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */

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



This archive was generated by hypermail 2b29 : Sat Jan 15 2000 - 21:00:25 EST