[GIT PULL] tracing: Fixes for 7.1

Steven Rostedt posted 1 patch 3 days, 18 hours ago
include/linux/tracepoint.h | 8 ++++++++
1 file changed, 8 insertions(+)
[GIT PULL] tracing: Fixes for 7.1
Posted by Steven Rostedt 3 days, 18 hours ago

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 <eva.kurchatova@virtuozzo.com>
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.
    
    Cc: stable@vger.kernel.org
    Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Link: https://patch.msgid.link/20260603153147.573589-1-eva.kurchatova@virtuozzo.com
    Fixes: d5173f753750 ("objtool: Exclude __tracepoints data from ENDBR checks")
    Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
    [ Updated change log ]
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 763eea4d80d8..2d2b9f8cdda4 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -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))
Re: [GIT PULL] tracing: Fixes for 7.1
Posted by Nathan Chancellor 2 days, 15 hours ago
On Thu, Jun 04, 2026 at 08:47:55AM -0400, Steven Rostedt wrote:
> commit 0652a3daa78723f955b1ebeb621665ce72bec53e
> Author: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
> 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.
>     
>     Cc: stable@vger.kernel.org
>     Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
>     Link: https://patch.msgid.link/20260603153147.573589-1-eva.kurchatova@virtuozzo.com
>     Fixes: d5173f753750 ("objtool: Exclude __tracepoints data from ENDBR checks")
>     Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
>     [ Updated change log ]
>     Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> 
> diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
> index 763eea4d80d8..2d2b9f8cdda4 100644
> --- a/include/linux/tracepoint.h
> +++ b/include/linux/tracepoint.h
> @@ -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))
>  

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/

-- 
Cheers,
Nathan
Re: [GIT PULL] tracing: Fixes for 7.1
Posted by Nathan Chancellor 1 day, 9 hours ago
On Fri, Jun 05, 2026 at 08:58:10AM -0700, Nathan Chancellor wrote:
> On Thu, Jun 04, 2026 at 08:47:55AM -0400, Steven Rostedt wrote:
> > commit 0652a3daa78723f955b1ebeb621665ce72bec53e
> > Author: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
> > Date:   Wed Jun 3 18:31:42 2026 +0300
> > 
> >     tracing: Fix CFI violation in probestub being called by tprobes
...
> 
> 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

-- 
Cheers,
Nathan
Re: [GIT PULL] tracing: Fixes for 7.1
Posted by Linus Torvalds 1 day, 9 hours ago
On Sat, 6 Jun 2026 at 14:59, Nathan Chancellor <nathan@kernel.org> wrote:
>
> Linus, could you apply this directly?

Done.

              Linus
Re: [GIT PULL] tracing: Fixes for 7.1
Posted by pr-tracker-bot@kernel.org 3 days, 9 hours ago
The pull request you sent on Thu, 4 Jun 2026 08:47:55 -0400:

> 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!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html