From: sashiko-bot@kernel.org
To: "Rong Bao" <rong.bao@csmantle.top>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH] perf annotate: Use jump__delete when freeing LoongArch jumps
Date: Sun, 12 Apr 2026 07:17:18 +0000 [thread overview]
Message-ID: <20260412071719.5B339C19424@smtp.kernel.org> (raw)
In-Reply-To: <20260412062828.1734637-1-rong.bao@csmantle.top>
Sashiko AI review found 1 potential issue(s):
- [High] Missing NULL check in `loongarch_call__parse()` causes a segmentation fault on malformed or stripped objdump output.
--
commit 031fe3089ac82ebce8ac1cc8c2f144a5b6abd009
Author: Rong Bao <rong.bao@csmantle.top>
perf annotate: Use jump__delete when freeing LoongArch jumps
This commit fixes an invalid free crash in perf annotate for LoongArch by
assigning jump__delete to the .free field in loongarch_jump_ops. This prevents
fields that share the same buffer from being erroneously freed during cleanup.
> diff --git a/tools/perf/util/annotate-arch/annotate-loongarch.c b/tools/perf/util/annotate-arch/annotate-loongarch.c
> index 950f34e59e5cd..c2addca77320b 100644
> --- a/tools/perf/util/annotate-arch/annotate-loongarch.c
> +++ b/tools/perf/util/annotate-arch/annotate-loongarch.c
> @@ -110,6 +110,7 @@ static int loongarch_jump__parse(const struct arch *arch, struct ins_operands *o
> }
>
> static const struct ins_ops loongarch_jump_ops = {
> + .free = jump__delete,
> .parse = loongarch_jump__parse,
> .scnprintf = jump__scnprintf,
> .is_jump = true,
[ ... ]
While reviewing these changes, I noticed a pre-existing issue in the nearby
loongarch_call__parse() function in the same file:
tools/perf/util/annotate-arch/annotate-loongarch.c:loongarch_call__parse() {
...
ops->target.addr = strtoull(c, &endptr, 16);
name = strchr(endptr, '<');
name++;
if (arch->objdump.skip_functions_char &&
strchr(name, arch->objdump.skip_functions_char))
return -1;
...
}
Could this cause a segmentation fault if the tool processes a stripped
binary?
If the objdump output for a call instruction lacks the <symbol> suffix
(for example, bl #0x12345), strchr(endptr, '<') would return NULL.
The subsequent name++ would then produce an invalid pointer, leading to a crash
when it is used in the following strchr() and strdup() calls.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260412062828.1734637-1-rong.bao@csmantle.top?part=1
next prev parent reply other threads:[~2026-04-12 7:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-12 6:28 [PATCH] perf annotate: Use jump__delete when freeing LoongArch jumps Rong Bao
2026-04-12 7:17 ` sashiko-bot [this message]
2026-04-13 8:33 ` Huacai Chen
2026-04-13 8:49 ` Rong Bao
2026-04-13 9:41 ` Huacai Chen
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=20260412071719.5B339C19424@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=rong.bao@csmantle.top \
--cc=sashiko@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