diff options
-rw-r--r-- | arch/x86/kernel/ptrace_32.c | 12 | ||||
-rw-r--r-- | arch/x86/kernel/ptrace_64.c | 12 | ||||
-rw-r--r-- | include/asm-x86/ptrace.h | 7 |
3 files changed, 19 insertions, 12 deletions
diff --git a/arch/x86/kernel/ptrace_32.c b/arch/x86/kernel/ptrace_32.c index 4619bda470b6..1402a54ef61f 100644 --- a/arch/x86/kernel/ptrace_32.c +++ b/arch/x86/kernel/ptrace_32.c | |||
@@ -218,7 +218,7 @@ static inline int is_setting_trap_flag(struct task_struct *child, struct pt_regs | |||
218 | return 0; | 218 | return 0; |
219 | } | 219 | } |
220 | 220 | ||
221 | static void set_singlestep(struct task_struct *child) | 221 | void user_enable_single_step(struct task_struct *child) |
222 | { | 222 | { |
223 | struct pt_regs *regs = get_child_regs(child); | 223 | struct pt_regs *regs = get_child_regs(child); |
224 | 224 | ||
@@ -249,7 +249,7 @@ static void set_singlestep(struct task_struct *child) | |||
249 | child->ptrace |= PT_DTRACE; | 249 | child->ptrace |= PT_DTRACE; |
250 | } | 250 | } |
251 | 251 | ||
252 | static void clear_singlestep(struct task_struct *child) | 252 | void user_disable_single_step(struct task_struct *child) |
253 | { | 253 | { |
254 | /* Always clear TIF_SINGLESTEP... */ | 254 | /* Always clear TIF_SINGLESTEP... */ |
255 | clear_tsk_thread_flag(child, TIF_SINGLESTEP); | 255 | clear_tsk_thread_flag(child, TIF_SINGLESTEP); |
@@ -269,7 +269,7 @@ static void clear_singlestep(struct task_struct *child) | |||
269 | */ | 269 | */ |
270 | void ptrace_disable(struct task_struct *child) | 270 | void ptrace_disable(struct task_struct *child) |
271 | { | 271 | { |
272 | clear_singlestep(child); | 272 | user_disable_single_step(child); |
273 | clear_tsk_thread_flag(child, TIF_SYSCALL_EMU); | 273 | clear_tsk_thread_flag(child, TIF_SYSCALL_EMU); |
274 | } | 274 | } |
275 | 275 | ||
@@ -403,7 +403,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
403 | } | 403 | } |
404 | child->exit_code = data; | 404 | child->exit_code = data; |
405 | /* make sure the single step bit is not set. */ | 405 | /* make sure the single step bit is not set. */ |
406 | clear_singlestep(child); | 406 | user_disable_single_step(child); |
407 | wake_up_process(child); | 407 | wake_up_process(child); |
408 | ret = 0; | 408 | ret = 0; |
409 | break; | 409 | break; |
@@ -419,7 +419,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
419 | break; | 419 | break; |
420 | child->exit_code = SIGKILL; | 420 | child->exit_code = SIGKILL; |
421 | /* make sure the single step bit is not set. */ | 421 | /* make sure the single step bit is not set. */ |
422 | clear_singlestep(child); | 422 | user_disable_single_step(child); |
423 | wake_up_process(child); | 423 | wake_up_process(child); |
424 | break; | 424 | break; |
425 | 425 | ||
@@ -435,7 +435,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
435 | clear_tsk_thread_flag(child, TIF_SYSCALL_EMU); | 435 | clear_tsk_thread_flag(child, TIF_SYSCALL_EMU); |
436 | 436 | ||
437 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 437 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
438 | set_singlestep(child); | 438 | user_enable_single_step(child); |
439 | child->exit_code = data; | 439 | child->exit_code = data; |
440 | /* give it a chance to run. */ | 440 | /* give it a chance to run. */ |
441 | wake_up_process(child); | 441 | wake_up_process(child); |
diff --git a/arch/x86/kernel/ptrace_64.c b/arch/x86/kernel/ptrace_64.c index 8e433b3773d2..7373a99facf3 100644 --- a/arch/x86/kernel/ptrace_64.c +++ b/arch/x86/kernel/ptrace_64.c | |||
@@ -170,7 +170,7 @@ static int is_setting_trap_flag(struct task_struct *child, struct pt_regs *regs) | |||
170 | return 0; | 170 | return 0; |
171 | } | 171 | } |
172 | 172 | ||
173 | static void set_singlestep(struct task_struct *child) | 173 | void user_enable_single_step(struct task_struct *child) |
174 | { | 174 | { |
175 | struct pt_regs *regs = task_pt_regs(child); | 175 | struct pt_regs *regs = task_pt_regs(child); |
176 | 176 | ||
@@ -201,7 +201,7 @@ static void set_singlestep(struct task_struct *child) | |||
201 | child->ptrace |= PT_DTRACE; | 201 | child->ptrace |= PT_DTRACE; |
202 | } | 202 | } |
203 | 203 | ||
204 | static void clear_singlestep(struct task_struct *child) | 204 | void user_disable_single_step(struct task_struct *child) |
205 | { | 205 | { |
206 | /* Always clear TIF_SINGLESTEP... */ | 206 | /* Always clear TIF_SINGLESTEP... */ |
207 | clear_tsk_thread_flag(child, TIF_SINGLESTEP); | 207 | clear_tsk_thread_flag(child, TIF_SINGLESTEP); |
@@ -221,7 +221,7 @@ static void clear_singlestep(struct task_struct *child) | |||
221 | */ | 221 | */ |
222 | void ptrace_disable(struct task_struct *child) | 222 | void ptrace_disable(struct task_struct *child) |
223 | { | 223 | { |
224 | clear_singlestep(child); | 224 | user_disable_single_step(child); |
225 | } | 225 | } |
226 | 226 | ||
227 | static int putreg(struct task_struct *child, | 227 | static int putreg(struct task_struct *child, |
@@ -461,7 +461,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
461 | clear_tsk_thread_flag(child, TIF_SINGLESTEP); | 461 | clear_tsk_thread_flag(child, TIF_SINGLESTEP); |
462 | child->exit_code = data; | 462 | child->exit_code = data; |
463 | /* make sure the single step bit is not set. */ | 463 | /* make sure the single step bit is not set. */ |
464 | clear_singlestep(child); | 464 | user_disable_single_step(child); |
465 | wake_up_process(child); | 465 | wake_up_process(child); |
466 | ret = 0; | 466 | ret = 0; |
467 | break; | 467 | break; |
@@ -504,7 +504,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
504 | clear_tsk_thread_flag(child, TIF_SINGLESTEP); | 504 | clear_tsk_thread_flag(child, TIF_SINGLESTEP); |
505 | child->exit_code = SIGKILL; | 505 | child->exit_code = SIGKILL; |
506 | /* make sure the single step bit is not set. */ | 506 | /* make sure the single step bit is not set. */ |
507 | clear_singlestep(child); | 507 | user_disable_single_step(child); |
508 | wake_up_process(child); | 508 | wake_up_process(child); |
509 | break; | 509 | break; |
510 | 510 | ||
@@ -513,7 +513,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
513 | if (!valid_signal(data)) | 513 | if (!valid_signal(data)) |
514 | break; | 514 | break; |
515 | clear_tsk_thread_flag(child,TIF_SYSCALL_TRACE); | 515 | clear_tsk_thread_flag(child,TIF_SYSCALL_TRACE); |
516 | set_singlestep(child); | 516 | user_enable_single_step(child); |
517 | child->exit_code = data; | 517 | child->exit_code = data; |
518 | /* give it a chance to run. */ | 518 | /* give it a chance to run. */ |
519 | wake_up_process(child); | 519 | wake_up_process(child); |
diff --git a/include/asm-x86/ptrace.h b/include/asm-x86/ptrace.h index 105d1534eaf4..fe75422f034b 100644 --- a/include/asm-x86/ptrace.h +++ b/include/asm-x86/ptrace.h | |||
@@ -140,6 +140,13 @@ enum { | |||
140 | 140 | ||
141 | #ifdef __KERNEL__ | 141 | #ifdef __KERNEL__ |
142 | 142 | ||
143 | /* | ||
144 | * These are defined as per linux/ptrace.h, which see. | ||
145 | */ | ||
146 | #define arch_has_single_step() (1) | ||
147 | extern void user_enable_single_step(struct task_struct *); | ||
148 | extern void user_disable_single_step(struct task_struct *); | ||
149 | |||
143 | struct user_desc; | 150 | struct user_desc; |
144 | extern int do_get_thread_area(struct task_struct *p, int idx, | 151 | extern int do_get_thread_area(struct task_struct *p, int idx, |
145 | struct user_desc __user *info); | 152 | struct user_desc __user *info); |