diff options
| author | HyeongJun An <sammiee5311@gmail.com> | 2026-07-24 11:53:22 +0900 |
|---|---|---|
| committer | Mathieu Poirier <mathieu.poirier@linaro.org> | 2026-08-31 10:55:23 -0600 |
| commit | b32177ead5f8925aa66ceed2bd533a85196f4f0c (patch) | |
| tree | 77e27b3648dc6e540543f8d9630709512fc63d82 /tools/perf/scripts/python/bin/stackcollapse-record | |
| parent | f559ef6316971fe39dc5f5edd6a483429ba03768 (diff) | |
| download | linux-next-b32177ead5f8925aa66ceed2bd533a85196f4f0c.tar.gz linux-next-b32177ead5f8925aa66ceed2bd533a85196f4f0c.zip | |
remoteproc: elf_loader: Bound the section header table
The rproc_elf_sanity_check() only checks the image is big enough to hold
one section header. But find_table() walks e_shnum of them, and first
dereferences the header at e_shstrndx to locate the section name table.
Both fields are u16 and both come from the image, so an e_shstrndx of
65535 reads about 4 MB past the buffer.
The commit 9f9967fed9d0 ("soc: qcom: mdt_loader: Ensure we don't read
past the ELF header") added the same check to the MDT loader, and says
the header "is sanitized beforehand" under remoteproc. That is what this
patch makes true.
Check e_shoff against the image size first, so the two bounds can use
size_add() without an e_shoff above SIZE_MAX wrapping on 32-bit. The
bounds are separate because e_shnum may be zero while find_table() still
reads the e_shstrndx header.
Fixes: 400e64df6b23 ("remoteproc: add framework for controlling remote processors")
Cc: stable@vger.kernel.org
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: HyeongJun An <sammiee5311@gmail.com>
Link: https://lore.kernel.org/r/20260724025322.2341205-1-sammiee5311@gmail.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Diffstat (limited to 'tools/perf/scripts/python/bin/stackcollapse-record')
0 files changed, 0 insertions, 0 deletions
