]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
perf symbol-minimal: Fix ehdr reading in filename__read_build_id
authorIan Rogers <irogers@google.com>
Sat, 23 Aug 2025 00:00:23 +0000 (17:00 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Sep 2025 14:55:30 +0000 (16:55 +0200)
commit8d947540ee118ae3bdb14888c7d989580ffc8b35
tree2d3cc0bba232a7b5ff79fa745391fa8fceff86a8
parentfbd4cf7ee4db65ef36796769fe978e9eba6f0de4
perf symbol-minimal: Fix ehdr reading in filename__read_build_id

[ Upstream commit ba0b7081f7a521d7c28b527a4f18666a148471e7 ]

The e_ident is part of the ehdr and so reading it a second time would
mean the read ehdr was displaced by 16-bytes. Switch from stdio to
open/read/lseek syscalls for similarity with the symbol-elf version of
the function and so that later changes can alter then open flags.

Fixes: fef8f648bb47 ("perf symbol: Fix use-after-free in filename__read_build_id")
Signed-off-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20250823000024.724394-2-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/perf/util/symbol-minimal.c