* [PATCH v2] tracing: fix CFI violation in probestub test
@ 2026-06-02 13:54 Eva Kurchatova
2026-06-02 14:33 ` Masami Hiramatsu
2026-06-02 21:40 ` kernel test robot
0 siblings, 2 replies; 3+ messages in thread
From: Eva Kurchatova @ 2026-06-02 13:54 UTC (permalink / raw)
To: mhiramat, rostedt
Cc: linux-trace-kernel, linux-kernel, mathieu.desnoyers, peterz,
jpoimboe, samitolvanen, eva.kurchatova
When multiple callbacks are registered on the same tracepoint,
callbacks will be indirectly called via traceiter helper.
Pointers to __probestub_* callbacks reside in __tracepoints section,
which is excluded from ENDBR checks in objtool, causing objtool to
assume those functions are never indirectly called.
Registering multiple callbacks using sched_wakeup test will result
in #CP exception due to missing ENDBR in __probestub_sched_wakeup
on a CFI-enabled machine.
Fix this by adding CFI_NOSEAL annotation to probestub declaration.
Fixes: d5173f753750 ("objtool: Exclude __tracepoints data from ENDBR checks")
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
include/linux/tracepoint.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 763eea4d80d8..38e9f49a71b7 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 <asm/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))
--
2.54.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] tracing: fix CFI violation in probestub test
2026-06-02 13:54 [PATCH v2] tracing: fix CFI violation in probestub test Eva Kurchatova
@ 2026-06-02 14:33 ` Masami Hiramatsu
2026-06-02 21:40 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: Masami Hiramatsu @ 2026-06-02 14:33 UTC (permalink / raw)
To: Eva Kurchatova
Cc: rostedt, linux-trace-kernel, linux-kernel, mathieu.desnoyers,
peterz, jpoimboe, samitolvanen
On Tue, 2 Jun 2026 16:54:08 +0300
Eva Kurchatova <eva.kurchatova@virtuozzo.com> wrote:
> When multiple callbacks are registered on the same tracepoint,
> callbacks will be indirectly called via traceiter helper.
>
> Pointers to __probestub_* callbacks reside in __tracepoints section,
> which is excluded from ENDBR checks in objtool, causing objtool to
> assume those functions are never indirectly called.
>
> Registering multiple callbacks using sched_wakeup test will result
> in #CP exception due to missing ENDBR in __probestub_sched_wakeup
> on a CFI-enabled machine.
>
> Fix this by adding CFI_NOSEAL annotation to probestub declaration.
>
Thanks, this looks good to me.
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> Fixes: d5173f753750 ("objtool: Exclude __tracepoints data from ENDBR checks")
> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
> ---
> include/linux/tracepoint.h | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
> index 763eea4d80d8..38e9f49a71b7 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 <asm/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))
>
> --
> 2.54.0
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] tracing: fix CFI violation in probestub test
2026-06-02 13:54 [PATCH v2] tracing: fix CFI violation in probestub test Eva Kurchatova
2026-06-02 14:33 ` Masami Hiramatsu
@ 2026-06-02 21:40 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-06-02 21:40 UTC (permalink / raw)
To: Eva Kurchatova, mhiramat, rostedt
Cc: oe-kbuild-all, linux-trace-kernel, linux-kernel,
mathieu.desnoyers, peterz, jpoimboe, samitolvanen, eva.kurchatova
Hi Eva,
kernel test robot noticed the following build errors:
[auto build test ERROR on trace/for-next]
[also build test ERROR on linus/master v6.16-rc1 next-20260602]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Eva-Kurchatova/tracing-fix-CFI-violation-in-probestub-test/20260602-222302
base: https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace for-next
patch link: https://lore.kernel.org/r/20260602135425.542073-1-eva.kurchatova%40virtuozzo.com
patch subject: [PATCH v2] tracing: fix CFI violation in probestub test
config: x86_64-rhel-9.4-kselftests (https://download.01.org/0day-ci/archive/20260602/202606022312.7cKiQBmg-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260602/202606022312.7cKiQBmg-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202606022312.7cKiQBmg-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from drivers/dma-buf/sync_trace.h:10,
from drivers/dma-buf/sw_sync.c:18:
include/linux/tracepoint.h:403:9: warning: data definition has no type or storage class
403 | CFI_NOSEAL(__probestub_##_name); \
| ^~~~~~~~~~
include/linux/tracepoint.h:424:9: note: in expansion of macro '__DEFINE_TRACE_EXT'
424 | __DEFINE_TRACE_EXT(_name, NULL, PARAMS(_proto), PARAMS(_args));
| ^~~~~~~~~~~~~~~~~~
include/trace/define_trace.h:28:9: note: in expansion of macro 'DEFINE_TRACE'
28 | DEFINE_TRACE(name, PARAMS(proto), PARAMS(args))
| ^~~~~~~~~~~~
include/trace/../../drivers/dma-buf/sync_trace.h:12:1: note: in expansion of macro 'TRACE_EVENT'
12 | TRACE_EVENT(sync_timeline,
| ^~~~~~~~~~~
include/linux/tracepoint.h:403:9: error: type defaults to 'int' in declaration of 'CFI_NOSEAL' [-Wimplicit-int]
403 | CFI_NOSEAL(__probestub_##_name); \
| ^~~~~~~~~~
include/linux/tracepoint.h:424:9: note: in expansion of macro '__DEFINE_TRACE_EXT'
424 | __DEFINE_TRACE_EXT(_name, NULL, PARAMS(_proto), PARAMS(_args));
| ^~~~~~~~~~~~~~~~~~
include/trace/define_trace.h:28:9: note: in expansion of macro 'DEFINE_TRACE'
28 | DEFINE_TRACE(name, PARAMS(proto), PARAMS(args))
| ^~~~~~~~~~~~
include/trace/../../drivers/dma-buf/sync_trace.h:12:1: note: in expansion of macro 'TRACE_EVENT'
12 | TRACE_EVENT(sync_timeline,
| ^~~~~~~~~~~
>> include/trace/../../drivers/dma-buf/sync_trace.h:13:25: error: parameter names (without types) in function declaration [-Wdeclaration-missing-parameter-type]
13 | TP_PROTO(struct sync_timeline *timeline),
| ^~~~~~~~~~~~~
include/linux/tracepoint.h:394:48: note: in definition of macro '__DEFINE_TRACE_EXT'
394 | void __probestub_##_name(void *__data, proto) \
| ^~~~~
include/linux/tracepoint.h:424:41: note: in expansion of macro 'PARAMS'
424 | __DEFINE_TRACE_EXT(_name, NULL, PARAMS(_proto), PARAMS(_args));
| ^~~~~~
include/trace/define_trace.h:28:9: note: in expansion of macro 'DEFINE_TRACE'
28 | DEFINE_TRACE(name, PARAMS(proto), PARAMS(args))
| ^~~~~~~~~~~~
include/trace/define_trace.h:28:28: note: in expansion of macro 'PARAMS'
28 | DEFINE_TRACE(name, PARAMS(proto), PARAMS(args))
| ^~~~~~
include/trace/../../drivers/dma-buf/sync_trace.h:12:1: note: in expansion of macro 'TRACE_EVENT'
12 | TRACE_EVENT(sync_timeline,
| ^~~~~~~~~~~
include/trace/../../drivers/dma-buf/sync_trace.h:13:9: note: in expansion of macro 'TP_PROTO'
13 | TP_PROTO(struct sync_timeline *timeline),
| ^~~~~~~~
--
In file included from include/trace/events/lock.h:9,
from kernel/locking/mutex.c:35:
include/linux/tracepoint.h:403:9: warning: data definition has no type or storage class
403 | CFI_NOSEAL(__probestub_##_name); \
| ^~~~~~~~~~
include/linux/tracepoint.h:424:9: note: in expansion of macro '__DEFINE_TRACE_EXT'
424 | __DEFINE_TRACE_EXT(_name, NULL, PARAMS(_proto), PARAMS(_args));
| ^~~~~~~~~~~~~~~~~~
include/trace/define_trace.h:28:9: note: in expansion of macro 'DEFINE_TRACE'
28 | DEFINE_TRACE(name, PARAMS(proto), PARAMS(args))
| ^~~~~~~~~~~~
include/trace/events/lock.h:24:1: note: in expansion of macro 'TRACE_EVENT'
24 | TRACE_EVENT(lock_acquire,
| ^~~~~~~~~~~
include/linux/tracepoint.h:403:9: error: type defaults to 'int' in declaration of 'CFI_NOSEAL' [-Wimplicit-int]
403 | CFI_NOSEAL(__probestub_##_name); \
| ^~~~~~~~~~
include/linux/tracepoint.h:424:9: note: in expansion of macro '__DEFINE_TRACE_EXT'
424 | __DEFINE_TRACE_EXT(_name, NULL, PARAMS(_proto), PARAMS(_args));
| ^~~~~~~~~~~~~~~~~~
include/trace/define_trace.h:28:9: note: in expansion of macro 'DEFINE_TRACE'
28 | DEFINE_TRACE(name, PARAMS(proto), PARAMS(args))
| ^~~~~~~~~~~~
include/trace/events/lock.h:24:1: note: in expansion of macro 'TRACE_EVENT'
24 | TRACE_EVENT(lock_acquire,
| ^~~~~~~~~~~
>> include/trace/events/lock.h:28:24: error: parameter names (without types) in function declaration [-Wdeclaration-missing-parameter-type]
28 | struct lockdep_map *next_lock, unsigned long ip),
| ^~~~~~~~~~~
include/linux/tracepoint.h:394:48: note: in definition of macro '__DEFINE_TRACE_EXT'
394 | void __probestub_##_name(void *__data, proto) \
| ^~~~~
include/linux/tracepoint.h:424:41: note: in expansion of macro 'PARAMS'
424 | __DEFINE_TRACE_EXT(_name, NULL, PARAMS(_proto), PARAMS(_args));
| ^~~~~~
include/trace/define_trace.h:28:9: note: in expansion of macro 'DEFINE_TRACE'
28 | DEFINE_TRACE(name, PARAMS(proto), PARAMS(args))
| ^~~~~~~~~~~~
include/trace/define_trace.h:28:28: note: in expansion of macro 'PARAMS'
28 | DEFINE_TRACE(name, PARAMS(proto), PARAMS(args))
| ^~~~~~
include/trace/events/lock.h:24:1: note: in expansion of macro 'TRACE_EVENT'
24 | TRACE_EVENT(lock_acquire,
| ^~~~~~~~~~~
include/trace/events/lock.h:26:9: note: in expansion of macro 'TP_PROTO'
26 | TP_PROTO(struct lockdep_map *lock, unsigned int subclass,
| ^~~~~~~~
include/linux/tracepoint.h:403:9: warning: data definition has no type or storage class
403 | CFI_NOSEAL(__probestub_##_name); \
| ^~~~~~~~~~
include/linux/tracepoint.h:424:9: note: in expansion of macro '__DEFINE_TRACE_EXT'
424 | __DEFINE_TRACE_EXT(_name, NULL, PARAMS(_proto), PARAMS(_args));
| ^~~~~~~~~~~~~~~~~~
include/trace/define_trace.h:61:9: note: in expansion of macro 'DEFINE_TRACE'
61 | DEFINE_TRACE(name, PARAMS(proto), PARAMS(args))
| ^~~~~~~~~~~~
include/trace/events/lock.h:69:1: note: in expansion of macro 'DEFINE_EVENT'
69 | DEFINE_EVENT(lock, lock_release,
| ^~~~~~~~~~~~
include/linux/tracepoint.h:403:9: error: type defaults to 'int' in declaration of 'CFI_NOSEAL' [-Wimplicit-int]
403 | CFI_NOSEAL(__probestub_##_name); \
| ^~~~~~~~~~
include/linux/tracepoint.h:424:9: note: in expansion of macro '__DEFINE_TRACE_EXT'
424 | __DEFINE_TRACE_EXT(_name, NULL, PARAMS(_proto), PARAMS(_args));
| ^~~~~~~~~~~~~~~~~~
include/trace/define_trace.h:61:9: note: in expansion of macro 'DEFINE_TRACE'
61 | DEFINE_TRACE(name, PARAMS(proto), PARAMS(args))
| ^~~~~~~~~~~~
include/trace/events/lock.h:69:1: note: in expansion of macro 'DEFINE_EVENT'
69 | DEFINE_EVENT(lock, lock_release,
| ^~~~~~~~~~~~
include/trace/events/lock.h:71:25: error: parameter names (without types) in function declaration [-Wdeclaration-missing-parameter-type]
71 | TP_PROTO(struct lockdep_map *lock, unsigned long ip),
| ^~~~~~~~~~~
include/linux/tracepoint.h:394:48: note: in definition of macro '__DEFINE_TRACE_EXT'
394 | void __probestub_##_name(void *__data, proto) \
| ^~~~~
include/linux/tracepoint.h:424:41: note: in expansion of macro 'PARAMS'
424 | __DEFINE_TRACE_EXT(_name, NULL, PARAMS(_proto), PARAMS(_args));
| ^~~~~~
include/trace/define_trace.h:61:9: note: in expansion of macro 'DEFINE_TRACE'
61 | DEFINE_TRACE(name, PARAMS(proto), PARAMS(args))
| ^~~~~~~~~~~~
include/trace/define_trace.h:61:28: note: in expansion of macro 'PARAMS'
61 | DEFINE_TRACE(name, PARAMS(proto), PARAMS(args))
| ^~~~~~
include/trace/events/lock.h:69:1: note: in expansion of macro 'DEFINE_EVENT'
69 | DEFINE_EVENT(lock, lock_release,
| ^~~~~~~~~~~~
include/trace/events/lock.h:71:9: note: in expansion of macro 'TP_PROTO'
71 | TP_PROTO(struct lockdep_map *lock, unsigned long ip),
| ^~~~~~~~
include/linux/tracepoint.h:403:9: warning: data definition has no type or storage class
403 | CFI_NOSEAL(__probestub_##_name); \
| ^~~~~~~~~~
include/linux/tracepoint.h:424:9: note: in expansion of macro '__DEFINE_TRACE_EXT'
424 | __DEFINE_TRACE_EXT(_name, NULL, PARAMS(_proto), PARAMS(_args));
| ^~~~~~~~~~~~~~~~~~
include/trace/define_trace.h:28:9: note: in expansion of macro 'DEFINE_TRACE'
28 | DEFINE_TRACE(name, PARAMS(proto), PARAMS(args))
| ^~~~~~~~~~~~
include/trace/events/lock.h:95:1: note: in expansion of macro 'TRACE_EVENT'
95 | TRACE_EVENT(contention_begin,
| ^~~~~~~~~~~
include/linux/tracepoint.h:403:9: error: type defaults to 'int' in declaration of 'CFI_NOSEAL' [-Wimplicit-int]
403 | CFI_NOSEAL(__probestub_##_name); \
| ^~~~~~~~~~
include/linux/tracepoint.h:424:9: note: in expansion of macro '__DEFINE_TRACE_EXT'
424 | __DEFINE_TRACE_EXT(_name, NULL, PARAMS(_proto), PARAMS(_args));
| ^~~~~~~~~~~~~~~~~~
include/trace/define_trace.h:28:9: note: in expansion of macro 'DEFINE_TRACE'
28 | DEFINE_TRACE(name, PARAMS(proto), PARAMS(args))
| ^~~~~~~~~~~~
include/trace/events/lock.h:95:1: note: in expansion of macro 'TRACE_EVENT'
95 | TRACE_EVENT(contention_begin,
| ^~~~~~~~~~~
include/linux/tracepoint.h:380:24: error: parameter names (without types) in function declaration [-Wdeclaration-missing-parameter-type]
380 | struct tracepoint_func *it_func_ptr; \
| ^~~~~~~~~~~~~~~
include/linux/tracepoint.h:424:9: note: in expansion of macro '__DEFINE_TRACE_EXT'
424 | __DEFINE_TRACE_EXT(_name, NULL, PARAMS(_proto), PARAMS(_args));
| ^~~~~~~~~~~~~~~~~~
include/trace/define_trace.h:28:9: note: in expansion of macro 'DEFINE_TRACE'
28 | DEFINE_TRACE(name, PARAMS(proto), PARAMS(args))
| ^~~~~~~~~~~~
include/trace/events/lock.h:95:1: note: in expansion of macro 'TRACE_EVENT'
95 | TRACE_EVENT(contention_begin,
vim +13 include/trace/../../drivers/dma-buf/sync_trace.h
b699a644f82110e drivers/staging/android/trace/sync.h Erik Gilling 2013-02-28 11
b699a644f82110e drivers/staging/android/trace/sync.h Erik Gilling 2013-02-28 12 TRACE_EVENT(sync_timeline,
b699a644f82110e drivers/staging/android/trace/sync.h Erik Gilling 2013-02-28 @13 TP_PROTO(struct sync_timeline *timeline),
b699a644f82110e drivers/staging/android/trace/sync.h Erik Gilling 2013-02-28 14
b699a644f82110e drivers/staging/android/trace/sync.h Erik Gilling 2013-02-28 15 TP_ARGS(timeline),
b699a644f82110e drivers/staging/android/trace/sync.h Erik Gilling 2013-02-28 16
b699a644f82110e drivers/staging/android/trace/sync.h Erik Gilling 2013-02-28 17 TP_STRUCT__entry(
b699a644f82110e drivers/staging/android/trace/sync.h Erik Gilling 2013-02-28 18 __string(name, timeline->name)
5c1401f83a16b7e drivers/staging/android/trace/sync.h Gustavo Padovan 2016-05-31 19 __field(u32, value)
b699a644f82110e drivers/staging/android/trace/sync.h Erik Gilling 2013-02-28 20 ),
b699a644f82110e drivers/staging/android/trace/sync.h Erik Gilling 2013-02-28 21
b699a644f82110e drivers/staging/android/trace/sync.h Erik Gilling 2013-02-28 22 TP_fast_assign(
2c92ca849fcc6ee drivers/dma-buf/sync_trace.h Steven Rostedt (Google 2024-05-16 23) __assign_str(name);
5c1401f83a16b7e drivers/staging/android/trace/sync.h Gustavo Padovan 2016-05-31 24 __entry->value = timeline->value;
b699a644f82110e drivers/staging/android/trace/sync.h Erik Gilling 2013-02-28 25 ),
b699a644f82110e drivers/staging/android/trace/sync.h Erik Gilling 2013-02-28 26
5c1401f83a16b7e drivers/staging/android/trace/sync.h Gustavo Padovan 2016-05-31 27 TP_printk("name=%s value=%d", __get_str(name), __entry->value)
b699a644f82110e drivers/staging/android/trace/sync.h Erik Gilling 2013-02-28 28 );
b699a644f82110e drivers/staging/android/trace/sync.h Erik Gilling 2013-02-28 29
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-02 21:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-02 13:54 [PATCH v2] tracing: fix CFI violation in probestub test Eva Kurchatova
2026-06-02 14:33 ` Masami Hiramatsu
2026-06-02 21:40 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox