android_kernel_oneplus_msm8998/arch/mips
Maciej W. Rozycki 1c84d14eb7 MIPS: Fix FCSR Cause bit handling for correct SIGFPE issue
[ Upstream commit 5a1aca4469fdccd5b74ba0b4e490173b2b447895 ]

Sanitize FCSR Cause bit handling, following a trail of past attempts:

* commit 4249548454f7 ("MIPS: ptrace: Fix FP context restoration FCSR
regression"),

* commit 443c44032a ("MIPS: Always clear FCSR cause bits after
emulation"),

* commit 64bedffe49 ("MIPS: Clear [MSA]FPE CSR.Cause after
notify_die()"),

* commit b1442d39fa ("MIPS: Prevent user from setting FCSR cause
bits"),

* commit b54d2901517d ("Properly handle branch delay slots in connection
with signals.").

Specifically do not mask these bits out in ptrace(2) processing and send
a SIGFPE signal instead whenever a matching pair of an FCSR Cause and
Enable bit is seen as execution of an affected context is about to
resume.  Only then clear Cause bits, and even then do not clear any bits
that are set but masked with the respective Enable bits.  Adjust Cause
bit clearing throughout code likewise, except within the FPU emulator
proper where they are set according to IEEE 754 exceptions raised as the
operation emulated executed.  Do so so that any IEEE 754 exceptions
subject to their default handling are recorded like with operations
executed by FPU hardware.

Signed-off-by: Maciej W. Rozycki <macro@imgtec.com>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/14460/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2018-11-10 07:41:36 -08:00
..
alchemy
ar7 MIPS: AR7: ensure the port type's FCR value is used 2018-01-23 19:50:18 +01:00
ath25 MIPS: ath25: Check for kzalloc allocation failure 2018-03-18 11:17:49 +01:00
ath79 MIPS: ath79: fix system restart 2018-09-26 08:35:05 +02:00
bcm47xx Revert "MIPS: BCM47XX: Enable 74K Core ExternalSync for PCIe erratum" 2018-09-05 09:18:36 +02:00
bcm63xx
bmips
boot
cavium-octeon MIPS: Octeon: add missing of_node_put() 2018-09-19 22:48:58 +02:00
cobalt
configs
dec
emma
fw
include MIPS: Fix FCSR Cause bit handling for correct SIGFPE issue 2018-11-10 07:41:36 -08:00
jazz
jz4740 MIPS: jz4740: Bump zload address 2018-09-26 08:35:06 +02:00
kernel MIPS: Fix FCSR Cause bit handling for correct SIGFPE issue 2018-11-10 07:41:36 -08:00
kvm KVM: Fix spelling mistake: "cop_unsuable" -> "cop_unusable" 2018-05-30 07:48:50 +02:00
lantiq
lasat
lib MIPS: lib: Provide MIPS64r6 __multi3() for GCC < 7 2018-09-05 09:18:40 +02:00
loongson32
loongson64 MIPS: loongson64: cs5536: Fix PCI_OHCI_INT_REG reads 2018-09-26 08:35:09 +02:00
math-emu MIPS: math-emu: Fix final emulation phase for certain instructions 2017-12-25 14:22:15 +01:00
mm MIPS: WARN_ON invalid DMA cache maintenance, not BUG_ON 2018-09-19 22:48:59 +02:00
mti-malta
mti-sead3
net MIPS: BPF: Fix multiple problems in JIT skb access helpers. 2018-03-22 09:23:25 +01:00
netlogic MIPS: Netlogic: Exclude netlogic,xlp-pic code from XLR builds 2017-11-21 09:21:22 +01:00
oprofile
paravirt
pci
pistachio
pmcs-msp71xx
pnx833x
power
ralink MIPS: ralink: Remove ralink_halt() 2018-03-28 18:40:12 +02:00
rb532
sgi-ip22
sgi-ip27
sgi-ip32
sibyte
sni
txx9 MIPS: TXx9: use IS_BUILTIN() for CONFIG_LEDS_CLASS 2018-05-30 07:48:56 +02:00
vdso
vr41xx
xilfpga
Kbuild
Kbuild.platforms
Kconfig
Kconfig.debug
Makefile