mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	MIPS: ptrace: Fix FP context restoration FCSR regression
Fix a floating-point context restoration regression introduced with commit9b26616c8d("MIPS: Respect the ISA level in FCSR handling") that causes a Floating Point exception and consequently a kernel oops with hard float configurations when one or more FCSR Enable and their corresponding Cause bits are set both at a time via a ptrace(2) call. To do so reinstate Cause bit masking originally introduced with commitb1442d39fa("MIPS: Prevent user from setting FCSR cause bits") to address this exact problem and then inadvertently removed from the PTRACE_SETFPREGS request with the commit referred above. Signed-off-by: Maciej W. Rozycki <macro@imgtec.com> Cc: stable@vger.kernel.org # v4.0+ Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/13238/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
		
							parent
							
								
									9125f19bbb
								
							
						
					
					
						commit
						4249548454
					
				
					 1 changed files with 1 additions and 0 deletions
				
			
		| 
						 | 
					@ -176,6 +176,7 @@ int ptrace_setfpregs(struct task_struct *child, __u32 __user *data)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	__get_user(value, data + 64);
 | 
						__get_user(value, data + 64);
 | 
				
			||||||
 | 
						value &= ~FPU_CSR_ALL_X;
 | 
				
			||||||
	fcr31 = child->thread.fpu.fcr31;
 | 
						fcr31 = child->thread.fpu.fcr31;
 | 
				
			||||||
	mask = boot_cpu_data.fpu_msk31;
 | 
						mask = boot_cpu_data.fpu_msk31;
 | 
				
			||||||
	child->thread.fpu.fcr31 = (value & ~mask) | (fcr31 & mask);
 | 
						child->thread.fpu.fcr31 = (value & ~mask) | (fcr31 & mask);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue