[for-next][PATCH 08/15] tracing/scripts: Do not reuse section pointers from a previous file in tracing-update
From: Steven Rostedt
Date: Thu Nov 26 2026 - 11:25:13 EST
From: Leizhen Zhang <lzsx618@xxxxxxxxx>
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.
Link: https://patch.msgid.link/20261008164117.3670267-1-lzsx618@xxxxxxxxx
Assisted-by: Claude:claude-opus-5-5 ASan UBSan
Signed-off-by: Leizhen Zhang <lzsx618@xxxxxxxxx>
Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
---
scripts/tracepoint-update.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/scripts/tracepoint-update.c b/scripts/tracepoint-update.c
index c70c0b076554..ad5f691c150c 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.53.0