Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cfi: Add CFI_NOSEAL()

Add a CFI_NOSEAL() helper to mark functions that need to retain their
CFI information, despite not otherwise leaking their address.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20231215092707.669401084@infradead.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Peter Zijlstra and committed by
Alexei Starovoitov
e9d13b9d 2cd3e377

+9
+5
arch/x86/include/asm/cfi.h
··· 8 8 * Copyright (C) 2022 Google LLC 9 9 */ 10 10 #include <linux/bug.h> 11 + #include <asm/ibt.h> 11 12 12 13 /* 13 14 * An overview of the various calling conventions... ··· 138 137 return 0; 139 138 } 140 139 #endif /* CONFIG_CFI_CLANG */ 140 + 141 + #if HAS_KERNEL_IBT == 1 142 + #define CFI_NOSEAL(x) asm(IBT_NOSEAL(__stringify(x))) 143 + #endif 141 144 142 145 #endif /* _ASM_X86_CFI_H */
+4
include/linux/cfi.h
··· 46 46 #endif /* CONFIG_ARCH_USES_CFI_TRAPS */ 47 47 #endif /* CONFIG_MODULES */ 48 48 49 + #ifndef CFI_NOSEAL 50 + #define CFI_NOSEAL(x) 51 + #endif 52 + 49 53 #endif /* _LINUX_CFI_H */