diff options
| author | Ingo Molnar <mingo@elte.hu> | 2010-10-30 04:43:08 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2010-10-30 04:43:08 -0400 |
| commit | 169ed55bd30305b933f52bfab32a58671d44ab68 (patch) | |
| tree | 32e280957474f458901abfce16fa2a1687ef7497 /kernel/ptrace.c | |
| parent | 3d7851b3cdd43a734e5cc4c643fd886ab28ad4d5 (diff) | |
| parent | 45f81b1c96d9793e47ce925d257ea693ce0b193e (diff) | |
Merge branch 'tip/perf/jump-label-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into perf/urgent
Diffstat (limited to 'kernel/ptrace.c')
| -rw-r--r-- | kernel/ptrace.c | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/kernel/ptrace.c b/kernel/ptrace.c index f34d798ef4a2..99bbaa3e5b0d 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c | |||
| @@ -181,7 +181,7 @@ int ptrace_attach(struct task_struct *task) | |||
| 181 | * under ptrace. | 181 | * under ptrace. |
| 182 | */ | 182 | */ |
| 183 | retval = -ERESTARTNOINTR; | 183 | retval = -ERESTARTNOINTR; |
| 184 | if (mutex_lock_interruptible(&task->cred_guard_mutex)) | 184 | if (mutex_lock_interruptible(&task->signal->cred_guard_mutex)) |
| 185 | goto out; | 185 | goto out; |
| 186 | 186 | ||
| 187 | task_lock(task); | 187 | task_lock(task); |
| @@ -208,7 +208,7 @@ int ptrace_attach(struct task_struct *task) | |||
| 208 | unlock_tasklist: | 208 | unlock_tasklist: |
| 209 | write_unlock_irq(&tasklist_lock); | 209 | write_unlock_irq(&tasklist_lock); |
| 210 | unlock_creds: | 210 | unlock_creds: |
| 211 | mutex_unlock(&task->cred_guard_mutex); | 211 | mutex_unlock(&task->signal->cred_guard_mutex); |
| 212 | out: | 212 | out: |
| 213 | return retval; | 213 | return retval; |
| 214 | } | 214 | } |
| @@ -329,6 +329,8 @@ int ptrace_detach(struct task_struct *child, unsigned int data) | |||
| 329 | * and reacquire the lock. | 329 | * and reacquire the lock. |
| 330 | */ | 330 | */ |
| 331 | void exit_ptrace(struct task_struct *tracer) | 331 | void exit_ptrace(struct task_struct *tracer) |
| 332 | __releases(&tasklist_lock) | ||
| 333 | __acquires(&tasklist_lock) | ||
| 332 | { | 334 | { |
| 333 | struct task_struct *p, *n; | 335 | struct task_struct *p, *n; |
| 334 | LIST_HEAD(ptrace_dead); | 336 | LIST_HEAD(ptrace_dead); |
| @@ -402,7 +404,7 @@ int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long ds | |||
| 402 | return copied; | 404 | return copied; |
| 403 | } | 405 | } |
| 404 | 406 | ||
| 405 | static int ptrace_setoptions(struct task_struct *child, long data) | 407 | static int ptrace_setoptions(struct task_struct *child, unsigned long data) |
| 406 | { | 408 | { |
| 407 | child->ptrace &= ~PT_TRACE_MASK; | 409 | child->ptrace &= ~PT_TRACE_MASK; |
| 408 | 410 | ||
| @@ -481,7 +483,8 @@ static int ptrace_setsiginfo(struct task_struct *child, const siginfo_t *info) | |||
| 481 | #define is_sysemu_singlestep(request) 0 | 483 | #define is_sysemu_singlestep(request) 0 |
| 482 | #endif | 484 | #endif |
| 483 | 485 | ||
| 484 | static int ptrace_resume(struct task_struct *child, long request, long data) | 486 | static int ptrace_resume(struct task_struct *child, long request, |
| 487 | unsigned long data) | ||
| 485 | { | 488 | { |
| 486 | if (!valid_signal(data)) | 489 | if (!valid_signal(data)) |
| 487 | return -EIO; | 490 | return -EIO; |
| @@ -558,10 +561,12 @@ static int ptrace_regset(struct task_struct *task, int req, unsigned int type, | |||
| 558 | #endif | 561 | #endif |
| 559 | 562 | ||
| 560 | int ptrace_request(struct task_struct *child, long request, | 563 | int ptrace_request(struct task_struct *child, long request, |
| 561 | long addr, long data) | 564 | unsigned long addr, unsigned long data) |
| 562 | { | 565 | { |
| 563 | int ret = -EIO; | 566 | int ret = -EIO; |
| 564 | siginfo_t siginfo; | 567 | siginfo_t siginfo; |
| 568 | void __user *datavp = (void __user *) data; | ||
| 569 | unsigned long __user *datalp = datavp; | ||
| 565 | 570 | ||
| 566 | switch (request) { | 571 | switch (request) { |
| 567 | case PTRACE_PEEKTEXT: | 572 | case PTRACE_PEEKTEXT: |
| @@ -578,19 +583,17 @@ int ptrace_request(struct task_struct *child, long request, | |||
| 578 | ret = ptrace_setoptions(child, data); | 583 | ret = ptrace_setoptions(child, data); |
| 579 | break; | 584 | break; |
| 580 | case PTRACE_GETEVENTMSG: | 585 | case PTRACE_GETEVENTMSG: |
| 581 | ret = put_user(child->ptrace_message, (unsigned long __user *) data); | 586 | ret = put_user(child->ptrace_message, datalp); |
| 582 | break; | 587 | break; |
| 583 | 588 | ||
| 584 | case PTRACE_GETSIGINFO: | 589 | case PTRACE_GETSIGINFO: |
| 585 | ret = ptrace_getsiginfo(child, &siginfo); | 590 | ret = ptrace_getsiginfo(child, &siginfo); |
| 586 | if (!ret) | 591 | if (!ret) |
| 587 | ret = copy_siginfo_to_user((siginfo_t __user *) data, | 592 | ret = copy_siginfo_to_user(datavp, &siginfo); |
| 588 | &siginfo); | ||
| 589 | break; | 593 | break; |
| 590 | 594 | ||
| 591 | case PTRACE_SETSIGINFO: | 595 | case PTRACE_SETSIGINFO: |
| 592 | if (copy_from_user(&siginfo, (siginfo_t __user *) data, | 596 | if (copy_from_user(&siginfo, datavp, sizeof siginfo)) |
| 593 | sizeof siginfo)) | ||
| 594 | ret = -EFAULT; | 597 | ret = -EFAULT; |
| 595 | else | 598 | else |
| 596 | ret = ptrace_setsiginfo(child, &siginfo); | 599 | ret = ptrace_setsiginfo(child, &siginfo); |
| @@ -621,7 +624,7 @@ int ptrace_request(struct task_struct *child, long request, | |||
| 621 | } | 624 | } |
| 622 | mmput(mm); | 625 | mmput(mm); |
| 623 | 626 | ||
| 624 | ret = put_user(tmp, (unsigned long __user *) data); | 627 | ret = put_user(tmp, datalp); |
| 625 | break; | 628 | break; |
| 626 | } | 629 | } |
| 627 | #endif | 630 | #endif |
| @@ -650,7 +653,7 @@ int ptrace_request(struct task_struct *child, long request, | |||
| 650 | case PTRACE_SETREGSET: | 653 | case PTRACE_SETREGSET: |
| 651 | { | 654 | { |
| 652 | struct iovec kiov; | 655 | struct iovec kiov; |
| 653 | struct iovec __user *uiov = (struct iovec __user *) data; | 656 | struct iovec __user *uiov = datavp; |
| 654 | 657 | ||
| 655 | if (!access_ok(VERIFY_WRITE, uiov, sizeof(*uiov))) | 658 | if (!access_ok(VERIFY_WRITE, uiov, sizeof(*uiov))) |
| 656 | return -EFAULT; | 659 | return -EFAULT; |
| @@ -691,7 +694,8 @@ static struct task_struct *ptrace_get_task_struct(pid_t pid) | |||
| 691 | #define arch_ptrace_attach(child) do { } while (0) | 694 | #define arch_ptrace_attach(child) do { } while (0) |
| 692 | #endif | 695 | #endif |
| 693 | 696 | ||
| 694 | SYSCALL_DEFINE4(ptrace, long, request, long, pid, long, addr, long, data) | 697 | SYSCALL_DEFINE4(ptrace, long, request, long, pid, unsigned long, addr, |
| 698 | unsigned long, data) | ||
| 695 | { | 699 | { |
| 696 | struct task_struct *child; | 700 | struct task_struct *child; |
| 697 | long ret; | 701 | long ret; |
| @@ -732,7 +736,8 @@ SYSCALL_DEFINE4(ptrace, long, request, long, pid, long, addr, long, data) | |||
| 732 | return ret; | 736 | return ret; |
| 733 | } | 737 | } |
| 734 | 738 | ||
| 735 | int generic_ptrace_peekdata(struct task_struct *tsk, long addr, long data) | 739 | int generic_ptrace_peekdata(struct task_struct *tsk, unsigned long addr, |
| 740 | unsigned long data) | ||
| 736 | { | 741 | { |
| 737 | unsigned long tmp; | 742 | unsigned long tmp; |
| 738 | int copied; | 743 | int copied; |
| @@ -743,7 +748,8 @@ int generic_ptrace_peekdata(struct task_struct *tsk, long addr, long data) | |||
| 743 | return put_user(tmp, (unsigned long __user *)data); | 748 | return put_user(tmp, (unsigned long __user *)data); |
| 744 | } | 749 | } |
| 745 | 750 | ||
| 746 | int generic_ptrace_pokedata(struct task_struct *tsk, long addr, long data) | 751 | int generic_ptrace_pokedata(struct task_struct *tsk, unsigned long addr, |
| 752 | unsigned long data) | ||
| 747 | { | 753 | { |
| 748 | int copied; | 754 | int copied; |
| 749 | 755 | ||
