Skip to contentSkip to conversation

tracing: Fixes for 7.1

GIT PULL Merged Steven Rostedt 4 participants 5 messages Jun 4 – Jun 6 Tracing

lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

Linus,

tracing fixes for 7.1:

- Fix CFI violation in probestub function

The probestub is a function to allow tprobes to hook to a tracepoint to gain access to its parameters. The function itself is only referenced by the tracepoint structure which lives in the __tracepoint section. objtool explicitly ignores that section and when processing functions in the kernel, if it detects one that has no references it will seal it to have its ENDBR stripped on boot up. This means the probstub function will have its ENDBR stripped and if a tprobe is attached to it with IBT enabled, it will go *boom*.

Please pull the latest trace-v7.1-rc6 tree, which can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace-v7.1-rc6

Tag SHA1: f9504915379aa495293ca8adc857a1ee27407952 Head SHA1: 0652a3daa78723f955b1ebeb621665ce72bec53e

Eva Kurchatova (1):
tracing: Fix CFI violation in probestub being called by tprobes

----

 include/linux/tracepoint.h | 8 ++++++++
 1 file changed, 8 insertions(+)
---------------------------
commit 0652a3daa78723f955b1ebeb621665ce72bec53e
Author: Eva Kurchatova <[email protected]>
Date:   Wed Jun 3 18:31:42 2026 +0300

tracing: Fix CFI violation in probestub being called by tprobes

The probestub is a function to allow tprobes to hook to a tracepoint to gain access to its parameters. The function itself is only referenced by the tracepoint structure which lives in the __tracepoint section. objtool explicitly ignores that section and when processing functions in the kernel, if it detects one that has no references it will seal it to have its ENDBR stripped on boot up.

This means when a tprobe is attached to the sched_wakeup tracepoint, when it is triggered it will call __probestub_sched_wakeup and due to the missing ENDBR on a CFI-enabled machine it will take a #CP exception.

Fix this by adding CFI_NOSEAL annotation to probestub declaration.

Fixes d5173f753750 ("objtool: Exclude __tracepoints data from ENDBR checks")
[ Updated change log ]
include/linux/tracepoint.h +8 -0
index 763eea4d80d8..2d2b9f8cdda4 100644
@@ -20,6 +20,7 @@
 #include <linux/rcupdate_trace.h>
 #include <linux/tracepoint-defs.h>
 #include <linux/static_call.h>
+#include <linux/cfi.h>
 
 struct module;
 struct tracepoint;
@@ -389,6 +390,13 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
 	void __probestub_##_name(void *__data, proto)			\
 	{								\
 	}								\
+	/*								\
+	 * Annotate the probestub 'CFI_NOSEAL' to stop objtool from	\
+	 * requesting the kernel remove the ENDBR, because the only	\
+	 * references to the function are in the __tracepoint section,	\
+	 * that objtool doesn't scan.					\
+	 */								\
+	CFI_NOSEAL(__probestub_##_name);				\
 	DEFINE_STATIC_CALL(tp_func_##_name, __traceiter_##_name);	\
 	DEFINE_RUST_DO_TRACE(_name, TP_PROTO(proto), TP_ARGS(args))
 
merge bot Merged
#1 lore raw
The pull request you sent on Thu, 4 Jun 2026 08:47:55 -0400:

The pull request you sent on Thu, 4 Jun 2026 08:47:55 -0400:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git trace-v7.1-rc6

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/44ed32d16c9d0e0f3a4b594982a2bb168d2f56ea

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html
#2 lore raw
In reply to Steven Rostedt
Quoted 43 lines · Steven Rostedt

commit 0652a3daa78723f955b1ebeb621665ce72bec53e

Author: Eva Kurchatova <[email protected]>
Date:   Wed Jun 3 18:31:42 2026 +0300

tracing: Fix CFI violation in probestub being called by tprobes

The probestub is a function to allow tprobes to hook to a tracepoint to gain access to its parameters. The function itself is only referenced by the tracepoint structure which lives in the __tracepoint section. objtool explicitly ignores that section and when processing functions in the kernel, if it detects one that has no references it will seal it to have its ENDBR stripped on boot up.

This means when a tprobe is attached to the sched_wakeup tracepoint, when it is triggered it will call __probestub_sched_wakeup and due to the missing ENDBR on a CFI-enabled machine it will take a #CP exception.

Fix this by adding CFI_NOSEAL annotation to probestub declaration.

Fixes d5173f753750 ("objtool: Exclude __tracepoints data from ENDBR checks")
[ Updated change log ]
include/linux/tracepoint.h +1 -0
index 763eea4d80d8..2d2b9f8cdda4 100644
@@ -20,6 +20,7 @@
 #include <linux/rcupdate_trace.h>
 #include <linux/tracepoint-defs.h>
 #include <linux/static_call.h>
+#include <linux/cfi.h>
 
 struct module;
 struct tracepoint;
@@ -389,6 +390,13 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
 	void __probestub_##_name(void *__data, proto)			\
 	{								\
 	}								\

include/linux/tracepoint.h static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p) · line 402

Quoted 10 lines
include/linux/tracepoint.h +7 -0
+	/*								\
+	 * Annotate the probestub 'CFI_NOSEAL' to stop objtool from	\
+	 * requesting the kernel remove the ENDBR, because the only	\
+	 * references to the function are in the __tracepoint section,	\
+	 * that objtool doesn't scan.					\
+	 */								\
+	CFI_NOSEAL(__probestub_##_name);				\
 	DEFINE_STATIC_CALL(tp_func_##_name, __traceiter_##_name);	\
 	DEFINE_RUST_DO_TRACE(_name, TP_PROTO(proto), TP_ARGS(args))
 

This needs a build fix, as ARCH=arm allmodconfig is now broken with Clang.

https://lore.kernel.org/20260604-tracing-fix-cfi-h-build-error-v1-1-b27015390901@kernel.org/

Signature · 2 lines
Cheers,
Nathan
#3 lore raw
Quoted 6 lines · Nathan Chancellor
Quoted 5 lines · Steven Rostedt

commit 0652a3daa78723f955b1ebeb621665ce72bec53e

Author: Eva Kurchatova <[email protected]>
Date:   Wed Jun 3 18:31:42 2026 +0300

tracing: Fix CFI violation in probestub being called by tprobes

...

Quoted 5 lines

This needs a build fix, as ARCH=arm allmodconfig is now broken with Clang.

https://lore.kernel.org/20260604-tracing-fix-cfi-h-build-error-v1-1-b27015390901@kernel.org/

Linus, could you apply this directly? Other folks have already noticed this breakage:

https://android-review.googlesource.com/c/kernel/common/+/4105881

Signature · 2 lines
Cheers,
Nathan
#4 lore raw
Quoted 2 lines · Nathan Chancellor

Linus, could you apply this directly?

Done.

Linus