From: sashiko-bot@kernel.org
To: "Arnaldo Carvalho de Melo" <acme@kernel.org>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 3/5] perf dso: Use stored fd error instead of stale errno in file_read() and file_size()
Date: Thu, 13 Aug 2026 01:00:08 +0000 [thread overview]
Message-ID: <20260813010009.10B691F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260813004927.16738-4-acme@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Missing explicit inclusion of `<assert.h>` for the newly added `assert()` calls, violating musl libc compatibility guidelines.
--
--- Patch [3]: [PATCH 3/5] perf dso: Use stored fd error instead of stale errno in file_read() and file_size() ---
commit 9359e4a3d3517acb5c94e232e0f7e3c94b3a7824
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
perf dso: Use stored fd error instead of stale errno in file_read() and file_size()
This commit updates file_read() and file_size() to use the negative fd value
as the error code directly instead of relying on errno. This prevents issues
where a stale errno could incorrectly appear as an EOF rather than an open
failure.
> diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
> index 124193453675c..c7fb9e1d07f14 100644
> --- a/tools/perf/util/dso.c
> +++ b/tools/perf/util/dso.c
> @@ -1029,7 +1029,9 @@ static ssize_t file_read(struct dso *dso, struct machine *machine,
>
> if (dso__data(dso)->fd < 0) {
> dso__data(dso)->status = DSO_DATA_STATUS_ERROR;
> - ret = -errno;
> + /* fd is always negative here: -errno or -1, never 0 */
> + ret = dso__data(dso)->fd;
> + assert(ret < 0);
[Severity: Low]
Does this missing include break musl libc compatibility?
The perf subsystem guidelines require explicit inclusion of POSIX standard
headers for any libc macros used. Could you add the <assert.h> header at the
top of tools/perf/util/dso.c to ensure this compiles properly under musl?
> goto out;
> }
[ ... ]
> @@ -1151,8 +1153,10 @@ static int file_size(struct dso *dso, struct machine *machine)
> try_to_open_dso(dso, machine);
>
> if (dso__data(dso)->fd < 0) {
> - ret = -errno;
> dso__data(dso)->status = DSO_DATA_STATUS_ERROR;
> + /* fd is always negative here: -errno or -1, never 0 */
> + ret = dso__data(dso)->fd;
> + assert(ret < 0);
[Severity: Low]
Is it possible to ensure <assert.h> is included for this usage as well?
> goto out;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260813004927.16738-1-acme@kernel.org?part=3
next prev parent reply other threads:[~2026-08-13 1:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 0:49 [PATCHES v4 0/5] perf DSO hardening series Arnaldo Carvalho de Melo
2026-08-13 0:49 ` [PATCH 1/5] perf dso: Guard against errno==0 when dso__get_filename() returns NULL Arnaldo Carvalho de Melo
2026-08-13 1:04 ` sashiko-bot
2026-08-13 0:49 ` [PATCH 2/5] perf dso: Guard close() against invalid fd in dso__decompress_kmodule_path() Arnaldo Carvalho de Melo
2026-08-13 0:54 ` sashiko-bot
2026-08-13 0:49 ` [PATCH 3/5] perf dso: Use stored fd error instead of stale errno in file_read() and file_size() Arnaldo Carvalho de Melo
2026-08-13 1:00 ` sashiko-bot [this message]
2026-08-13 0:49 ` [PATCH 4/5] perf dso: Guard against cache underflow on short reads in dso_cache__memcpy() Arnaldo Carvalho de Melo
2026-08-13 0:58 ` sashiko-bot
2026-08-13 0:49 ` [PATCH 5/5] perf dso: Replace assert with runtime check in dso__read_symbol() Arnaldo Carvalho de Melo
2026-08-13 0:59 ` sashiko-bot
-- strict thread matches above, loose matches on Subject: below --
2026-08-11 17:51 [PATCHES v3 0/5] perf DSO hardening series Arnaldo Carvalho de Melo
2026-08-11 17:51 ` [PATCH 3/5] perf dso: Use stored fd error instead of stale errno in file_read() and file_size() Arnaldo Carvalho de Melo
2026-08-12 23:12 ` Ian Rogers
2026-08-13 2:25 ` Namhyung Kim
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=20260813010009.10B691F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=acme@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.