Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 30458
b: refs/heads/master
c: f0f2d65
h: refs/heads/master
v: v3
  • Loading branch information
Andi Kleen authored and Linus Torvalds committed Jun 26, 2006
1 parent 5f2d88e commit 5eab325
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f5adc9c79d3a15478c0028139c54453ff3900488
refs/heads/master: f0f2d6536e3515b5b1b7ae97dc8f176860c8c2ce
41 changes: 35 additions & 6 deletions trunk/arch/x86_64/ia32/ptrace32.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <asm/debugreg.h>
#include <asm/i387.h>
#include <asm/fpu32.h>
#include <asm/ia32.h>

/*
* Determines which flags the user has access to [1 = access, 0 = no access].
Expand Down Expand Up @@ -199,6 +200,24 @@ static int getreg32(struct task_struct *child, unsigned regno, u32 *val)

#undef R32

static long ptrace32_siginfo(unsigned request, u32 pid, u32 addr, u32 data)
{
int ret;
compat_siginfo_t *si32 = (compat_siginfo_t *)compat_ptr(data);
siginfo_t *si = compat_alloc_user_space(sizeof(siginfo_t));
if (request == PTRACE_SETSIGINFO) {
ret = copy_siginfo_from_user32(si, si32);
if (ret)
return ret;
}
ret = sys_ptrace(request, pid, addr, (unsigned long)si);
if (ret)
return ret;
if (request == PTRACE_GETSIGINFO)
ret = copy_siginfo_to_user32(si32, si);
return ret;
}

asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
{
struct task_struct *child;
Expand All @@ -208,9 +227,19 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
__u32 val;

switch (request) {
default:
case PTRACE_TRACEME:
case PTRACE_ATTACH:
case PTRACE_KILL:
case PTRACE_CONT:
case PTRACE_SINGLESTEP:
case PTRACE_DETACH:
case PTRACE_SYSCALL:
case PTRACE_SETOPTIONS:
return sys_ptrace(request, pid, addr, data);

default:
return -EINVAL;

case PTRACE_PEEKTEXT:
case PTRACE_PEEKDATA:
case PTRACE_POKEDATA:
Expand All @@ -225,10 +254,11 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
case PTRACE_GETFPXREGS:
case PTRACE_GETEVENTMSG:
break;
}

if (request == PTRACE_TRACEME)
return ptrace_traceme();
case PTRACE_SETSIGINFO:
case PTRACE_GETSIGINFO:
return ptrace32_siginfo(request, pid, addr, data);
}

child = ptrace_get_task_struct(pid);
if (IS_ERR(child))
Expand Down Expand Up @@ -349,8 +379,7 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
break;

default:
ret = -EINVAL;
break;
BUG();
}

out:
Expand Down

0 comments on commit 5eab325

Please sign in to comment.