Skip to content

Commit e9d13b9

Browse files
Peter ZijlstraAlexei Starovoitov
authored andcommitted
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) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 2cd3e37 commit e9d13b9

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

arch/x86/include/asm/cfi.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* Copyright (C) 2022 Google LLC
99
*/
1010
#include <linux/bug.h>
11+
#include <asm/ibt.h>
1112

1213
/*
1314
* An overview of the various calling conventions...
@@ -138,4 +139,8 @@ static inline u32 cfi_get_func_hash(void *func)
138139
}
139140
#endif /* CONFIG_CFI_CLANG */
140141

142+
#if HAS_KERNEL_IBT == 1
143+
#define CFI_NOSEAL(x) asm(IBT_NOSEAL(__stringify(x)))
144+
#endif
145+
141146
#endif /* _ASM_X86_CFI_H */

include/linux/cfi.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,8 @@ static inline void module_cfi_finalize(const Elf_Ehdr *hdr,
4646
#endif /* CONFIG_ARCH_USES_CFI_TRAPS */
4747
#endif /* CONFIG_MODULES */
4848

49+
#ifndef CFI_NOSEAL
50+
#define CFI_NOSEAL(x)
51+
#endif
52+
4953
#endif /* _LINUX_CFI_H */

0 commit comments

Comments
 (0)