From: Namhyung Kim <namhyung@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v2 3/4] perf symbol: Set dso symtab type for libbfd
Date: Mon, 12 Oct 2026 12:36:00 -0700 [thread overview]
Message-ID: <as02oPr4pZWF4oM7@google.com> (raw)
In-Reply-To: <sashiko-outbox-167684@kernel.org>
On Mon, Oct 12, 2026 at 05:40:08AM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] perf symbol: incomplete dso state initialization for libbfd causing annotate/unwind failure
> --
>
> commit 5475c2801d673496a1fee31f44ca921eca39f20c
> Author: Namhyung Kim <namhyung@kernel.org>
>
> perf symbol: Set dso symtab type for libbfd
>
> It missed to set the dso symtab type when the symbols are loaded by
> libbfd. When it happens both syms_ss and runtime_ss may not be set
> and won't call dso__load_sym().
>
> > diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> > index 4878d4292eb85..a90ce714b174b 100644
> > --- a/tools/perf/util/symbol.c
> > +++ b/tools/perf/util/symbol.c
> > @@ -1925,6 +1925,7 @@ int dso__load(struct dso *dso, struct map *map)
> > nsinfo__mountns_enter(dso__nsinfo(dso), &nsc);
> >
> > if (bfdrc > 0) {
> > + dso__set_symtab_type(dso, symtab_type);
>
> [Severity: Medium]
> When dso__load() takes this early exit to out_destroy, it bypasses the rest
> of the loop which normally initializes symsrc_filename and binary_type:
>
> if (!syms_ss && symsrc__has_symtab(ss)) {
> syms_ss = ss;
> next_slot = true;
> if (!dso__symsrc_filename(dso))
> dso__set_symsrc_filename(dso, strdup(name));
> }
> ...
> if (next_slot) {
> ...
> if (dso__binary_type(dso) == DSO_BINARY_TYPE__NOT_FOUND || ... )
> dso__set_binary_type(dso, symtab_type);
>
> Does skipping these initializations leave the DSO's binary_type as
> DSO_BINARY_TYPE__NOT_FOUND?
>
> If so, could this cause perf annotate to fail later on, since
> symbol__disassemble() checks for this exact condition and returns an error?
This is what I'm working on in another patchset. It'd be totally fine
not to set symsrc_filename and binary_type with that change.
Thanks,
Namhyung
>
> tools/perf/util/disasm.c:symbol__disassemble()
> ...
> if (dso__binary_type(dso) == DSO_BINARY_TYPE__NOT_FOUND) {
> return SYMBOL_ANNOTATE_ERRNO__COULDNT_DETERMINE_FILE_TYPE;
> }
> ...
>
> > ret = 1;
> > goto out_destroy;
> > }
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20261012053013.14378-1-namhyung@kernel.org?part=3
next prev parent reply other threads:[~2026-10-12 19:36 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-12 5:30 [PATCH v2 1/4] perf symbol: Fix symbol loading from libbfd Namhyung Kim
2026-10-12 5:30 ` [PATCH v2 2/4] perf symbol: Add missing symsrc__destroy() for libbfd Namhyung Kim
2026-10-12 5:36 ` sashiko-bot
2026-10-12 21:53 ` Ian Rogers
2026-10-12 5:30 ` [PATCH v2 3/4] perf symbol: Set dso symtab type " Namhyung Kim
2026-10-12 5:40 ` sashiko-bot
2026-10-12 19:36 ` Namhyung Kim [this message]
2026-10-12 5:30 ` [PATCH v2 4/4] perf test: Update PE file test for other locations Namhyung Kim
2026-10-12 5:38 ` sashiko-bot
2026-10-12 19:42 ` Namhyung Kim
2026-10-12 21:51 ` Ian Rogers
2026-10-12 23:06 ` Namhyung Kim
2026-10-12 23:11 ` Ian Rogers
2026-10-12 23:37 ` Namhyung Kim
2026-10-12 5:37 ` [PATCH v2 1/4] perf symbol: Fix symbol loading from libbfd sashiko-bot
2026-10-12 21:52 ` Ian Rogers
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=as02oPr4pZWF4oM7@google.com \
--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 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.