Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mips: Call lose_fpu(0) before initializing fcr31 in mips_set_personal…
…ity_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/[email protected]/ Fixes: 9b26616 ("MIPS: Respect the ISA level in FCSR handling") Cc: [email protected] Signed-off-by: Xi Ruoyao <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
- Loading branch information