Implement FUCKWIT for arm64; unmap the kernel almost entirely while userland
authorkettenis <kettenis@openbsd.org>
Wed, 10 Jan 2018 23:27:18 +0000 (23:27 +0000)
committerkettenis <kettenis@openbsd.org>
Wed, 10 Jan 2018 23:27:18 +0000 (23:27 +0000)
commita97a42d9de4f9172faef873359aef60bcf18fd57
tree0b946d55897a29b610603bb86f31d0e30a8de63e
parenta9d11d8694dd738cb852f0f7c79d181b8d054354
Implement FUCKWIT for arm64; unmap the kernel almost entirely while userland
is running.  This provides protection against meltown on cores that are
vilnerable (just Cortex-A75 so far) but also seems to be an essential to
protect against spectre-like attacks against the kernel.

This implementation only exposes a single treampoline page that does not
contain any kernel virtual addresses and also hides the real virtual address
of the exception vectors, which helps on cores vulnerable to "variant 3a"
(Cortex-A57, Cortex-A72).  The implementation is inspired by the work done
by Will Deacon for Linux, but there are no knobs to turn it off.  The
overhead is fairly limited: around 3-4% slowdown on Cortex-A57.

ok patrick@, deraadt@
sys/arch/arm64/arm64/cpufunc_asm.S
sys/arch/arm64/arm64/exception.S
sys/arch/arm64/arm64/machdep.c
sys/arch/arm64/arm64/pmap.c
sys/arch/arm64/arm64/trampoline.S [new file with mode: 0644]
sys/arch/arm64/conf/files.arm64
sys/arch/arm64/dev/efi.c
sys/arch/arm64/include/cpufunc.h