From: Namhyung Kim <namhyung@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v4 06/10] perf tools: Factor out dso__find_binary_type()
Date: Mon, 12 Oct 2026 23:11:56 -0700 [thread overview]
Message-ID: <as3LrGychTiScvBE@z2> (raw)
In-Reply-To: <sashiko-outbox-168759@kernel.org>
On Mon, Oct 12, 2026 at 11:58:48PM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] perf: spurious FD-eviction and DSO failure due to uninitialized errno
> --
>
> commit 00af7deeab2857b031fe6b82dcee452b2fe4afb8
> Author: Namhyung Kim <namhyung@kernel.org>
>
> perf tools: Factor out dso__find_binary_type()
>
> This commit separates out the logic to detect the binary type of a DSO by
> checking if the candidate file contains a .text section. It ignores
> data-only DSOs and adds handling to retry with the DSO data open lock if the
> search fails due to hitting the open file limit.
>
> > diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
> > index 913877b84b2d4..c42ad0c5c66a7 100644
> > --- a/tools/perf/util/dso.c
> > +++ b/tools/perf/util/dso.c
> [ ... ]
> > + do {
> > + dso__set_binary_type(dso, binary_type_data[i++]);
> >
> > - dso_data->fd = open_dso(dso, machine);
> > - if (dso_data->fd >= 0)
> > - goto out;
> > + path = dso__get_filename(dso, "", &decomp, dso__binary_type(dso));
> > + if (path == NULL) {
> > + if (errno == EMFILE)
> > + goto open_err;
>
> [Severity: Medium]
> Could this lead to spurious FD evictions and failure to find the binary type
> if errno is already EMFILE from a prior, unrelated operation?
>
> If dso__get_filename() returns NULL for a normal reason (such as a missing
> build-id cache) without touching errno, it appears a stale EMFILE would cause
> an early abort to the open_err label.
>
> Since the caller __dso__find_binary_type() evicts a DSO and retries up to 3
> times, and errno would remain EMFILE across those retries, it seems this might
> permanently mark the DSO binary type as NOT_FOUND.
>
> Would it make sense to clear errno before calling dso__get_filename()?
Ok, I'll add that too.
Thanks,
Namhyung
>
> > + continue;
> > + }
> > +
> > + errno = 0;
> > + found = filename__has_section(path, ".text");
> [ ... ]
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20261012234654.60666-1-namhyung@kernel.org?part=6
next prev parent reply other threads:[~2026-10-13 6:11 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-12 23:46 [PATCH v4 00/10] perf symbol: Properly seto DSO binary/symtab types Namhyung Kim
2026-10-12 23:46 ` [PATCH v4 01/10] perf tools: Remove redundant dso data init Namhyung Kim
2026-10-12 23:50 ` sashiko-bot
2026-10-12 23:46 ` [PATCH v4 02/10] perf tools: Try linked debug files for DSO debug info Namhyung Kim
2026-10-12 23:56 ` sashiko-bot
2026-10-13 6:08 ` Namhyung Kim
2026-10-12 23:46 ` [PATCH v4 03/10] perf symbol: Update symtab type of vmlinux from build-id cache Namhyung Kim
2026-10-12 23:52 ` sashiko-bot
2026-10-12 23:46 ` [PATCH v4 04/10] perf symbol: Set binary/symtab type for split kallsyms Namhyung Kim
2026-10-12 23:53 ` sashiko-bot
2026-10-12 23:46 ` [PATCH v4 05/10] perf symbol: Get rid of machine_or_dso_e_machine() Namhyung Kim
2026-10-13 0:03 ` sashiko-bot
2026-10-12 23:46 ` [PATCH v4 06/10] perf tools: Factor out dso__find_binary_type() Namhyung Kim
2026-10-12 23:58 ` sashiko-bot
2026-10-13 6:11 ` Namhyung Kim [this message]
2026-10-12 23:46 ` [PATCH v4 07/10] perf symbol: Set binary type for JIT map DSOs Namhyung Kim
2026-10-12 23:59 ` sashiko-bot
2026-10-12 23:46 ` [PATCH v4 08/10] perf symbol: Do not set binary type from symtab type Namhyung Kim
2026-10-13 0:08 ` sashiko-bot
2026-10-13 6:18 ` Namhyung Kim
2026-10-12 23:46 ` [PATCH v4 09/10] perf annotate: Simplify symbol__disassemble() with dso binary_type Namhyung Kim
2026-10-13 0:06 ` sashiko-bot
2026-10-12 23:46 ` [PATCH v4 10/10] perf test: Fix dso data tests Namhyung Kim
2026-10-13 0:06 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=as3LrGychTiScvBE@z2 \
--to=namhyung@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox