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*.
 -----BEGIN PGP SIGNATURE-----
 
 iIoEABYKADIWIQRRSw7ePDh/lE+zeZMp5XQQmuv6qgUCaiFBrBQccm9zdGVkdEBn
 b29kbWlzLm9yZwAKCRAp5XQQmuv6qgsiAP9+ys3b4sK8rajS7OW6kgKSOjN7ezqp
 pHNdKmiLgsIsGAD+L1GRMqR4XDw0N8IH+GIRzLd5O/b0gwYSI11lopVVsAk=
 =QdWS
 -----END PGP SIGNATURE-----

Merge tag 'trace-v7.1-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace

Pull tracing fix from Steven Rostedt:

 - 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*.

* tag 'trace-v7.1-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
  tracing: Fix CFI violation in probestub being called by tprobes
This commit is contained in:
Linus Torvalds 2026-06-04 13:38:42 -07:00
commit 44ed32d16c

View file

@ -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))