]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
perf tools: Don't read build-ids from non-regular files
authorJames Clark <james.clark@linaro.org>
Mon, 24 Nov 2025 10:59:08 +0000 (10:59 +0000)
committerNamhyung Kim <namhyung@kernel.org>
Wed, 26 Nov 2025 18:13:38 +0000 (10:13 -0800)
commit834ebb5678d75d844f5d4f44ede78724d8c96630
tree5fb8b2822b690d6fbd2c5da826b08d816e6a4134
parentc9573287729bc5ed3d2adbc028fe33d265917ae5
perf tools: Don't read build-ids from non-regular files

Simplify the build ID reading code by removing the non-blocking option.
Having to pass the correct option to this function was fragile and a
mistake would result in a hang, see the linked fix. Furthermore,
compressed files are always opened blocking anyway, ignoring the
non-blocking option.

We also don't expect to read build IDs from non-regular files. The only
hits to this function that are non-regular are devices that won't be elf
files with build IDs, for example "/dev/dri/renderD129".

Now instead of opening these as non-blocking and failing to read, we
skip them. Even if something like a pipe or character device did have a
build ID, I don't think it would have worked because you need to call
read() in a loop, check for -EAGAIN and handle timeouts to make
non-blocking reads work.

Link: https://lore.kernel.org/linux-perf-users/20251022-james-perf-fix-dso-block-v1-1-c4faab150546@linaro.org/
Signed-off-by: James Clark <james.clark@linaro.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
15 files changed:
tools/perf/bench/inject-buildid.c
tools/perf/builtin-buildid-cache.c
tools/perf/builtin-inject.c
tools/perf/tests/pe-file-parsing.c
tools/perf/tests/sdt.c
tools/perf/util/build-id.c
tools/perf/util/debuginfo.c
tools/perf/util/dsos.c
tools/perf/util/libbfd.c
tools/perf/util/libbfd.h
tools/perf/util/symbol-elf.c
tools/perf/util/symbol-minimal.c
tools/perf/util/symbol.c
tools/perf/util/symbol.h
tools/perf/util/synthetic-events.c