kernel_samsung_a53x/arch/mips/kernel
Xi Ruoyao ff49d5abe8 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: 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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-18 12:13:07 +01:00
..
syscalls Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
asm-offsets.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
binfmt_elfn32.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
binfmt_elfo32.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bmips_5xxx_init.S Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bmips_vec.S Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
branch.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cacheinfo.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cevt-bcm1480.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cevt-ds1287.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cevt-gt641xx.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cevt-r4k.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cevt-sb1250.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cevt-txx9.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cmpxchg.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cps-vec-ns16550.S Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cps-vec.S Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cpu-probe.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cpu-r3k-probe.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
crash.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
crash_dump.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
csrc-bcm1480.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
csrc-ioasic.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
csrc-r4k.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
csrc-sb1250.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
early_printk.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
early_printk_8250.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
elf.c mips: Call lose_fpu(0) before initializing fcr31 in mips_set_personality_nan 2024-11-18 12:13:07 +01:00
entry.S Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fpu-probe.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fpu-probe.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ftrace.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
genex.S Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio_txx9.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
head.S Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
i8253.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
idle.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
irq-gt641xx.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
irq-msc01.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
irq-rm7000.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
irq.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
irq_txx9.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
jump_label.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
kgdb.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
kprobes.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
linux32.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
machine_kexec.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mcount.S Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mips-cm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mips-cpc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mips-mt-fpaff.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mips-mt.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mips-r2-to-r6-emul.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
module.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
octeon_switch.S Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
perf_event.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
perf_event_mipsxx.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pm-cps.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
probes-common.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
proc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
process.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
prom.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ptrace.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ptrace32.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
r4k-bugs64.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
r4k_fpu.S Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
r4k_switch.S Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
r2300_fpu.S Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
r2300_switch.S Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
relocate.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
relocate_kernel.S Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rtlx-cmp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rtlx-mt.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rtlx.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
scall32-o32.S Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
scall64-n32.S Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
scall64-n64.S Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
scall64-o32.S Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
segment.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
setup.c mips: Fix incorrect max_low_pfn adjustment 2024-11-18 12:12:48 +01:00
signal-common.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
signal.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
signal32.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
signal_n32.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
signal_o32.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smp-bmips.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smp-cmp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smp-cps.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smp-mt.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smp-up.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
spinlock_test.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
spram.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
stacktrace.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sync-r4k.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
syscall.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sysrq.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
time.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
topology.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
traps.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
unaligned.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
uprobes.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vdso.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vmlinux.lds.S Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vpe-cmp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vpe-mt.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vpe.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
watch.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00