diff options
Diffstat (limited to 'arch/arm/kernel/ptrace.c')
| -rw-r--r-- | arch/arm/kernel/ptrace.c | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c index f003062c9457..e591f72bcdeb 100644 --- a/arch/arm/kernel/ptrace.c +++ b/arch/arm/kernel/ptrace.c | |||
| @@ -55,23 +55,6 @@ | |||
| 55 | #endif | 55 | #endif |
| 56 | 56 | ||
| 57 | /* | 57 | /* |
| 58 | * Get the address of the live pt_regs for the specified task. | ||
| 59 | * These are saved onto the top kernel stack when the process | ||
| 60 | * is not running. | ||
| 61 | * | ||
| 62 | * Note: if a user thread is execve'd from kernel space, the | ||
| 63 | * kernel stack will not be empty on entry to the kernel, so | ||
| 64 | * ptracing these tasks will fail. | ||
| 65 | */ | ||
| 66 | static inline struct pt_regs * | ||
| 67 | get_user_regs(struct task_struct *task) | ||
| 68 | { | ||
| 69 | return (struct pt_regs *) | ||
| 70 | ((unsigned long)task->thread_info + THREAD_SIZE - | ||
| 71 | 8 - sizeof(struct pt_regs)); | ||
| 72 | } | ||
| 73 | |||
| 74 | /* | ||
| 75 | * this routine will get a word off of the processes privileged stack. | 58 | * this routine will get a word off of the processes privileged stack. |
| 76 | * the offset is how far from the base addr as stored in the THREAD. | 59 | * the offset is how far from the base addr as stored in the THREAD. |
| 77 | * this routine assumes that all the privileged stacks are in our | 60 | * this routine assumes that all the privileged stacks are in our |
| @@ -79,7 +62,7 @@ get_user_regs(struct task_struct *task) | |||
| 79 | */ | 62 | */ |
| 80 | static inline long get_user_reg(struct task_struct *task, int offset) | 63 | static inline long get_user_reg(struct task_struct *task, int offset) |
| 81 | { | 64 | { |
| 82 | return get_user_regs(task)->uregs[offset]; | 65 | return task_pt_regs(task)->uregs[offset]; |
| 83 | } | 66 | } |
| 84 | 67 | ||
| 85 | /* | 68 | /* |
| @@ -91,7 +74,7 @@ static inline long get_user_reg(struct task_struct *task, int offset) | |||
| 91 | static inline int | 74 | static inline int |
| 92 | put_user_reg(struct task_struct *task, int offset, long data) | 75 | put_user_reg(struct task_struct *task, int offset, long data) |
| 93 | { | 76 | { |
| 94 | struct pt_regs newregs, *regs = get_user_regs(task); | 77 | struct pt_regs newregs, *regs = task_pt_regs(task); |
| 95 | int ret = -EINVAL; | 78 | int ret = -EINVAL; |
| 96 | 79 | ||
| 97 | newregs = *regs; | 80 | newregs = *regs; |
| @@ -421,7 +404,7 @@ void ptrace_set_bpt(struct task_struct *child) | |||
| 421 | u32 insn; | 404 | u32 insn; |
| 422 | int res; | 405 | int res; |
| 423 | 406 | ||
| 424 | regs = get_user_regs(child); | 407 | regs = task_pt_regs(child); |
| 425 | pc = instruction_pointer(regs); | 408 | pc = instruction_pointer(regs); |
| 426 | 409 | ||
| 427 | if (thumb_mode(regs)) { | 410 | if (thumb_mode(regs)) { |
| @@ -572,7 +555,7 @@ static int ptrace_write_user(struct task_struct *tsk, unsigned long off, | |||
| 572 | */ | 555 | */ |
| 573 | static int ptrace_getregs(struct task_struct *tsk, void __user *uregs) | 556 | static int ptrace_getregs(struct task_struct *tsk, void __user *uregs) |
| 574 | { | 557 | { |
| 575 | struct pt_regs *regs = get_user_regs(tsk); | 558 | struct pt_regs *regs = task_pt_regs(tsk); |
| 576 | 559 | ||
| 577 | return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0; | 560 | return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0; |
| 578 | } | 561 | } |
| @@ -587,7 +570,7 @@ static int ptrace_setregs(struct task_struct *tsk, void __user *uregs) | |||
| 587 | 570 | ||
| 588 | ret = -EFAULT; | 571 | ret = -EFAULT; |
| 589 | if (copy_from_user(&newregs, uregs, sizeof(struct pt_regs)) == 0) { | 572 | if (copy_from_user(&newregs, uregs, sizeof(struct pt_regs)) == 0) { |
| 590 | struct pt_regs *regs = get_user_regs(tsk); | 573 | struct pt_regs *regs = task_pt_regs(tsk); |
| 591 | 574 | ||
| 592 | ret = -EINVAL; | 575 | ret = -EINVAL; |
| 593 | if (valid_user_regs(&newregs)) { | 576 | if (valid_user_regs(&newregs)) { |
