tmp_suning_uos_patched/arch/sparc/kernel
Rob Gardner f2b38f03a3 sparc64: Fix opcode filtering in handling of no fault loads
[ Upstream commit e5e8b80d352ec999d2bba3ea584f541c83f4ca3f ]

is_no_fault_exception() has two bugs which were discovered via random
opcode testing with stress-ng. Both are caused by improper filtering
of opcodes.

The first bug can be triggered by a floating point store with a no-fault
ASI, for instance "sta %f0, [%g0] #ASI_PNF", opcode C1A01040.

The code first tests op3[5] (0x1000000), which denotes a floating
point instruction, and then tests op3[2] (0x200000), which denotes a
store instruction. But these bits are not mutually exclusive, and the
above mentioned opcode has both bits set. The intent is to filter out
stores, so the test for stores must be done first in order to have
any effect.

The second bug can be triggered by a floating point load with one of
the invalid ASI values 0x8e or 0x8f, which pass this check in
is_no_fault_exception():
     if ((asi & 0xf2) == ASI_PNF)

An example instruction is "ldqa [%l7 + %o7] #ASI 0x8f, %f38",
opcode CF95D1EF. Asi values greater than 0x8b (ASI_SNFL) are fatal
in handle_ldf_stq(), and is_no_fault_exception() must not allow these
invalid asi values to make it that far.

In both of these cases, handle_ldf_stq() reacts by calling
sun4v_data_access_exception() or spitfire_data_access_exception(),
which call is_no_fault_exception() and results in an infinite
recursion.

Signed-off-by: Rob Gardner <rob.gardner@oracle.com>
Tested-by: Anatoly Pugachev <matorola@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-03-30 14:31:50 +02:00
..
syscalls mm/madvise: introduce process_madvise() syscall: an external memory hinting API 2020-10-18 09:27:10 -07:00
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
adi_64.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 482 2019-06-19 17:09:52 +02:00
apc.c
asm-offsets.c
audit.c
auxio_32.c
auxio_64.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
btext.c treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
central.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
cherrs.S
chmc.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
compat_audit.c
cpu.c mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
cpumap.c sparc64: Replace zero-length array with flexible-array 2020-05-07 18:49:04 -07:00
cpumap.h
devices.c
ds.c sparc64: Replace zero-length array with flexible-array 2020-05-07 18:49:04 -07:00
dtlb_miss.S
dtlb_prot.S
ebus.c
entry.h sparc64: Add support for ADI register fields, ASIs and traps 2018-03-18 07:38:45 -07:00
entry.S sparc: share process creation helpers between sparc and sparc64 2020-06-23 10:49:56 +02:00
etrap_32.S
etrap_64.S sparc64: Add support for ADI (Application Data Integrity) 2018-03-18 07:38:48 -07:00
fpu_traps.S
ftrace.c sparc/function_graph: Simplify with function_graph_enter() 2018-11-27 20:31:46 -05:00
getsetcc.S
head_32.S sparc32: mm: Restructure sparc32 MMU page-table layout 2020-05-13 15:32:00 -07:00
head_64.S mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
helpers.S treewide: Add SPDX license identifier for missed files 2019-05-21 10:50:45 +02:00
hvapi.c sparc64: Oracle DAX infrastructure 2018-01-22 08:17:15 -08:00
hvcalls.S sparc64: Oracle DAX infrastructure 2018-01-22 08:17:15 -08:00
hvtramp.S
idprom.c
iommu_common.h sparc: remove the mapping_error dma_map_ops method 2018-12-06 06:56:40 -08:00
iommu-common.c dma-mapping: introduce dma_get_seg_boundary_nr_pages() 2020-09-03 18:12:15 +02:00
iommu.c dma-mapping: split <linux/dma-mapping.h> 2020-10-06 07:07:03 +02:00
ioport.c dma-mapping: merge <linux/dma-noncoherent.h> into <linux/dma-map-ops.h> 2020-10-06 07:07:06 +02:00
irq_32.c
irq_64.c sparc: Use of_node_name_eq for node name comparisons 2018-11-18 13:35:21 -08:00
irq.h
itlb_miss.S
ivec.S
jump_label.c jump_label: move 'asm goto' support test to Kconfig 2019-01-06 09:46:51 +09:00
kernel.h sparc: share process creation helpers between sparc and sparc64 2020-06-23 10:49:56 +02:00
kgdb_32.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
kgdb_64.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
kprobes.c sparc: kprobes: Use generic kretprobe trampoline handler 2020-09-08 11:52:35 +02:00
kstack.h
ktlb.S mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
ldc.c iommu-common: move to arch/sparc 2018-05-09 06:54:27 +02:00
led.c sparc: fix led.c driver when PROC_FS is not enabled 2021-03-04 11:38:10 +01:00
leon_kernel.c sparc: Remove unused leon_trans_init 2018-11-18 13:35:22 -08:00
leon_pci_grpci1.c
leon_pci_grpci2.c
leon_pci.c sparc/PCI: Use dev_printk() when possible 2018-05-22 07:54:06 -05:00
leon_pmc.c sched/idle: Fix arch_cpu_idle() vs tracing 2020-11-24 16:47:35 +01:00
leon_smp.c mm: remove unneeded includes of <asm/pgalloc.h> 2020-08-07 11:33:26 -07:00
Makefile sparc: share process creation helpers between sparc and sparc64 2020-06-23 10:49:56 +02:00
mdesc.c mdesc: fix a missing-check bug in get_vdev_port_node_info() 2019-06-02 22:15:35 -07:00
misctrap.S
module.c
nmi.c treewide: Add SPDX license identifier for missed files 2019-05-21 10:50:45 +02:00
of_device_32.c sparc: Use DT node full_name instead of name for resources 2018-11-18 13:35:22 -08:00
of_device_64.c sparc: Use DT node full_name instead of name for resources 2018-11-18 13:35:22 -08:00
of_device_common.c sparc32: use per-device dma_ops 2020-04-02 18:11:55 -07:00
of_device_common.h
pci_common.c sparc/PCI: Use dev_printk() when possible 2018-05-22 07:54:06 -05:00
pci_fire.c mm: replace all open encodings for NUMA_NO_NODE 2019-03-05 21:07:14 -08:00
pci_impl.h sparc/PCI: Support arbitrary host bridge address offset 2018-02-15 15:07:30 -06:00
pci_msi.c sparc/PCI: Use dev_printk() when possible 2018-05-22 07:54:06 -05:00
pci_psycho.c
pci_sabre.c sparc: Use of_node_name_eq for node name comparisons 2018-11-18 13:35:21 -08:00
pci_schizo.c mm: replace all open encodings for NUMA_NO_NODE 2019-03-05 21:07:14 -08:00
pci_sun4v_asm.S
pci_sun4v.c dma-mapping: split <linux/dma-mapping.h> 2020-10-06 07:07:03 +02:00
pci_sun4v.h
pci.c mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
pcic.c sparc/PCI: Use dev_printk() when possible 2018-05-22 07:54:06 -05:00
pcr.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
perf_event.c sparc: perf: fix updated event period in response to PERF_EVENT_IOC_PERIOD 2019-06-02 22:16:33 -07:00
pmc.c
power.c sparc: Convert to using %pOFn instead of device_node.name 2018-11-18 13:35:20 -08:00
process_32.c sched/idle: Fix arch_cpu_idle() vs tracing 2020-11-24 16:47:35 +01:00
process_64.c sched/idle: Fix arch_cpu_idle() vs tracing 2020-11-24 16:47:35 +01:00
process.c sparc: switch to kernel_clone() 2020-08-20 13:12:58 +02:00
prom_32.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
prom_64.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
prom_common.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
prom_irqtrans.c sparc: Use device_type helpers to access the node type 2018-11-18 13:35:21 -08:00
prom.h
psycho_common.c mm: replace all open encodings for NUMA_NO_NODE 2019-03-05 21:07:14 -08:00
psycho_common.h
ptrace_32.c sparc: switch to ->regset_get() 2020-07-27 14:31:08 -04:00
ptrace_64.c sparc: switch to ->regset_get() 2020-07-27 14:31:08 -04:00
reboot.c sparc: Use device_type helpers to access the node type 2018-11-18 13:35:21 -08:00
rtrap_32.S
rtrap_64.S sched/rt, sparc: Use CONFIG_PREEMPTION 2019-12-08 14:37:35 +01:00
sbus.c mm: replace all open encodings for NUMA_NO_NODE 2019-03-05 21:07:14 -08:00
setup_32.c initrd: remove support for multiple floppies 2020-07-30 08:22:33 +02:00
setup_64.c initrd: remove support for multiple floppies 2020-07-30 08:22:33 +02:00
signal_32.c tracehook: clear TIF_NOTIFY_RESUME in tracehook_notify_resume() 2020-10-17 15:04:36 -06:00
signal_64.c tracehook: clear TIF_NOTIFY_RESUME in tracehook_notify_resume() 2020-10-17 15:04:36 -06:00
signal32.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
sigutil_32.c Remove 'type' argument from access_ok() function 2019-01-03 18:57:57 -08:00
sigutil_64.c
sigutil.h
smp_32.c mm: remove unneeded includes of <asm/pgalloc.h> 2020-08-07 11:33:26 -07:00
smp_64.c sparc64: remove mm_cpumask clearing to fix kthread_use_mm race 2020-09-16 12:24:37 +10:00
sparc_ksyms.c
spiterrs.S
sstate.c
stacktrace.c treewide: Add SPDX license identifier for missed files 2019-05-21 10:50:45 +02:00
starfire.c
sun4d_irq.c sparc: Use of_node_name_eq for node name comparisons 2018-11-18 13:35:21 -08:00
sun4d_smp.c
sun4m_irq.c mm: remove unneeded includes of <asm/pgalloc.h> 2020-08-07 11:33:26 -07:00
sun4m_smp.c
sun4v_ivec.S
sun4v_mcd.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 482 2019-06-19 17:09:52 +02:00
sun4v_tlb_miss.S
sys_sparc_32.c signal: Remove the task parameter from force_sig_fault 2019-05-29 09:31:43 -05:00
sys_sparc_64.c sparc64: fix adjtimex regression 2020-02-02 11:54:41 +01:00
sys_sparc32.c sparc: remove unused header file nfs_fs.h 2020-06-02 18:41:48 -07:00
sys32.S net: remove compat_sys_{get,set}sockopt 2020-07-19 18:16:40 -07:00
syscalls.S sparc64: enable HAVE_COPY_THREAD_TLS 2020-06-23 10:49:54 +02:00
sysfs.c
systbls_32.S sparc: generate uapi header and system call table files 2018-11-18 18:52:22 -08:00
systbls_64.S sparc: generate uapi header and system call table files 2018-11-18 18:52:22 -08:00
systbls.h sparc: get rid of asm wrapper for nis_syscall() 2018-03-20 12:05:17 -04:00
time_32.c
time_64.c cpufreq: Call transition notifier only once for each policy 2019-05-10 12:20:36 +02:00
trampoline_32.S
trampoline_64.S mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
traps_32.c mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
traps_64.c sparc64: Fix opcode filtering in handling of no fault loads 2021-03-30 14:31:50 +02:00
tsb.S
ttable_32.S
ttable_64.S sparc64: Add support for ADI register fields, ASIs and traps 2018-03-18 07:38:45 -07:00
una_asm_32.S
una_asm_64.S
unaligned_32.c Remove 'type' argument from access_ok() function 2019-01-03 18:57:57 -08:00
unaligned_64.c
uprobes.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 13 2019-05-21 11:28:45 +02:00
urtt_fill.S sparc64: Add support for ADI (Application Data Integrity) 2018-03-18 07:38:48 -07:00
utrap.S
vdso.c locking/seqlock, headers: Untangle the spaghetti monster 2020-08-06 16:13:13 +02:00
vio.c sparc: use scnprintf() in show_pciobppath_attr() in vio.c 2020-05-13 15:35:58 -07:00
viohs.c sparc64: viohs: Remove VLA usage 2018-10-07 22:42:00 -07:00
visemul.c
vmlinux.lds.S vmlinux.lds.h: Split ELF_DETAILS from STABS_DEBUG 2020-09-01 09:50:35 +02:00
windows.c
winfixup.S
wof.S
wuf.S