[PATCH v2 1/2] tracepoint-update: do not reuse section pointers from a previous file
From: Leizhen Zhang
Date: Thu Oct 08 2026 - 12:47:16 EST
check_data_sec and tracepoint_data_sec are static and set while scanning
the section headers in process_tracepoints(), but are never reset. When
tracepoint-update is given several files and a later file lacks these
sections, the pointers from the previous, already unmapped file are
used, which crashes:
$ scripts/tracepoint-update --module a.o c.o
AddressSanitizer: SEGV ...
Reset both pointers at the start of process_tracepoints().
Kbuild currently passes a single file per invocation, so this does not
affect normal builds.
Fixes: e30f8e61e251 ("tracing: Add a tracepoint verification check at build time")
Assisted-by: Claude:claude-opus-5-5 ASan UBSan
Signed-off-by: Leizhen Zhang <lzsx618@xxxxxxxxx>
---
v2:
- Use my real name in the From and Signed-off-by lines. No code
changes.
v1: https://lore.kernel.org/r/20261005104200.1787946-1-lzsx618@xxxxxxxxx
scripts/tracepoint-update.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/scripts/tracepoint-update.c b/scripts/tracepoint-update.c
index 5cf43c0aac..4c4b669011 100644
--- a/scripts/tracepoint-update.c
+++ b/scripts/tracepoint-update.c
@@ -163,6 +163,10 @@ static int process_tracepoints(bool mod, void *addr, const char *fname)
int idx;
int done = 2;
+ /* Do not use the sections of a previously processed file */
+ check_data_sec = NULL;
+ tracepoint_data_sec = NULL;
+
shdr_start = (Elf_Shdr *)((char *)ehdr + ehdr_shoff(ehdr));
shentsize = ehdr_shentsize(ehdr);
--
2.34.1