arm64: Kconfig: Add CONFIG_UNMAP_KERNEL_AT_EL0
authorWill Deacon <will.deacon@arm.com>
Tue, 3 Apr 2018 11:09:12 +0000 (12:09 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 8 Apr 2018 10:12:54 +0000 (12:12 +0200)
commit 084eb77cd3a8 upstream.

Add a Kconfig entry to control use of the entry trampoline, which allows
us to unmap the kernel whilst running in userspace and improve the
robustness of KASLR.

Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Tested-by: Laura Abbott <labbott@redhat.com>
Tested-by: Shanker Donthineni <shankerd@codeaurora.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Alex Shi <alex.shi@linaro.org> [v4.9 backport]
Signed-off-by: Mark Rutland <mark.rutland@arm.com> [v4.9 backport]
Tested-by: Will Deacon <will.deacon@arm.com>
Tested-by: Greg Hackmann <ghackmann@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm64/Kconfig

index 7769c2e27788bd6e2cff78d1e5c81018adfd0fa7..6b6e9f89e40a753a77074f087a62c01c97db6e29 100644 (file)
@@ -733,6 +733,19 @@ config FORCE_MAX_ZONEORDER
          However for 4K, we choose a higher default value, 11 as opposed to 10, giving us
          4M allocations matching the default size used by generic code.
 
+config UNMAP_KERNEL_AT_EL0
+       bool "Unmap kernel when running in userspace (aka \"KAISER\")"
+       default y
+       help
+         Some attacks against KASLR make use of the timing difference between
+         a permission fault which could arise from a page table entry that is
+         present in the TLB, and a translation fault which always requires a
+         page table walk. This option defends against these attacks by unmapping
+         the kernel whilst running in userspace, therefore forcing translation
+         faults for all of kernel space.
+
+         If unsure, say Y.
+
 menuconfig ARMV8_DEPRECATED
        bool "Emulate deprecated/obsolete ARMv8 instructions"
        depends on COMPAT