]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
kasan: arm64: set TCR_EL1.TBID1 when enabled
authorPeter Collingbourne <pcc@google.com>
Sat, 21 Nov 2020 09:59:02 +0000 (01:59 -0800)
committerCatalin Marinas <catalin.marinas@arm.com>
Wed, 25 Nov 2020 16:53:19 +0000 (16:53 +0000)
On hardware supporting pointer authentication, we previously ended up
enabling TBI on instruction accesses when tag-based ASAN was enabled,
but this was costing us 8 bits of PAC entropy, which was unnecessary
since tag-based ASAN does not require TBI on instruction accesses. Get
them back by setting TCR_EL1.TBID1.

Signed-off-by: Peter Collingbourne <pcc@google.com>
Reviewed-by: Andrey Konovalov <andreyknvl@google.com>
Link: https://linux-review.googlesource.com/id/I3dded7824be2e70ea64df0aabab9598d5aebfcc4
Link: https://lore.kernel.org/r/20f64e26fc8a1309caa446fffcb1b4e2fe9e229f.1605952129.git.pcc@google.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/include/asm/pgtable-hwdef.h
arch/arm64/mm/proc.S

index 01a96d07ae741c58f90b3fc21f04776a449b058d..42442a0ae2ab9b3d37afd3f2cc3ae920c37f76db 100644 (file)
 #define TCR_TBI1               (UL(1) << 38)
 #define TCR_HA                 (UL(1) << 39)
 #define TCR_HD                 (UL(1) << 40)
+#define TCR_TBID1              (UL(1) << 52)
 #define TCR_NFD0               (UL(1) << 53)
 #define TCR_NFD1               (UL(1) << 54)
 #define TCR_E0PD0              (UL(1) << 55)
index 0eaf16b0442a0241c4ff7b0bedb7d44ef575a5b8..04945f72c64d32777cabe18a85f6fd50f4eca577 100644 (file)
@@ -40,7 +40,7 @@
 #define TCR_CACHE_FLAGS        TCR_IRGN_WBWA | TCR_ORGN_WBWA
 
 #ifdef CONFIG_KASAN_SW_TAGS
-#define TCR_KASAN_FLAGS TCR_TBI1
+#define TCR_KASAN_FLAGS TCR_TBI1 | TCR_TBID1
 #else
 #define TCR_KASAN_FLAGS 0
 #endif