ARM: spectre-v2: harden user aborts in kernel space
commita645847f4435a38e242609b76e31b78ef0d4cf92
authorRussell King <rmk+kernel@armlinux.org.uk>
Fri, 8 Nov 2019 12:35:28 +0000 (8 13:35 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 10 Nov 2019 10:21:26 +0000 (10 11:21 +0100)
treefd018bdae94af1e0f167f14aad26c2488fd9c96f
parent4d027736deefe93443f86a3c26c810314e507b5b
ARM: spectre-v2: harden user aborts in kernel space

Commit f5fe12b1eaee220ce62ff9afb8b90929c396595f upstream.

In order to prevent aliasing attacks on the branch predictor,
invalidate the BTB or instruction cache on CPUs that are known to be
affected when taking an abort on a address that is outside of a user
task limit:

Cortex A8, A9, A12, A17, A73, A75: flush BTB.
Cortex A15, Brahma B15: invalidate icache.

If the IBE bit is not set, then there is little point to enabling the
workaround.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Boot-tested-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: David A. Long <dave.long@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm/include/asm/cp15.h
arch/arm/include/asm/system_misc.h
arch/arm/mm/fault.c
arch/arm/mm/proc-v7-bugs.c
arch/arm/mm/proc-v7.S