From 8378cc8fa2c4d2ac562bcb94648673f87aa22cb4 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Sun, 20 Apr 2008 02:25:13 +1000 Subject: [PATCH] --- yaml --- r: 91623 b: refs/heads/master c: e4cc58944c1e2ce41e3079d4eb60c95e7ce04b2b h: refs/heads/master i: 91621: 8f89ebba3146a4f9362d0377c590ffc6b6e93dc2 91619: 9c429860fbe7e20da70941aa000a00e541f45e18 91615: f6c89eba5582a43e4630f78f6b9678b15a600b48 v: v3 --- [refs] | 2 +- trunk/arch/powerpc/kernel/ppc32.h | 2 ++ trunk/arch/powerpc/kernel/ptrace32.c | 27 +++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 899f2174d368..e3d12ff07952 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 585468e5d5962660867c269e26f0a4b89a599473 +refs/heads/master: e4cc58944c1e2ce41e3079d4eb60c95e7ce04b2b diff --git a/trunk/arch/powerpc/kernel/ppc32.h b/trunk/arch/powerpc/kernel/ppc32.h index 90e562771791..fda05e2211d6 100644 --- a/trunk/arch/powerpc/kernel/ppc32.h +++ b/trunk/arch/powerpc/kernel/ppc32.h @@ -135,4 +135,6 @@ struct ucontext32 { struct mcontext32 uc_mcontext; }; +extern int copy_siginfo_to_user32(struct compat_siginfo __user *d, siginfo_t *s); + #endif /* _PPC64_PPC32_H */ diff --git a/trunk/arch/powerpc/kernel/ptrace32.c b/trunk/arch/powerpc/kernel/ptrace32.c index 4c1de6af4c09..9d30e10970ac 100644 --- a/trunk/arch/powerpc/kernel/ptrace32.c +++ b/trunk/arch/powerpc/kernel/ptrace32.c @@ -29,12 +29,15 @@ #include #include #include +#include #include #include #include #include +#include "ppc32.h" + /* * does not yet catch signals sent when the child dies. * in exit.c or in signal.c. @@ -64,6 +67,27 @@ static long compat_ptrace_old(struct task_struct *child, long request, return -EPERM; } +static int compat_ptrace_getsiginfo(struct task_struct *child, compat_siginfo_t __user *data) +{ + siginfo_t lastinfo; + int error = -ESRCH; + + read_lock(&tasklist_lock); + if (likely(child->sighand != NULL)) { + error = -EINVAL; + spin_lock_irq(&child->sighand->siglock); + if (likely(child->last_siginfo != NULL)) { + lastinfo = *child->last_siginfo; + error = 0; + } + spin_unlock_irq(&child->sighand->siglock); + } + read_unlock(&tasklist_lock); + if (!error) + return copy_siginfo_to_user32(data, &lastinfo); + return error; +} + long compat_arch_ptrace(struct task_struct *child, compat_long_t request, compat_ulong_t caddr, compat_ulong_t cdata) { @@ -282,6 +306,9 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request, 0, PT_REGS_COUNT * sizeof(compat_long_t), compat_ptr(data)); + case PTRACE_GETSIGINFO: + return compat_ptrace_getsiginfo(child, compat_ptr(data)); + case PTRACE_GETFPREGS: case PTRACE_SETFPREGS: case PTRACE_GETVRREGS: