Re: [PATCH v10 18/30] tracing: Check for undefined symbols in simple_ring_buffer
From: Steven Rostedt <rostedt@goodmis.org>
Date: 2026-01-29 17:33:26
Also in:
kvmarm, linux-arm-kernel, lkml
From: Steven Rostedt <rostedt@goodmis.org>
Date: 2026-01-29 17:33:26
Also in:
kvmarm, linux-arm-kernel, lkml
On Mon, 26 Jan 2026 10:44:07 +0000 Vincent Donnefort [off-list ref] wrote:
The simple_ring_buffer implementation must remain simple enough to be used by the pKVM hypervisor. Prevent the object build if unresolved symbols are found. Signed-off-by: Vincent Donnefort <redacted>
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org> -- Steve
diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile index 9e86c43bf320..9f675d5d27c7 100644 --- a/kernel/trace/Makefile +++ b/kernel/trace/Makefile@@ -131,4 +131,20 @@ obj-$(CONFIG_TRACE_REMOTE) += trace_remote.o obj-$(CONFIG_SIMPLE_RING_BUFFER) += simple_ring_buffer.o obj-$(CONFIG_TRACE_REMOTE_TEST) += remote_test.o +# +# simple_ring_buffer is used by the pKVM hypervisor which does not have access +# to all kernel symbols. Fail the build if forbidden symbols are found. +# +UNDEFINED_ALLOWLIST := memset alt_cb_patch_nops __x86 __ubsan __asan __kasan __gcov __aeabi_unwind +UNDEFINED_ALLOWLIST += __stack_chk_fail stackleak_track_stack __ref_stack __sanitizer +UNDEFINED_ALLOWLIST := $(addprefix -e , $(UNDEFINED_ALLOWLIST)) + +quiet_cmd_check_undefined = NM $< + cmd_check_undefined = test -z "`$(NM) -u $< | grep -v $(UNDEFINED_ALLOWLIST)`" + +$(obj)/%.o.checked: $(obj)/%.o FORCE + $(call if_changed,check_undefined) + +always-$(CONFIG_SIMPLE_RING_BUFFER) += simple_ring_buffer.o.checked + libftrace-y := ftrace.o