From: sashiko-bot@kernel.org
To: "Namhyung Kim" <namhyung@kernel.org>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH] perf build: Fix compiler errors with old capstone
Date: Wed, 01 Jul 2026 18:38:29 +0000 [thread overview]
Message-ID: <20260701183830.65EA21F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260701182824.347941-1-namhyung@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Defining CS_ARCH_RISCV as CS_ARCH_MAX causes incorrect architecture selection when dynamically loading newer Capstone versions.
--
commit c55db50010b415e5aa95bfca7819cc985aa51d2f
Author: Namhyung Kim <namhyung@kernel.org>
perf build: Fix compiler errors with old capstone
This commit fixes a build error on systems with Capstone versions older than
5 by defining missing RISC-V architecture and mode constants. It uses the
major version macro to conditionally define these symbols.
> diff --git a/tools/perf/util/capstone.c b/tools/perf/util/capstone.c
> index 5ad537fea4360..dd7cd97d0a380 100644
> --- a/tools/perf/util/capstone.c
> +++ b/tools/perf/util/capstone.c
> @@ -24,6 +24,13 @@
> #include "symbol.h"
> #include "thread.h"
>
> +#if CS_VERSION_MAJOR < 5
> +#define CS_ARCH_RISCV CS_ARCH_MAX
[Severity: High]
Does mapping CS_ARCH_RISCV to CS_ARCH_MAX cause ABI compatibility issues?
If perf is compiled against Capstone headers < 5, it will use the integer
value of CS_ARCH_MAX for CS_ARCH_RISCV. If the resulting binary is later run
on a system where libcapstone.so has been upgraded to version 5+, passing
this hardcoded value to cs_open() might silently initialize a completely
different architecture that was appended to the enum in V5 (such as WASM or
BPF).
Could this result in cs_open() succeeding but silently producing garbage
disassembly for RISC-V targets?
> +#define CS_MODE_RISCV32 1
> +#define CS_MODE_RISCV64 2
> +#define CS_MODE_RISCVC 4
> +#endif
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260701182824.347941-1-namhyung@kernel.org?part=1
next prev parent reply other threads:[~2026-07-01 18:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 18:28 [PATCH] perf build: Fix compiler errors with old capstone Namhyung Kim
2026-07-01 18:38 ` sashiko-bot [this message]
2026-07-01 19:26 ` Namhyung Kim
2026-07-01 18:49 ` Ian Rogers
2026-07-01 19:30 ` Namhyung Kim
2026-07-01 23:39 ` Ian Rogers
2026-07-03 20:51 ` 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=20260701183830.65EA21F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=namhyung@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.