From: Namhyung Kim <namhyung@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v1 6/7] perf symbol: Set binary type for JIT map DSOs
Date: Mon, 5 Oct 2026 23:05:12 -0700 [thread overview]
Message-ID: <asSPmK_QgxgE6SON@z2> (raw)
In-Reply-To: <20261005064616.F07241F00893@smtp.kernel.org>
On Mon, Oct 05, 2026 at 06:46:16AM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] perf: annotate regression on JIT map files due to unhandled binary type
> --
>
> commit 79781ef5615895fe2ec492b108f82094b6a0246b
> Author: Namhyung Kim <namhyung@kernel.org>
>
> perf symbol: Set binary type for JIT map DSOs
>
> This commit explicitly sets the binary type of JIT map DSOs to JAVA_JIT. This
> ensures they are identified correctly and bypass attempts to load dso_data,
> as they only contain symbol names and lack binary instructions.
>
> > diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> > --- a/tools/perf/util/symbol.c
> > +++ b/tools/perf/util/symbol.c
> > @@ -1859,6 +1859,7 @@ int dso__load(struct dso *dso, struct map *map)
> >
> > if (perfmap) {
> > ret = dso__load_perf_map(map_path, dso);
> > + dso__set_binary_type(dso, DSO_BINARY_TYPE__JAVA_JIT);
>
> [Severity: Medium]
> Does setting the binary type to DSO_BINARY_TYPE__JAVA_JIT here bypass the
> historical early exit guard in symbol__disassemble()?
>
> Looking at symbol__disassemble() in tools/perf/util/disasm.c, it guards
> against unsupported files with:
>
> if (dso__binary_type(dso) == DSO_BINARY_TYPE__NOT_FOUND) {
> return SYMBOL_ANNOTATE_ERRNO__COULDNT_DETERMINE_FILE_TYPE;
> }
>
> With the type now explicitly set to DSO_BINARY_TYPE__JAVA_JIT, this check
> fails and allows perf annotate to incorrectly attempt disassembling the text
> map file.
>
> The fallback binary disassemblers inevitably fail to parse the text file as
> ELF and return -1. This propagates back to symbol__strerror_disassemble(),
> which handles the -1 return by printing an unhelpful message to the user
> instead of gracefully exiting:
>
> default:
> scnprintf(buf, buflen, "Internal error: Invalid %d error code\n", errnum);
> break;
>
> Should symbol__disassemble() be updated to check for DSO_BINARY_TYPE__JAVA_JIT
> so that it can exit gracefully when users try to annotate a JIT symbol profile?
Ok, but I think the dso__disassemble_filename() should be updated to set
binary type correctly and just use dso__get_filename(). Will do in v2.
Thanks,
Namhyung
next prev parent reply other threads:[~2026-10-06 6:05 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 [this message]
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
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=asSPmK_QgxgE6SON@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 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.