lkml.org 
[lkml]   [1998]   [Dec]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] ptrace(PTRACE_POKEUSR, pid, ORIG_EAX, syscall)
Date
This small patch allows changing ptraced process's ORIG_EAX, which
contains the system call number.

I tried this on a program under ptrace, it called brk(), but Linux saw
getuid() and returned the user id.

Some real examples:
fork -> clone(CLONE_PTRACE)
fork -> getpid
exec -> _exit
unlink -> rename

-Topi

diff -ru arch/i386/kernel/ptrace.c.orig arch/i386/kernel/ptrace.c
--- arch/i386/kernel/ptrace.c.orig Wed Sep 30 20:16:56 1998
+++ arch/i386/kernel/ptrace.c Wed Dec 2 21:40:41 1998
@@ -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>
@@ -290,7 +291,9 @@
{
switch (regno >> 2) {
case ORIG_EAX:
- return -EIO;
+ if (value < 0 || 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/

\
 
 \ /
  Last update: 2005-03-22 13:45    [W:0.049 / U:0.776 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site