aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/ptrace32.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2005-10-06 12:39:32 -0400
committerRalf Baechle <ralf@linux-mips.org>2005-10-29 14:32:36 -0400
commit101b3531a693ad890f33f2f04323592cd376616a (patch)
treeadb9410d492ee3dca0fd437191213a28e02edcf4 /arch/mips/kernel/ptrace32.c
parent8afcb5d82934c83fb01664ae00eaff9de1d8d340 (diff)
Protect manipulation of c0_status against preemption and multithreading.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/ptrace32.c')
-rw-r--r--arch/mips/kernel/ptrace32.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/arch/mips/kernel/ptrace32.c b/arch/mips/kernel/ptrace32.c
index c28cdddd4c21..9a9b04972132 100644
--- a/arch/mips/kernel/ptrace32.c
+++ b/arch/mips/kernel/ptrace32.c
@@ -29,6 +29,7 @@
29#include <asm/dsp.h> 29#include <asm/dsp.h>
30#include <asm/fpu.h> 30#include <asm/fpu.h>
31#include <asm/mipsregs.h> 31#include <asm/mipsregs.h>
32#include <asm/mipsmtregs.h>
32#include <asm/pgtable.h> 33#include <asm/pgtable.h>
33#include <asm/page.h> 34#include <asm/page.h>
34#include <asm/system.h> 35#include <asm/system.h>
@@ -191,10 +192,21 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
191 if (!cpu_has_fpu) 192 if (!cpu_has_fpu)
192 break; 193 break;
193 194
194 flags = read_c0_status(); 195 preempt_disable();
195 __enable_fpu(); 196 if (cpu_has_mipsmt) {
196 __asm__ __volatile__("cfc1\t%0,$0": "=r" (tmp)); 197 unsigned int vpflags = dvpe();
197 write_c0_status(flags); 198 flags = read_c0_status();
199 __enable_fpu();
200 __asm__ __volatile__("cfc1\t%0,$0": "=r" (tmp));
201 write_c0_status(flags);
202 evpe(vpflags);
203 } else {
204 flags = read_c0_status();
205 __enable_fpu();
206 __asm__ __volatile__("cfc1\t%0,$0": "=r" (tmp));
207 write_c0_status(flags);
208 }
209 preempt_enable();
198 break; 210 break;
199 } 211 }
200 case DSP_BASE ... DSP_BASE + 5: 212 case DSP_BASE ... DSP_BASE + 5: