Re: [PATCH 0/5] elf-parse: validate what the host ELF tools read from the file
From: Steven Rostedt
Date: Mon Oct 19 2026 - 09:02:14 EST
On Sun, 18 Oct 2026 19:02:13 -0500
Leizhen Zhang <lzsx618@xxxxxxxxx> wrote:
> scripts/elf-parse.c takes the section header table, the section indices and
> the symbol table straight out of the file it maps, without checking any of
> them against the mapping. All three users -- kallsyms, sorttable and
> tracepoint-update -- then index with those values, so a truncated or
> corrupted object file makes the tools read outside the mapping, allocate
> from a file-supplied count, or divide by zero instead of printing an error.
>
> These are build-time tools fed by the local toolchain, so under
> Documentation/process/threat-model.rst this looks like a robustness problem
> rather than a vulnerability: reaching it takes a corrupt or hostile object
> in the build tree. I am leaving that classification for you to review.
Definitely not a security threat here. If the object files are corrupted,
then this is not where you should be detecting it. Unless we change the
purpose of this tool as a corruption detector, this code *expects* the
input to not be corrupt. The reasons for checking various ELF header info
is if someone is porting this code to a new architecture where it doesn't
support it yet, we want to warn.
I'm fine with adding robustness, but not complexity for an issue that
should never exist.
-- Steve