MIPS: ptrace: Fix PTRACE_PEEKUSR requests for 64-bit FGRs
authorMaciej W. Rozycki <macro@mips.com>
Wed, 16 May 2018 15:39:58 +0000 (16:39 +0100)
committerJames Hogan <jhogan@kernel.org>
Thu, 24 May 2018 13:03:14 +0000 (14:03 +0100)
Use 64-bit accesses for 64-bit floating-point general registers with
PTRACE_PEEKUSR, removing the truncation of their upper halves in the
FR=1 mode, caused by commit bbd426f542cb ("MIPS: Simplify FP context
access"), which inadvertently switched them to using 32-bit accesses.

The PTRACE_POKEUSR side is fine as it's never been broken and continues
using 64-bit accesses.

Fixes: bbd426f542cb ("MIPS: Simplify FP context access")
Signed-off-by: Maciej W. Rozycki <macro@mips.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Cc: <stable@vger.kernel.org> # 3.15+
Patchwork: https://patchwork.linux-mips.org/patch/19334/
Signed-off-by: James Hogan <jhogan@kernel.org>
arch/mips/kernel/ptrace.c
arch/mips/kernel/ptrace32.c

index 8d098b9f395c13746a4f0855f54a6303bfc21098..0c0c23c9c9f5a7d9b00fbf71c78df697ecbb7612 100644 (file)
@@ -818,7 +818,7 @@ long arch_ptrace(struct task_struct *child, long request,
                                break;
                        }
 #endif
-                       tmp = get_fpr32(&fregs[addr - FPR_BASE], 0);
+                       tmp = get_fpr64(&fregs[addr - FPR_BASE], 0);
                        break;
                case PC:
                        tmp = regs->cp0_epc;
index 656a137c1fe2c4dcaa9fb410d5787c9e9b39ce1f..f30c381d3e1cedf80ec5f25447fcf0c61248f25b 100644 (file)
@@ -109,7 +109,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
                                                addr & 1);
                                break;
                        }
-                       tmp = get_fpr32(&fregs[addr - FPR_BASE], 0);
+                       tmp = get_fpr64(&fregs[addr - FPR_BASE], 0);
                        break;
                case PC:
                        tmp = regs->cp0_epc;