linux-stable/arch/arm/kernel
Ard Biesheuvel f77ac2e378 ARM: 9030/1: entry: omit FP emulation for UND exceptions taken in kernel mode
There are a couple of problems with the exception entry code that deals
with FP exceptions (which are reported as UND exceptions) when building
the kernel in Thumb2 mode:
- the conditional branch to vfp_kmode_exception in vfp_support_entry()
  may be out of range for its target, depending on how the linker decides
  to arrange the sections;
- when the UND exception is taken in kernel mode, the emulation handling
  logic is entered via the 'call_fpe' label, which means we end up using
  the wrong value/mask pairs to match and detect the NEON opcodes.

Since UND exceptions in kernel mode are unlikely to occur on a hot path
(as opposed to the user mode version which is invoked for VFP support
code and lazy restore), we can use the existing undef hook machinery for
any kernel mode instruction emulation that is needed, including calling
the existing vfp_kmode_exception() routine for unexpected cases. So drop
the call to call_fpe, and instead, install an undef hook that will get
called for NEON and VFP instructions that trigger an UND exception in
kernel mode.

While at it, make sure that the PC correction is accurate for the
execution mode where the exception was taken, by checking the PSR
Thumb bit.

Cc: Dmitry Osipenko <digetx@gmail.com>
Cc: Kees Cook <keescook@chromium.org>
Fixes: eff8728fe6 ("vmlinux.lds.h: Add PGO and AutoFDO input sections")
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
2020-12-08 10:15:00 +00:00
..
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
arch_timer.c
armksyms.c crypto: lib/sha1 - remove unnecessary includes of linux/cryptohash.h 2020-05-08 15:32:17 +10:00
asm-offsets.c Raise gcc version requirement to 4.9 2020-07-08 10:48:35 -07:00
atags.h ARM: 9011/1: centralize phys-to-virt conversion of DT/ATAGS address 2020-10-27 12:10:59 +00:00
atags_compat.c
atags_parse.c ARM: 9011/1: centralize phys-to-virt conversion of DT/ATAGS address 2020-10-27 12:10:59 +00:00
atags_proc.c ARM: 8973/1: Add missing newline terminator to kernel message 2020-05-07 20:53:10 +01:00
bios32.c ARM/PCI: Remove unused fields from struct hw_pci 2020-09-18 22:39:09 +01:00
bugs.c
cpuidle.c treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
crash_dump.c
debug.S ARM: 9005/1: debug: Select flow control for all debug UARTs 2020-09-15 14:35:28 +01:00
devtree.c ARM: 9011/1: centralize phys-to-virt conversion of DT/ATAGS address 2020-10-27 12:10:59 +00:00
dma-isa.c
dma.c
early_printk.c
efi.c
elf.c arm32/64/elf: Split READ_IMPLIES_EXEC from executable PT_GNU_STACK 2020-04-20 19:42:19 +02:00
entry-armv.S ARM: 9030/1: entry: omit FP emulation for UND exceptions taken in kernel mode 2020-12-08 10:15:00 +00:00
entry-common.S ARM: 9015/2: Define the virtual space of KASan's shadow region 2020-10-27 12:11:08 +00:00
entry-ftrace.S
entry-header.S ARM: uaccess: consolidate uaccess asm to asm/uaccess-asm.h 2020-05-03 17:30:24 +01:00
entry-v7m.S
fiq.c arm: fix the flush_icache_range arguments in set_fiq_handler 2020-06-08 11:05:57 -07:00
fiqasm.S
ftrace.c maccess: rename probe_kernel_{read,write} to copy_{from,to}_kernel_nofault 2020-06-17 10:57:41 -07:00
head-common.S ARM: 9016/2: Initialize the mapping of KASan shadow memory 2020-10-27 12:11:10 +00:00
head-inflate-data.c
head-nommu.S
head.S ARM: 9012/1: move device tree mapping out of linear region 2020-10-27 12:11:01 +00:00
hibernate.c
hw_breakpoint.c ARM: 8997/2: hw_breakpoint: Handle inexact watchpoint addresses 2020-09-15 14:35:24 +01:00
hyp-stub.S arm: Remove the ability to set HYP vectors outside of the decompressor 2020-03-24 10:56:05 +00:00
insn.c
io.c
irq.c ARM: Remove custom IRQ stat accounting 2020-09-17 16:37:28 +01:00
isa.c
iwmmxt.h ARM: 9029/1: Make iwmmxt.S support Clang's integrated assembler 2020-12-08 10:14:59 +00:00
iwmmxt.S ARM: 9029/1: Make iwmmxt.S support Clang's integrated assembler 2020-12-08 10:14:59 +00:00
jump_label.c
kgdb.c maccess: rename probe_kernel_{read,write} to copy_{from,to}_kernel_nofault 2020-06-17 10:57:41 -07:00
machine_kexec.c mm: remove unneeded includes of <asm/pgalloc.h> 2020-08-07 11:33:26 -07:00
Makefile ARM: 9028/1: disable KASAN in call stack capturing routines 2020-12-08 10:14:57 +00:00
module-plts.c
module.c mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
opcodes.c
paravirt.c
patch.c arm/patch: Fix !MMU compile 2020-02-11 12:56:27 +01:00
perf_callchain.c
perf_event_v6.c
perf_event_v7.c
perf_event_xscale.c
perf_regs.c
pj4-cp0.c
process.c Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-08-09 13:33:54 -07:00
psci_smp.c
ptrace.c arm: switch to ->regset_get() 2020-07-27 14:31:09 -04:00
reboot.c ARM: Use reboot_cpu instead of hardcoding it to 0 2020-03-25 12:59:33 +01:00
reboot.h
relocate_kernel.S ARM: 8962/1: kexec: drop invalid assembly argument 2020-03-12 11:29:02 +00:00
return_address.c
setup.c ARM: 9024/1: Drop useless cast of "u64" to "long long" 2020-11-12 14:53:21 +00:00
signal.c tracehook: clear TIF_NOTIFY_RESUME in tracehook_notify_resume() 2020-10-17 15:04:36 -06:00
signal.h
sigreturn_codes.S
sleep.S
smccc-call.S
smp.c ARM: Handle no IPI being registered in show_ipi_list() 2020-09-28 11:32:04 +01:00
smp_scu.c
smp_tlb.c
smp_twd.c
stacktrace.c ARM: 8992/1: Fix unwind_frame for clang-built kernels 2020-07-21 16:33:40 +01:00
suspend.c mm: remove unneeded includes of <asm/pgalloc.h> 2020-08-07 11:33:26 -07:00
swp_emulate.c mmap locking API: use coccinelle to convert mmap_sem rwsem call sites 2020-06-09 09:39:14 -07:00
sys_arm.c
sys_oabi-compat.c ARM: compat: remove KERNEL_DS usage in sys_oabi_epoll_ctl() 2020-04-21 17:49:30 +01:00
tcm.c
thumbee.c
time.c ARM/time: Replace <linux/clk-provider.h> by <linux/of_clk.h> 2020-05-15 22:54:57 +02:00
topology.c ARM, sched/topology: Revert back to default scheduler topology 2020-08-19 10:49:47 +02:00
traps.c maccess: make get_kernel_nofault() check for minimal type compatibility 2020-06-18 12:10:37 -07:00
unwind.c ARM: 9026/1: unwind: remove old check for GCC <= 4.2 2020-12-08 10:13:59 +00:00
v7m.c
vdso.c ARM: 8987/1: VDSO: Fix incorrect clock_gettime64 2020-07-21 16:32:55 +01:00
vmlinux-xip.lds.S arm/build: Assert for unwanted sections 2020-09-01 10:03:18 +02:00
vmlinux.lds.S arm/build: Assert for unwanted sections 2020-09-01 10:03:18 +02:00
xscale-cp0.c