Thread (14 messages) 14 messages, 4 authors, 2d ago
WARM2d REVIEWED: 2 (0M)

2 review trailers.

[PATCH v2 4/9] compiler_types: Let notrace keep the function prefix NOPs

From: Jose Fernandez (Anthropic) <hidden>
Date: 2026-09-24 22:36:58
Also in: bpf, linux-efi, linux-kbuild, live-patching, lkml, llvm, rust-for-linux
Subsystem: the rest · Maintainer: Linus Torvalds

Let notrace keep the prefix NOPs when the architecture defines
CC_USING_PATCHABLE_FUNCTION_PREFIX. kCFI callers check the type hash
at a fixed offset before the entry point, so a notrace function needs
the same prefix NOPs as any other. Record the entry in a section the
linker drops, so ftrace never sees it. Clang 21 takes a section name
as a third argument of the attribute. Nothing defines the macro yet,
so no functional change.

Reviewed-by: Ben Cressey <redacted>
Reviewed-by: Florent Revest (Anthropic) <redacted>
Assisted-by: LLM
Signed-off-by: Jose Fernandez (Anthropic) <redacted>
---
 include/linux/compiler_types.h | 9 +++++++++
 1 file changed, 9 insertions(+)
diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
index c5921f1390079..43dafaa061942 100644
--- a/include/linux/compiler_types.h
+++ b/include/linux/compiler_types.h
@@ -211,6 +211,15 @@ struct ftrace_likely_data {
 
 #if defined(CC_USING_HOTPATCH)
 #define notrace			__attribute__((hotpatch(0, 0)))
+#elif defined(CC_USING_PATCHABLE_FUNCTION_PREFIX) && !defined(__BINDGEN__)
+/*
+ * Not for bindgen: its libclang may not support the section argument
+ * (Clang >= 21), and leaving the attribute out does not change the ABI.
+ */
+#define notrace								\
+	__attribute__((patchable_function_entry(CC_USING_PATCHABLE_FUNCTION_PREFIX, \
+						 CC_USING_PATCHABLE_FUNCTION_PREFIX, \
+						 ".discard.patchable_function_entries")))
 #elif defined(CC_USING_PATCHABLE_FUNCTION_ENTRY)
 #define notrace			__attribute__((patchable_function_entry(0, 0)))
 #else
-- 
2.52.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help