From: Namhyung Kim <namhyung@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v1 7/7] perf symbol: Do not set binary type from symtab type
Date: Mon, 5 Oct 2026 23:30:06 -0700 [thread overview]
Message-ID: <asSVbjUvlehbLUwT@z2> (raw)
In-Reply-To: <20261005064531.2BD9B1F000FF@smtp.kernel.org>
On Mon, Oct 05, 2026 at 06:45:30AM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] perf: `perf annotate` and guest module data read broken by missing `binary_type`
> --
>
> commit 7196d300589913af007226f7522345f0d46a1af3
> Author: Namhyung Kim <namhyung@kernel.org>
>
> perf symbol: Do not set binary type from symtab type
>
> The commit separates DSO binary type from symtab type and removes the
> logic that sets the binary type from the symtab type in dso__load.
>
> > diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> > index 389dbd7e5192f..1175cb60f8206 100644
> > --- a/tools/perf/util/symbol.c
> > +++ b/tools/perf/util/symbol.c
> > @@ -1956,19 +1956,6 @@ int dso__load(struct dso *dso, struct map *map)
> >
> > if (next_slot) {
> > ss_pos++;
> > -
> > - /*
> > - * The binary type is used to find the file containing
> > - * the executed instructions, so prefer the types that
> > - * refer to the actual object over debug-only files such
> > - * as DSO_BINARY_TYPE__DEBUGLINK.
> > - */
> > - if (dso__binary_type(dso) == DSO_BINARY_TYPE__NOT_FOUND ||
> > - symtab_type == DSO_BINARY_TYPE__BUILD_ID_CACHE ||
> > - (symtab_type == DSO_BINARY_TYPE__SYSTEM_PATH_DSO &&
> > - dso__binary_type(dso) != DSO_BINARY_TYPE__BUILD_ID_CACHE))
> > - dso__set_binary_type(dso, symtab_type);
> > -
>
> [Severity: Medium]
> Will this removal cause perf annotate and guest module data reads to fail?
I'm not sure if perf annotate would work well for guest modules.
>
> Without this logic, binary_type defaults to DSO_BINARY_TYPE__NOT_FOUND
> for generic DSOs, guest kernel modules, or binaries using debuginfo/system
> paths.
>
> When tools/perf/util/dso.c:try_to_open_dso() is later called to read data,
> it only iterates over BUILD_ID_CACHE and SYSTEM_PATH_DSO when the binary
> type is NOT_FOUND, completely ignoring guest-specific paths that require
> machine->root_dir:
>
> enum dso_binary_type binary_type_data[] = {
> DSO_BINARY_TYPE__BUILD_ID_CACHE,
> DSO_BINARY_TYPE__SYSTEM_PATH_DSO,
> DSO_BINARY_TYPE__NOT_FOUND,
> };
I believe guest modules always need machine->root_dir to access the
file. It won't get the correct file contents without it so the current
code didn't work well.
>
> Additionally, tools/perf/util/disasm.c:symbol__disassemble() explicitly
> returns an error if binary_type remains unset:
>
> if (dso__binary_type(dso) == DSO_BINARY_TYPE__NOT_FOUND) {
> return SYMBOL_ANNOTATE_ERRNO__COULDNT_DETERMINE_FILE_TYPE;
> }
>
> Does this unintentionally break disassembly for binaries not in the
> build-id cache, or binary data reads for guest kernel modules?
As I said in other reply, it should be updated to use binary type of the
dso. I'll update the code in v2.
Thanks,
Namhyung
prev parent reply other threads:[~2026-10-06 6:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-05 6:34 [PATCH v1 0/7] perf symbol: Properly set DSO binary/symtab types Namhyung Kim
2026-10-05 6:34 ` [PATCH v1 1/7] perf tools: Remove redundant dso data init Namhyung Kim
2026-10-05 6:39 ` sashiko-bot
2026-10-05 6:34 ` [PATCH v1 2/7] perf tools: Try linked debug files for DSO debug info Namhyung Kim
2026-10-05 6:43 ` sashiko-bot
2026-10-05 6:34 ` [PATCH v1 3/7] perf symbol: Update symtab type of vmlinux from build-id cache Namhyung Kim
2026-10-05 6:40 ` sashiko-bot
2026-10-05 6:34 ` [PATCH v1 4/7] perf symbol: Set binary/symtab type for split kallsyms Namhyung Kim
2026-10-05 6:40 ` sashiko-bot
2026-10-05 6:34 ` [PATCH v1 5/7] perf symbol: Set dso symtab type for libbfd Namhyung Kim
2026-10-05 6:43 ` sashiko-bot
2026-10-05 6:34 ` [PATCH v1 6/7] perf symbol: Set binary type for JIT map DSOs Namhyung Kim
2026-10-05 6:46 ` sashiko-bot
2026-10-06 6:05 ` Namhyung Kim
2026-10-05 6:34 ` [PATCH v1 7/7] perf symbol: Do not set binary type from symtab type Namhyung Kim
2026-10-05 6:45 ` sashiko-bot
2026-10-06 6:30 ` Namhyung Kim [this message]
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=asSVbjUvlehbLUwT@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