diff options
author | Jeff Dike <jdike@addtoit.com> | 2007-02-10 04:44:30 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-11 13:51:24 -0500 |
commit | 6e6d74cfac782a3a4cb5111bd9c25cd95d6b7c6c (patch) | |
tree | f63c0433740168f56916ece27793e9b69a40e072 /arch/um/sys-x86_64/syscalls.c | |
parent | f355559cf78455ed6be103b020e4b800230c64eb (diff) |
[PATCH] uml: x86_64 ptrace fixes
This patch fixes some missing ptrace bits on x86_64. PTRACE_ARCH_PRCTL is
hooked up and implemented. This required generalizing arch_prctl_skas
slightly to take a task_struct to modify. Previously, it always operated on
current.
Reading and writing the debug registers is also enabled by un-ifdefing the
code that implements that. It turns out that x86_64 is identical to i386, so
the same code can be used.
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um/sys-x86_64/syscalls.c')
-rw-r--r-- | arch/um/sys-x86_64/syscalls.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/arch/um/sys-x86_64/syscalls.c b/arch/um/sys-x86_64/syscalls.c index f309fa9bc232..01b91f9fa789 100644 --- a/arch/um/sys-x86_64/syscalls.c +++ b/arch/um/sys-x86_64/syscalls.c | |||
@@ -59,18 +59,20 @@ static long arch_prctl_tt(int code, unsigned long addr) | |||
59 | 59 | ||
60 | #ifdef CONFIG_MODE_SKAS | 60 | #ifdef CONFIG_MODE_SKAS |
61 | 61 | ||
62 | static long arch_prctl_skas(int code, unsigned long __user *addr) | 62 | long arch_prctl_skas(struct task_struct *task, int code, |
63 | unsigned long __user *addr) | ||
63 | { | 64 | { |
64 | unsigned long *ptr = addr, tmp; | 65 | unsigned long *ptr = addr, tmp; |
65 | long ret; | 66 | long ret; |
66 | int pid = current->mm->context.skas.id.u.pid; | 67 | int pid = task->mm->context.skas.id.u.pid; |
67 | 68 | ||
68 | /* | 69 | /* |
69 | * With ARCH_SET_FS (and ARCH_SET_GS is treated similarly to | 70 | * With ARCH_SET_FS (and ARCH_SET_GS is treated similarly to |
70 | * be safe), we need to call arch_prctl on the host because | 71 | * be safe), we need to call arch_prctl on the host because |
71 | * setting %fs may result in something else happening (like a | 72 | * setting %fs may result in something else happening (like a |
72 | * GDT being set instead). So, we let the host fiddle the | 73 | * GDT or thread.fs being set instead). So, we let the host |
73 | * registers and restore them afterwards. | 74 | * fiddle the registers and thread struct and restore the |
75 | * registers afterwards. | ||
74 | * | 76 | * |
75 | * So, the saved registers are stored to the process (this | 77 | * So, the saved registers are stored to the process (this |
76 | * needed because a stub may have been the last thing to run), | 78 | * needed because a stub may have been the last thing to run), |
@@ -118,7 +120,7 @@ static long arch_prctl_skas(int code, unsigned long __user *addr) | |||
118 | 120 | ||
119 | long sys_arch_prctl(int code, unsigned long addr) | 121 | long sys_arch_prctl(int code, unsigned long addr) |
120 | { | 122 | { |
121 | return CHOOSE_MODE_PROC(arch_prctl_tt, arch_prctl_skas, code, | 123 | return CHOOSE_MODE_PROC(arch_prctl_tt, arch_prctl_skas, current, code, |
122 | (unsigned long __user *) addr); | 124 | (unsigned long __user *) addr); |
123 | } | 125 | } |
124 | 126 | ||
@@ -141,6 +143,6 @@ void arch_switch_to_skas(struct task_struct *from, struct task_struct *to) | |||
141 | if(to->thread.arch.fs == 0) | 143 | if(to->thread.arch.fs == 0) |
142 | return; | 144 | return; |
143 | 145 | ||
144 | arch_prctl_skas(ARCH_SET_FS, (void __user *) to->thread.arch.fs); | 146 | arch_prctl_skas(to, ARCH_SET_FS, (void __user *) to->thread.arch.fs); |
145 | } | 147 | } |
146 | 148 | ||