Linux Trace Kernel
 help / color / mirror / Atom feed
* [PATCH] tracing: ring-buffer: allowlist clang-generated symbols
@ 2026-06-16 16:42 Arnd Bergmann
  2026-06-17 13:26 ` Vincent Donnefort
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2026-06-16 16:42 UTC (permalink / raw)
  To: Steven Rostedt, Masami Hiramatsu, Nathan Chancellor
  Cc: Arnd Bergmann, Mathieu Desnoyers, Nick Desaulniers, Bill Wendling,
	Justin Stitt, Vincent Donnefort, Marc Zyngier,
	Thomas Weißschuh, Paolo Bonzini, linux-kernel,
	linux-trace-kernel, llvm

From: Arnd Bergmann <arnd@arndb.de>

In randconfig build testing using clang-22, I came across two
sets of extra symbols in the ring buffer code that may get
inserted by the compiler:

Unexpected symbols in kernel/trace/simple_ring_buffer.o:
         U memset

Unexpected symbols in kernel/trace/simple_ring_buffer.o:
                 U llvm_gcda_emit_arcs
                 U llvm_gcda_emit_function
                 U llvm_gcda_end_file
                 U llvm_gcda_start_file
                 U llvm_gcda_summary_info
                 U llvm_gcov_init

Add all of these to the allowlist.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 kernel/trace/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile
index f934ff586bd4..aa8564fb8ff4 100644
--- a/kernel/trace/Makefile
+++ b/kernel/trace/Makefile
@@ -146,6 +146,7 @@ KASAN_SANITIZE_undefsyms_base.o := y
 
 UNDEFINED_ALLOWLIST = __asan __gcov __kasan __kcsan __hwasan __sancov __sanitizer __tsan __ubsan __msan \
 		      __aeabi_unwind_cpp __s390_indirect_jump __x86_indirect_thunk simple_ring_buffer \
+		      memset llvm_gcda llvm_gcov \
 		      $(shell $(NM) -u $(obj)/undefsyms_base.o 2>/dev/null | awk '{print $$2}')
 
 quiet_cmd_check_undefined = NM      $<
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] tracing: ring-buffer: allowlist clang-generated symbols
  2026-06-16 16:42 [PATCH] tracing: ring-buffer: allowlist clang-generated symbols Arnd Bergmann
@ 2026-06-17 13:26 ` Vincent Donnefort
  2026-07-14 21:56   ` Steven Rostedt
  0 siblings, 1 reply; 5+ messages in thread
From: Vincent Donnefort @ 2026-06-17 13:26 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Steven Rostedt, Masami Hiramatsu, Nathan Chancellor,
	Arnd Bergmann, Mathieu Desnoyers, Nick Desaulniers, Bill Wendling,
	Justin Stitt, Marc Zyngier, Thomas Weißschuh, Paolo Bonzini,
	linux-kernel, linux-trace-kernel, llvm

On Tue, Jun 16, 2026 at 06:42:03PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> In randconfig build testing using clang-22, I came across two
> sets of extra symbols in the ring buffer code that may get
> inserted by the compiler:
> 
> Unexpected symbols in kernel/trace/simple_ring_buffer.o:
>          U memset
> 
> Unexpected symbols in kernel/trace/simple_ring_buffer.o:
>                  U llvm_gcda_emit_arcs
>                  U llvm_gcda_emit_function
>                  U llvm_gcda_end_file
>                  U llvm_gcda_start_file
>                  U llvm_gcda_summary_info
>                  U llvm_gcov_init
> 
> Add all of these to the allowlist.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  kernel/trace/Makefile | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile
> index f934ff586bd4..aa8564fb8ff4 100644
> --- a/kernel/trace/Makefile
> +++ b/kernel/trace/Makefile
> @@ -146,6 +146,7 @@ KASAN_SANITIZE_undefsyms_base.o := y

Would "GCOV_PROFILE_undefsyms_base.o := y" work?

>  
>  UNDEFINED_ALLOWLIST = __asan __gcov __kasan __kcsan __hwasan __sancov __sanitizer __tsan __ubsan __msan \
>  		      __aeabi_unwind_cpp __s390_indirect_jump __x86_indirect_thunk simple_ring_buffer \
> +		      memset llvm_gcda llvm_gcov \
>  		      $(shell $(NM) -u $(obj)/undefsyms_base.o 2>/dev/null | awk '{print $$2}')
>  
>  quiet_cmd_check_undefined = NM      $<
> -- 
> 2.39.5
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] tracing: ring-buffer: allowlist clang-generated symbols
  2026-06-17 13:26 ` Vincent Donnefort
@ 2026-07-14 21:56   ` Steven Rostedt
  2026-07-15  7:38     ` Arnd Bergmann
  0 siblings, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2026-07-14 21:56 UTC (permalink / raw)
  To: Vincent Donnefort
  Cc: Arnd Bergmann, Masami Hiramatsu, Nathan Chancellor, Arnd Bergmann,
	Mathieu Desnoyers, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Marc Zyngier, Thomas Weißschuh, Paolo Bonzini, linux-kernel,
	linux-trace-kernel, llvm

On Wed, 17 Jun 2026 14:26:36 +0100
Vincent Donnefort <vdonnefort@google.com> wrote:

> On Tue, Jun 16, 2026 at 06:42:03PM +0200, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> > 
> > In randconfig build testing using clang-22, I came across two
> > sets of extra symbols in the ring buffer code that may get
> > inserted by the compiler:
> > 
> > Unexpected symbols in kernel/trace/simple_ring_buffer.o:
> >          U memset
> > 
> > Unexpected symbols in kernel/trace/simple_ring_buffer.o:
> >                  U llvm_gcda_emit_arcs
> >                  U llvm_gcda_emit_function
> >                  U llvm_gcda_end_file
> >                  U llvm_gcda_start_file
> >                  U llvm_gcda_summary_info
> >                  U llvm_gcov_init
> > 
> > Add all of these to the allowlist.
> > 
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> >  kernel/trace/Makefile | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile
> > index f934ff586bd4..aa8564fb8ff4 100644
> > --- a/kernel/trace/Makefile
> > +++ b/kernel/trace/Makefile
> > @@ -146,6 +146,7 @@ KASAN_SANITIZE_undefsyms_base.o := y  
> 
> Would "GCOV_PROFILE_undefsyms_base.o := y" work?

Arnd?

-- Steve

> 
> >  
> >  UNDEFINED_ALLOWLIST = __asan __gcov __kasan __kcsan __hwasan __sancov __sanitizer __tsan __ubsan __msan \
> >  		      __aeabi_unwind_cpp __s390_indirect_jump __x86_indirect_thunk simple_ring_buffer \
> > +		      memset llvm_gcda llvm_gcov \
> >  		      $(shell $(NM) -u $(obj)/undefsyms_base.o 2>/dev/null | awk '{print $$2}')
> >  
> >  quiet_cmd_check_undefined = NM      $<
> > -- 
> > 2.39.5
> >   


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] tracing: ring-buffer: allowlist clang-generated symbols
  2026-07-14 21:56   ` Steven Rostedt
@ 2026-07-15  7:38     ` Arnd Bergmann
  2026-07-15 23:40       ` Nathan Chancellor
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2026-07-15  7:38 UTC (permalink / raw)
  To: Steven Rostedt, Vincent Donnefort
  Cc: Arnd Bergmann, Masami Hiramatsu, Nathan Chancellor,
	Mathieu Desnoyers, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Marc Zyngier, Thomas Weißschuh, Paolo Bonzini, linux-kernel,
	linux-trace-kernel, llvm

On Tue, Jul 14, 2026, at 23:56, Steven Rostedt wrote:
> On Wed, 17 Jun 2026 14:26:36 +0100 Vincent Donnefort <vdonnefort@google.com> wrote:
>
>> On Tue, Jun 16, 2026 at 06:42:03PM +0200, Arnd Bergmann wrote:
>> > From: Arnd Bergmann <arnd@arndb.de>
>> > 
>> > In randconfig build testing using clang-22, I came across two
>> > sets of extra symbols in the ring buffer code that may get
>> > inserted by the compiler:
>> > 
>> > Unexpected symbols in kernel/trace/simple_ring_buffer.o:
>> >          U memset
>> > 
>> > Unexpected symbols in kernel/trace/simple_ring_buffer.o:
>> >                  U llvm_gcda_emit_arcs
>> >                  U llvm_gcda_emit_function
>> >                  U llvm_gcda_end_file
>> >                  U llvm_gcda_start_file
>> >                  U llvm_gcda_summary_info
>> >                  U llvm_gcov_init
>> > 
>> > Add all of these to the allowlist.
>> > 
>> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> > ---
>> >  kernel/trace/Makefile | 1 +
>> >  1 file changed, 1 insertion(+)
>> > 
>> > diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile
>> > index f934ff586bd4..aa8564fb8ff4 100644
>> > --- a/kernel/trace/Makefile
>> > +++ b/kernel/trace/Makefile
>> > @@ -146,6 +146,7 @@ KASAN_SANITIZE_undefsyms_base.o := y  
>> 
>> Would "GCOV_PROFILE_undefsyms_base.o := y" work?
>
> Arnd?

Yes, turning off gcov for this file should avoid the llvm_gcda and
llvm_gcov symbols, but not the memset() symbol.

All the other features that leave annotations are handled by
listing the symbol names (__asan __gcov __kasan __kcsan __hwasan
__sancov __sanitizer __tsan __ubsan __msan), so I think for
consistency it makes sense to treat llvm gcov the same way
we handle gcc gcov and the rest.

      Arnd

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] tracing: ring-buffer: allowlist clang-generated symbols
  2026-07-15  7:38     ` Arnd Bergmann
@ 2026-07-15 23:40       ` Nathan Chancellor
  0 siblings, 0 replies; 5+ messages in thread
From: Nathan Chancellor @ 2026-07-15 23:40 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Steven Rostedt, Vincent Donnefort, Arnd Bergmann,
	Masami Hiramatsu, Mathieu Desnoyers, Nick Desaulniers,
	Bill Wendling, Justin Stitt, Marc Zyngier, Thomas Weißschuh,
	Paolo Bonzini, linux-kernel, linux-trace-kernel, llvm

On Wed, Jul 15, 2026 at 09:38:21AM +0200, Arnd Bergmann wrote:
> On Tue, Jul 14, 2026, at 23:56, Steven Rostedt wrote:
> > On Wed, 17 Jun 2026 14:26:36 +0100 Vincent Donnefort <vdonnefort@google.com> wrote:
> >
> >> On Tue, Jun 16, 2026 at 06:42:03PM +0200, Arnd Bergmann wrote:
> >> > From: Arnd Bergmann <arnd@arndb.de>
> >> > 
> >> > In randconfig build testing using clang-22, I came across two
> >> > sets of extra symbols in the ring buffer code that may get
> >> > inserted by the compiler:
> >> > 
> >> > Unexpected symbols in kernel/trace/simple_ring_buffer.o:
> >> >          U memset
> >> > 
> >> > Unexpected symbols in kernel/trace/simple_ring_buffer.o:
> >> >                  U llvm_gcda_emit_arcs
> >> >                  U llvm_gcda_emit_function
> >> >                  U llvm_gcda_end_file
> >> >                  U llvm_gcda_start_file
> >> >                  U llvm_gcda_summary_info
> >> >                  U llvm_gcov_init
> >> > 
> >> > Add all of these to the allowlist.
> >> > 
> >> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> >> > ---
> >> >  kernel/trace/Makefile | 1 +
> >> >  1 file changed, 1 insertion(+)
> >> > 
> >> > diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile
> >> > index f934ff586bd4..aa8564fb8ff4 100644
> >> > --- a/kernel/trace/Makefile
> >> > +++ b/kernel/trace/Makefile
> >> > @@ -146,6 +146,7 @@ KASAN_SANITIZE_undefsyms_base.o := y  
> >> 
> >> Would "GCOV_PROFILE_undefsyms_base.o := y" work?
> >
> > Arnd?
> 
> Yes, turning off gcov for this file should avoid the llvm_gcda and
> llvm_gcov symbols, but not the memset() symbol.

This would actually turn on GCOV for this translation unit and cause the
llvm_gcda and llvm_gcov symbols to be included in UNDEFINED_ALLOWLIST
via the $(NM) call.

> All the other features that leave annotations are handled by
> listing the symbol names (__asan __gcov __kasan __kcsan __hwasan
> __sancov __sanitizer __tsan __ubsan __msan), so I think for
> consistency it makes sense to treat llvm gcov the same way
> we handle gcc gcov and the rest.

I do tend to agree with this though, as opposed to using
GCOV_PROFILE_... or ..._SANTIZE variables.

-- 
Cheers,
Nathan

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-07-15 23:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-16 16:42 [PATCH] tracing: ring-buffer: allowlist clang-generated symbols Arnd Bergmann
2026-06-17 13:26 ` Vincent Donnefort
2026-07-14 21:56   ` Steven Rostedt
2026-07-15  7:38     ` Arnd Bergmann
2026-07-15 23:40       ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox