aboutsummaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorGravatar Xi Ruoyao <xry111@xry111.site> 2024-01-27 05:05:57 +0800
committerGravatar Thomas Bogendoerfer <tsbogend@alpha.franken.de> 2024-01-27 11:08:04 +0100
commit59be5c35850171e307ca5d3d703ee9ff4096b948 (patch)
tree50496d53f2491b14cd19366b5c863bd0eb9a8de7 /samples
parentMIPS: loongson64: set nid for reserved memblock region (diff)
downloadlinux-59be5c35850171e307ca5d3d703ee9ff4096b948.tar.gz
linux-59be5c35850171e307ca5d3d703ee9ff4096b948.tar.bz2
linux-59be5c35850171e307ca5d3d703ee9ff4096b948.zip
mips: Call lose_fpu(0) before initializing fcr31 in mips_set_personality_nan
If we still own the FPU after initializing fcr31, when we are preempted the dirty value in the FPU will be read out and stored into fcr31, clobbering our setting. This can cause an improper floating-point environment after execve(). For example: zsh% cat measure.c #include <fenv.h> int main() { return fetestexcept(FE_INEXACT); } zsh% cc measure.c -o measure -lm zsh% echo $((1.0/3)) # raising FE_INEXACT 0.33333333333333331 zsh% while ./measure; do ; done (stopped in seconds) Call lose_fpu(0) before setting fcr31 to prevent this. Closes: https://lore.kernel.org/linux-mips/7a6aa1bbdbbe2e63ae96ff163fab0349f58f1b9e.camel@xry111.site/ Fixes: 9b26616c8d9d ("MIPS: Respect the ISA level in FCSR handling") Cc: stable@vger.kernel.org Signed-off-by: Xi Ruoyao <xry111@xry111.site> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Diffstat (limited to 'samples')
0 files changed, 0 insertions, 0 deletions