diff options
| author | Ian Rogers <irogers@google.com> | 2025-08-22 17:00:24 -0700 |
|---|---|---|
| committer | Namhyung Kim <namhyung@kernel.org> | 2025-08-25 15:07:18 -0700 |
| commit | 2c369d91d0933aaff96b6b807b22363e6a38a625 (patch) | |
| tree | e22a6006aa6771373c892470e3516da2e2292404 /tools/perf/util/debuginfo.c | |
| parent | ba0b7081f7a521d7c28b527a4f18666a148471e7 (diff) | |
| download | lwn-2c369d91d0933aaff96b6b807b22363e6a38a625.tar.gz lwn-2c369d91d0933aaff96b6b807b22363e6a38a625.zip | |
perf symbol: Add blocking argument to filename__read_build_id
When synthesizing build-ids, for build ID mmap2 events, they will be
added for data mmaps if -d/--data is specified. The files opened for
their build IDs may block on the open causing perf to hang during
synthesis. There is some robustness in existing calls to
filename__read_build_id by checking the file path is to a regular
file, which unfortunately fails for symlinks. Rather than adding more
is_regular_file calls, switch filename__read_build_id to take a
"block" argument and specify O_NONBLOCK when this is false. The
existing is_regular_file checking callers and the event synthesis
callers are made to pass false and thereby avoiding the hang.
Fixes: 53b00ff358dc ("perf record: Make --buildid-mmap the default")
Signed-off-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20250823000024.724394-3-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools/perf/util/debuginfo.c')
| -rw-r--r-- | tools/perf/util/debuginfo.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/perf/util/debuginfo.c b/tools/perf/util/debuginfo.c index a44c70f93156..bb9ebd84ec2d 100644 --- a/tools/perf/util/debuginfo.c +++ b/tools/perf/util/debuginfo.c @@ -110,8 +110,12 @@ struct debuginfo *debuginfo__new(const char *path) if (!dso) goto out; - /* Set the build id for DSO_BINARY_TYPE__BUILDID_DEBUGINFO */ - if (is_regular_file(path) && filename__read_build_id(path, &bid) > 0) + /* + * Set the build id for DSO_BINARY_TYPE__BUILDID_DEBUGINFO. Don't block + * incase the path isn't for a regular file. + */ + assert(!dso__has_build_id(dso)); + if (filename__read_build_id(path, &bid, /*block=*/false) > 0) dso__set_build_id(dso, &bid); for (type = distro_dwarf_types; |
