diff options
author | Roland McGrath <roland@redhat.com> | 2008-03-13 04:25:35 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-03-19 19:10:56 -0400 |
commit | c2372eb9bcafdd149b26987a8c25bbed92fd2775 (patch) | |
tree | 8e32ac8e467593c333cfed402fdb766cba80308a /arch/powerpc | |
parent | 264e3e889d86e552b4191d69bb60f4f3b383135a (diff) |
[POWERPC] user_regset PTRACE_SETREGS regression fix
The PTRACE_SETREGS request was only recently added on powerpc,
and gdb does not use it. So it slipped through without getting
all the testing it should have had.
The user_regset changes had a simple bug in storing to all of
the 32-bit general registers block on 64-bit kernels. This bug
only comes up with PTRACE_SETREGS, not PPC_PTRACE_SETREGS.
It causes a BUG_ON to hit, so this fix needs to go in ASAP.
Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/kernel/ptrace.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c index 7673e9865733..2a9fe97e4521 100644 --- a/arch/powerpc/kernel/ptrace.c +++ b/arch/powerpc/kernel/ptrace.c | |||
@@ -530,15 +530,21 @@ static int gpr32_set(struct task_struct *target, | |||
530 | --count; | 530 | --count; |
531 | } | 531 | } |
532 | 532 | ||
533 | if (kbuf) | 533 | if (kbuf) { |
534 | for (; count > 0 && pos <= PT_MAX_PUT_REG; --count) | 534 | for (; count > 0 && pos <= PT_MAX_PUT_REG; --count) |
535 | regs[pos++] = *k++; | 535 | regs[pos++] = *k++; |
536 | else | 536 | for (; count > 0 && pos < PT_TRAP; --count, ++pos) |
537 | ++k; | ||
538 | } else { | ||
537 | for (; count > 0 && pos <= PT_MAX_PUT_REG; --count) { | 539 | for (; count > 0 && pos <= PT_MAX_PUT_REG; --count) { |
538 | if (__get_user(reg, u++)) | 540 | if (__get_user(reg, u++)) |
539 | return -EFAULT; | 541 | return -EFAULT; |
540 | regs[pos++] = reg; | 542 | regs[pos++] = reg; |
541 | } | 543 | } |
544 | for (; count > 0 && pos < PT_TRAP; --count, ++pos) | ||
545 | if (__get_user(reg, u++)) | ||
546 | return -EFAULT; | ||
547 | } | ||
542 | 548 | ||
543 | if (count > 0 && pos == PT_TRAP) { | 549 | if (count > 0 && pos == PT_TRAP) { |
544 | if (kbuf) | 550 | if (kbuf) |