[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231215092707.669401084@infradead.org>
Date: Fri, 15 Dec 2023 10:12:21 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc: paul.walmsley@...ive.com,
palmer@...belt.com,
aou@...s.berkeley.edu,
tglx@...utronix.de,
mingo@...hat.com,
bp@...en8.de,
dave.hansen@...ux.intel.com,
x86@...nel.org,
hpa@...or.com,
davem@...emloft.net,
dsahern@...nel.org,
daniel@...earbox.net,
andrii@...nel.org,
martin.lau@...ux.dev,
song@...nel.org,
yonghong.song@...ux.dev,
john.fastabend@...il.com,
kpsingh@...nel.org,
sdf@...gle.com,
haoluo@...gle.com,
jolsa@...nel.org,
Arnd Bergmann <arnd@...db.de>,
samitolvanen@...gle.com,
keescook@...omium.org,
nathan@...nel.org,
ndesaulniers@...gle.com,
linux-riscv@...ts.infradead.org,
linux-kernel@...r.kernel.org,
netdev@...r.kernel.org,
bpf@...r.kernel.org,
linux-arch@...r.kernel.org,
llvm@...ts.linux.dev,
jpoimboe@...nel.org,
joao@...rdrivepizza.com,
mark.rutland@....com,
peterz@...radead.org
Subject: [PATCH v3 5/7] 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@...radead.org>
---
arch/x86/include/asm/cfi.h | 5 +++++
include/linux/cfi.h | 4 ++++
2 files changed, 9 insertions(+)
--- a/arch/x86/include/asm/cfi.h
+++ b/arch/x86/include/asm/cfi.h
@@ -8,6 +8,7 @@
* Copyright (C) 2022 Google LLC
*/
#include <linux/bug.h>
+#include <asm/ibt.h>
/*
* An overview of the various calling conventions...
@@ -138,4 +139,8 @@ static inline u32 cfi_get_func_hash(void
}
#endif /* CONFIG_CFI_CLANG */
+#if HAS_KERNEL_IBT == 1
+#define CFI_NOSEAL(x) asm(IBT_NOSEAL(__stringify(x)))
+#endif
+
#endif /* _ASM_X86_CFI_H */
--- a/include/linux/cfi.h
+++ b/include/linux/cfi.h
@@ -46,4 +46,8 @@ static inline void module_cfi_finalize(c
#endif /* CONFIG_ARCH_USES_CFI_TRAPS */
#endif /* CONFIG_MODULES */
+#ifndef CFI_NOSEAL
+#define CFI_NOSEAL(x)
+#endif
+
#endif /* _LINUX_CFI_H */
Powered by blists - more mailing lists