Skip to contentSkip to conversation

tracing: ring-buffer: allowlist clang-generated symbols

PATCH In review Arnd Bergmann 5 participants 5 messages Jun 16 – Jul 15 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tracing: ring-buffer: allowlist clang-generated symbols

From: Arnd Bergmann <[email protected]>

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.

---
 kernel/trace/Makefile | 1 +
 1 file changed, 1 insertion(+)
kernel/trace/Makefile +1 -0
index f934ff586bd4..aa8564fb8ff4 100644
@@ -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      $<
Signature · 1 line
2.39.5
#1 lore raw

kernel/trace/Makefile KASAN_SANITIZE_undefsyms_base.o := y

Quoted 29 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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.

---
 kernel/trace/Makefile | 1 +
 1 file changed, 1 insertion(+)
kernel/trace/Makefile +0 -0
index f934ff586bd4..aa8564fb8ff4 100644
@@ -146,6 +146,7 @@ KASAN_SANITIZE_undefsyms_base.o := y

Would "GCOV_PROFILE_undefsyms_base.o := y" work?

Quoted 10 lines
kernel/trace/Makefile +1 -0
 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      $<
Signature · 1 line
2.39.5
maintainer
#2 lore raw
Quoted 25 lines · On Wed, 17 Jun 2026 14:26:36 +0100 Vincent Donnefort <[email protected]>…
Quoted 24 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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.

---
 kernel/trace/Makefile | 1 +
 1 file changed, 1 insertion(+)
Quoted 7 lines

kernel/trace/Makefile KASAN_SANITIZE_undefsyms_base.o := y

Quoted 5 lines
kernel/trace/Makefile +0 -0
index f934ff586bd4..aa8564fb8ff4 100644
@@ -146,6 +146,7 @@ KASAN_SANITIZE_undefsyms_base.o := y  

Would "GCOV_PROFILE_undefsyms_base.o := y" work?

Arnd?

-- Steve

Quoted 11 lines
Quoted 11 lines
kernel/trace/Makefile +1 -0
 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      $<
Signature · 1 line
2.39.5
#3 lore raw
Quoted 35 lines · Steven Rostedt
Quoted 25 lines · On Wed, 17 Jun 2026 14:26:36 +0100 Vincent Donnefort <[email protected]>…
Quoted 24 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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.

---
 kernel/trace/Makefile | 1 +
 1 file changed, 1 insertion(+)
Quoted 7 lines

kernel/trace/Makefile KASAN_SANITIZE_undefsyms_base.o := y

Quoted 5 lines
kernel/trace/Makefile +0 -0
index f934ff586bd4..aa8564fb8ff4 100644
@@ -146,6 +146,7 @@ KASAN_SANITIZE_undefsyms_base.o := y  

Would "GCOV_PROFILE_undefsyms_base.o := y" work?

Quoted 1 line

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

#4 lore raw
Quoted 36 lines · Arnd Bergmann
Quoted 35 lines · Steven Rostedt
Quoted 32 lines · On Wed, 17 Jun 2026 14:26:36 +0100 Vincent Donnefort <[email protected]>…

kernel/trace/Makefile KASAN_SANITIZE_undefsyms_base.o := y

Quoted 29 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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.

---
 kernel/trace/Makefile | 1 +
 1 file changed, 1 insertion(+)
kernel/trace/Makefile +0 -0
index f934ff586bd4..aa8564fb8ff4 100644
@@ -146,6 +146,7 @@ KASAN_SANITIZE_undefsyms_base.o := y  

Would "GCOV_PROFILE_undefsyms_base.o := y" work?

Quoted 4 lines
Quoted 1 line

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.

Quoted 5 lines

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.

Signature · 2 lines
Cheers,
Nathan