diff options
| -rw-r--r-- | arch/powerpc/kernel/ppc32.h | 2 | ||||
| -rw-r--r-- | arch/powerpc/kernel/ptrace32.c | 27 |
2 files changed, 29 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/ppc32.h b/arch/powerpc/kernel/ppc32.h index 90e562771791..fda05e2211d6 100644 --- a/arch/powerpc/kernel/ppc32.h +++ b/arch/powerpc/kernel/ppc32.h | |||
| @@ -135,4 +135,6 @@ struct ucontext32 { | |||
| 135 | struct mcontext32 uc_mcontext; | 135 | struct mcontext32 uc_mcontext; |
| 136 | }; | 136 | }; |
| 137 | 137 | ||
| 138 | extern int copy_siginfo_to_user32(struct compat_siginfo __user *d, siginfo_t *s); | ||
| 139 | |||
| 138 | #endif /* _PPC64_PPC32_H */ | 140 | #endif /* _PPC64_PPC32_H */ |
diff --git a/arch/powerpc/kernel/ptrace32.c b/arch/powerpc/kernel/ptrace32.c index 4c1de6af4c09..9d30e10970ac 100644 --- a/arch/powerpc/kernel/ptrace32.c +++ b/arch/powerpc/kernel/ptrace32.c | |||
| @@ -29,12 +29,15 @@ | |||
| 29 | #include <linux/security.h> | 29 | #include <linux/security.h> |
| 30 | #include <linux/signal.h> | 30 | #include <linux/signal.h> |
| 31 | #include <linux/compat.h> | 31 | #include <linux/compat.h> |
| 32 | #include <linux/elf.h> | ||
| 32 | 33 | ||
| 33 | #include <asm/uaccess.h> | 34 | #include <asm/uaccess.h> |
| 34 | #include <asm/page.h> | 35 | #include <asm/page.h> |
| 35 | #include <asm/pgtable.h> | 36 | #include <asm/pgtable.h> |
| 36 | #include <asm/system.h> | 37 | #include <asm/system.h> |
| 37 | 38 | ||
| 39 | #include "ppc32.h" | ||
| 40 | |||
| 38 | /* | 41 | /* |
| 39 | * does not yet catch signals sent when the child dies. | 42 | * does not yet catch signals sent when the child dies. |
| 40 | * in exit.c or in signal.c. | 43 | * in exit.c or in signal.c. |
| @@ -64,6 +67,27 @@ static long compat_ptrace_old(struct task_struct *child, long request, | |||
| 64 | return -EPERM; | 67 | return -EPERM; |
| 65 | } | 68 | } |
| 66 | 69 | ||
| 70 | static int compat_ptrace_getsiginfo(struct task_struct *child, compat_siginfo_t __user *data) | ||
| 71 | { | ||
| 72 | siginfo_t lastinfo; | ||
| 73 | int error = -ESRCH; | ||
| 74 | |||
| 75 | read_lock(&tasklist_lock); | ||
| 76 | if (likely(child->sighand != NULL)) { | ||
| 77 | error = -EINVAL; | ||
| 78 | spin_lock_irq(&child->sighand->siglock); | ||
| 79 | if (likely(child->last_siginfo != NULL)) { | ||
| 80 | lastinfo = *child->last_siginfo; | ||
| 81 | error = 0; | ||
| 82 | } | ||
| 83 | spin_unlock_irq(&child->sighand->siglock); | ||
| 84 | } | ||
| 85 | read_unlock(&tasklist_lock); | ||
| 86 | if (!error) | ||
| 87 | return copy_siginfo_to_user32(data, &lastinfo); | ||
| 88 | return error; | ||
| 89 | } | ||
| 90 | |||
| 67 | long compat_arch_ptrace(struct task_struct *child, compat_long_t request, | 91 | long compat_arch_ptrace(struct task_struct *child, compat_long_t request, |
| 68 | compat_ulong_t caddr, compat_ulong_t cdata) | 92 | compat_ulong_t caddr, compat_ulong_t cdata) |
| 69 | { | 93 | { |
| @@ -282,6 +306,9 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request, | |||
| 282 | 0, PT_REGS_COUNT * sizeof(compat_long_t), | 306 | 0, PT_REGS_COUNT * sizeof(compat_long_t), |
| 283 | compat_ptr(data)); | 307 | compat_ptr(data)); |
| 284 | 308 | ||
| 309 | case PTRACE_GETSIGINFO: | ||
| 310 | return compat_ptrace_getsiginfo(child, compat_ptr(data)); | ||
| 311 | |||
| 285 | case PTRACE_GETFPREGS: | 312 | case PTRACE_GETFPREGS: |
| 286 | case PTRACE_SETFPREGS: | 313 | case PTRACE_SETFPREGS: |
| 287 | case PTRACE_GETVRREGS: | 314 | case PTRACE_GETVRREGS: |
