android_kernel_xiaomi_sm8450/arch
Xi Ruoyao 3736a7832b mips: Call lose_fpu(0) before initializing fcr31 in mips_set_personality_nan
commit 59be5c35850171e307ca5d3d703ee9ff4096b948 upstream.

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: 9b26616c8d ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-23 08:42:01 +01:00
..
alpha alpha: remove __init annotation from exported page_is_ram() 2023-08-16 18:21:03 +02:00
arc ARC: fix spare error 2024-01-25 14:37:38 -08:00
arm ARM: dts: samsung: exynos4210-i9100: Unconditionally enable LDO12 2024-02-23 08:42:00 +01:00
arm64 arm64: dts: qcom: sc7180: fix USB wakeup interrupt types 2024-02-23 08:42:00 +01:00
c6x c6x: add support for TIF_NOTIFY_SIGNAL 2023-01-04 11:39:21 +01:00
csky csky: Fix function name in csky_alignment() and die() 2023-02-01 08:23:20 +01:00
h8300 h8300: Fix build errors from do_exit() to make_task_dead() transition 2023-02-01 08:23:19 +01:00
hexagon hexagon: Fix function name in die() 2023-02-01 08:23:19 +01:00
ia64 ia64/cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:57:36 +02:00
m68k m68k: Fix invalid .section syntax 2023-09-19 12:20:04 +02:00
microblaze exit: Add and use make_task_dead. 2023-02-01 08:23:19 +01:00
mips mips: Call lose_fpu(0) before initializing fcr31 in mips_set_personality_nan 2024-02-23 08:42:01 +01:00
nds32 exit: Add and use make_task_dead. 2023-02-01 08:23:19 +01:00
nios2 nios2: dts: Fix tse_mac "max-frame-size" property 2023-06-21 15:45:37 +02:00
openrisc openrisc: Properly store r31 to pt_regs on unhandled exceptions 2023-05-17 11:48:03 +02:00
parisc parisc/firmware: Fix F-extend for PDC addresses 2024-02-23 08:41:53 +01:00
powerpc KVM: use __vcalloc for very large allocations 2024-02-23 08:41:55 +01:00
riscv riscv: fix misaligned access handling of C.SWSP and C.SDSP 2023-12-13 18:27:02 +01:00
s390 crypto: s390/aes - Fix buffer overread in CTR mode 2024-02-23 08:41:53 +01:00
sh sh: bios: Revive earlyprintk support 2023-11-20 11:06:51 +01:00
sparc sparc32: fix a braino in fault handling in csum_and_copy_..._user() 2023-11-08 17:30:45 +01:00
um um: Fix hostaudio build errors 2023-09-19 12:20:20 +02:00
x86 KVM: use __vcalloc for very large allocations 2024-02-23 08:41:55 +01:00
xtensa xtensa: boot/lib: fix function prototypes 2023-10-10 21:53:31 +02:00
.gitignore
Kconfig init: Provide arch_cpu_finalize_init() 2023-08-08 19:57:36 +02:00