Below is a patch to ptrace that I would like to get into 2.3. It allows
ptrace to change system call numbers. I need it for the user-mode kernel, and
Michael Elizabeth Chastain (mec@shout.net) needs it for his trace-and-replay
debugger. I'd appreciate it if people would look at it and let me know about
any problems.
Jeff
diff -u -r -N -X ../exclude-files orig/arch/i386/kernel/entry.S
um/arch/i386/ker
nel/entry.S
--- orig/arch/i386/kernel/entry.S Sun Aug 1 18:02:48 1999
+++ um/arch/i386/kernel/entry.S Tue Aug 3 12:38:44 1999
@@ -214,9 +214,14 @@
movl $-ENOSYS,EAX(%esp)
call SYMBOL_NAME(syscall_trace)
movl ORIG_EAX(%esp),%eax
- call *SYMBOL_NAME(sys_call_table)(,%eax,4)
+ cmpl $(NR_syscalls),%eax
+ jae 1f
+ movl SYMBOL_NAME(sys_call_table)(,%eax,4),%eax
+ testl %eax,%eax
+ je 1f
+ call *%eax
movl %eax,EAX(%esp) # save the return value
- call SYMBOL_NAME(syscall_trace)
+1: call SYMBOL_NAME(syscall_trace)
jmp ret_from_sys_call
badsys:
movl $-ENOSYS,EAX(%esp)
diff -u -r -N -X ../exclude-files orig/arch/i386/kernel/ptrace.c
um/arch/i386/ke
rnel/ptrace.c
--- orig/arch/i386/kernel/ptrace.c Sun Aug 1 18:02:49 1999
+++ um/arch/i386/kernel/ptrace.c Tue Aug 3 13:43:42 1999
@@ -11,6 +11,7 @@
#include <linux/errno.h>
#include <linux/ptrace.h>
#include <linux/user.h>
+#include <linux/sys.h>
#include <asm/uaccess.h>
#include <asm/pgtable.h>
@@ -72,7 +73,9 @@
{
switch (regno >> 2) {
case ORIG_EAX:
- return -EIO;
+ if (value >= NR_syscalls)
+ return -EIO;
+ break;
case FS:
if (value && (value & 3) != 3)
return -EIO;
-
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/