Complement commit ac9ad83bc318 ("MIPS: prevent FP context set via ptrace 
being discarded") and also initialize the FP context whenever FCSR alone 
is written with a PTRACE_POKEUSR request addressing FPC_CSR, rather than
along with the full FPU register set in the case of the PTRACE_SETFPREGS
request.

Signed-off-by: Maciej W. Rozycki <[email protected]>
---
Hi,

 This is tricky to verify with modern user software as these days it all 
uses PTRACE_SETFPREGS.  I suppose I could tweak and rebuild `gdbserver' to 
disable modern code and let it use fallback legacy support still present 
there, but frankly I think the change is obviously correct.

 Please apply.

  Maciej

linux-mips-ptrace-fcsr-init-fp-ctx.diff
Index: linux-sfr-test/arch/mips/kernel/ptrace.c
===================================================================
--- linux-sfr-test.orig/arch/mips/kernel/ptrace.c       2016-10-22 
01:29:44.000000000 +0100
+++ linux-sfr-test/arch/mips/kernel/ptrace.c    2016-10-22 01:44:38.740202000 
+0100
@@ -817,6 +818,7 @@ long arch_ptrace(struct task_struct *chi
                        break;
 #endif
                case FPC_CSR:
+                       init_fp_ctx(child);
                        ptrace_setfcr31(child, data);
                        break;
                case DSP_BASE ... DSP_BASE + 5: {

Reply via email to