]> Git Repo - linux.git/commit
ARM: 9030/1: entry: omit FP emulation for UND exceptions taken in kernel mode
authorArd Biesheuvel <[email protected]>
Thu, 19 Nov 2020 17:09:16 +0000 (18:09 +0100)
committerRussell King <[email protected]>
Tue, 8 Dec 2020 10:15:00 +0000 (10:15 +0000)
commitf77ac2e378be9dd61eb88728f0840642f045d9d1
tree7df832f036faf7b4cfa7f5908d7984db640514d9
parent3c9f5708b7aed6a963e2aefccbd1854802de163e
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 <[email protected]>
Cc: Kees Cook <[email protected]>
Fixes: eff8728fe698 ("vmlinux.lds.h: Add PGO and AutoFDO input sections")
Signed-off-by: Ard Biesheuvel <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
Reviewed-by: Nick Desaulniers <[email protected]>
Signed-off-by: Russell King <[email protected]>
arch/arm/kernel/entry-armv.S
arch/arm/vfp/vfphw.S
arch/arm/vfp/vfpmodule.c
This page took 0.063355 seconds and 4 git commands to generate.