lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fU7V2KT6Ce+mk5YbyHggxvRfsoiSzZk4g0CYcNK4NGT2A@mail.gmail.com>
Date: Tue, 3 Feb 2026 15:06:33 -0800
From: Ian Rogers <irogers@...gle.com>
To: Dapeng Mi <dapeng1.mi@...ux.intel.com>
Cc: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>, 
	Arnaldo Carvalho de Melo <acme@...nel.org>, Namhyung Kim <namhyung@...nel.org>, 
	Adrian Hunter <adrian.hunter@...el.com>, 
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>, John Garry <john.g.garry@...cle.com>, 
	Will Deacon <will@...nel.org>, James Clark <james.clark@...aro.org>, 
	Mike Leach <mike.leach@...aro.org>, Guo Ren <guoren@...nel.org>, 
	Paul Walmsley <pjw@...nel.org>, Palmer Dabbelt <palmer@...belt.com>, Albert Ou <aou@...s.berkeley.edu>, 
	Alexandre Ghiti <alex@...ti.fr>, linux-perf-users@...r.kernel.org, 
	linux-arm-kernel@...ts.infradead.org, linux-csky@...r.kernel.org, 
	linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org, 
	Zide Chen <zide.chen@...el.com>, Falcon Thomas <thomas.falcon@...el.com>, 
	Dapeng Mi <dapeng1.mi@...el.com>, Xudong Hao <xudong.hao@...el.com>
Subject: Re: [Patch v3 1/4] perf regs: Fix abort for "-I" or "--user-regs" options

On Mon, Feb 2, 2026 at 6:47 PM Dapeng Mi <dapeng1.mi@...ux.intel.com> wrote:
>
> Fix an issue where the `perf` tool aborts unexpectedly when running the
> following command:
>
> ```
> perf record -e cycles -I -- true
>
>  Usage: perf record [<options>] [<command>]
>     or: perf record [<options>] -- <command> [<options>]
>
>     -I, --intr-regs[=<any register>]
>     sample selected machine registers on interrupt, use '-I?' to list register names
> ```
>
> The usage of the `-I` or `--user-regs` options without specifying any
> registers should default to sampling all general-purpose registers.
> However, this currently causes an abnormal termination.
>
> The issue was introduced by commit 3d06db9bad1a ("perf regs: Refactor
>  use of arch__sample_reg_masks() to perf_reg_name()"). This patch
> resolves the problem, ensuring that the `-I` or `--user-regs` options
> work as intended without causing an abort.
>
> Fixes: 3d06db9bad1a ("perf regs: Refactor use of arch__sample_reg_masks() to perf_reg_name()")
> Signed-off-by: Dapeng Mi <dapeng1.mi@...ux.intel.com>

Reviewed-by: Ian Rogers <irogers@...gle.com>

Thanks,
Ian

> ---
>  tools/perf/util/parse-regs-options.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/tools/perf/util/parse-regs-options.c b/tools/perf/util/parse-regs-options.c
> index 8dd35f50f644..b44b47d9059f 100644
> --- a/tools/perf/util/parse-regs-options.c
> +++ b/tools/perf/util/parse-regs-options.c
> @@ -66,12 +66,14 @@ __parse_regs(const struct option *opt, const char *str, int unset, bool intr)
>         if (*mode)
>                 return -1;
>
> -       /* str may be NULL in case no arg is passed to -I */
> -       if (!str)
> -               return -1;
> -
>         mask = intr ? arch__intr_reg_mask() : arch__user_reg_mask();
>
> +       /* str may be NULL in case no arg is passed to -I */
> +       if (!str) {
> +               *mode = mask;
> +               return 0;
> +       }
> +
>         /* because str is read-only */
>         s = os = strdup(str);
>         if (!s)
> @@ -104,9 +106,6 @@ __parse_regs(const struct option *opt, const char *str, int unset, bool intr)
>         }
>         ret = 0;
>
> -       /* default to all possible regs */
> -       if (*mode == 0)
> -               *mode = mask;
>  error:
>         free(os);
>         return ret;
> --
> 2.34.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ