public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Guilherme Amadio <amadio@gentoo.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Ian Rogers <irogers@google.com>,
	namhyung@kernel.org, adrian.hunter@intel.com, jolsa@kernel.org,
	kan.liang@linux.intel.com, linux-kernel@vger.kernel.org,
	linux-perf-users@vger.kernel.org, mingo@kernel.org,
	peterz@infradead.org
Subject: Re: perf --help triggers an assertion
Date: Fri, 12 Sep 2025 13:27:14 +0200	[thread overview]
Message-ID: <aMQDkp8ewyxlX_8Z@gentoo.org> (raw)
In-Reply-To: <aMMq7I5TBoL7SX6z@x1>

On Thu, Sep 11, 2025 at 05:02:52PM -0300, Arnaldo Carvalho de Melo wrote:
> On Wed, Sep 10, 2025 at 02:52:25PM +0200, Guilherme Amadio wrote:
> > On Tue, Sep 09, 2025 at 11:31:51AM -0700, Ian Rogers wrote:
> > > On Tue, Sep 9, 2025 at 2:49 AM Guilherme Amadio <amadio@gentoo.org> wrote:
> > > > I was updating perf's package in Gentoo Linux and noticed some problems
> > > > which were not there before. I tested with the version below and the problem
> > > > still seems to be there. perf --help triggers an assertion (see below).
> > > > Looking in the list, it seems related to the patch below:
> 
> > > > https://lore.kernel.org/linux-perf-users/20250701201027.1171561-3-namhyung@kernel.org/
> 
> <SNIP>
> 
> > > I tried to reproduce the same version with various options: DEBUG=1
> > > -UNDEBUG in EXTRA_CFLAGS, -fsanitize=address. Being in various
> > > directories with "perf-" prefixed files. I'm afraid I wasn't able to
> > > reproduce. The assert is trying to avoid a memory leak, so
> > > non-critical, and I couldn't in a quick inspection eye-ball an issue.
> > > Without getting a reproduction I don't think I can make progress with
> > > the issue.
>  
> > I do not have any special setup on my machine (if you consider Gentoo
> > not special, of course). I just did a git bisect and arrived at commit
> > 9401d1771dad99bfc795dd2ae0c292343fd1f78d, which is the commit I linked
> > above. I used>
> 
> ⬢ [acme@toolbx perf-tools-next]$ git show 9401d1771dad99bfc795dd2ae0c292343fd1f78d
> fatal: bad object 9401d1771dad99bfc795dd2ae0c292343fd1f78d
> ⬢ [acme@toolbx perf-tools-next]$ 
> 
> Looking for the patch title I got to this one:
> 
> commit 1fdf938168c4d26fa279d4f204768690d1f9c4ae
> Author: Namhyung Kim <namhyung@kernel.org>
> Date:   Tue Jul 1 13:10:27 2025 -0700
> 
>     perf tools: Fix use-after-free in help_unknown_cmd()
> 
> ?

Sorry, I used the tag I arrived at with git bisect, which was probably cherry-picked:

gentoo linux $ git remote -v
amadio	git@github.com:amadio/linux (fetch)
amadio	git@github.com:amadio/linux (push)
perf-tools	git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools.git (fetch)
perf-tools	git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools.git (push)
perf-tools-next	git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git (fetch)
perf-tools-next	git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git (push)
stable	git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git (fetch)
stable	git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git (push)
torvalds	git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git (fetch)
torvalds	git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git (push)
gentoo linux $ git show 9401d1771dad99bfc795dd2ae0c292343fd1f78d | head
commit 9401d1771dad99bfc795dd2ae0c292343fd1f78d
Author: Namhyung Kim <namhyung@kernel.org>
  Date:   Tue Jul 1 13:10:27 2025 -0700

    perf tools: Fix use-after-free in help_unknown_cmd()
    
    [ Upstream commit 1fdf938168c4d26fa279d4f204768690d1f9c4ae ]
    
    Currently perf aborts when it finds an invalid command.  I guess it
    depends on the environment as I have some custom commands in the path.
gentoo linux $ git tag --contains 9401d1771dad99bfc795dd2ae0c292343fd1f78d
v6.16.1
v6.16.2
v6.16.3
v6.16.4
v6.16.5
v6.16.6
v6.16.7
gentoo linux $ git tag --contains 1fdf938168c4d26fa279d4f204768690d1f9c4ae
perf-tools-fixes-for-v6.17-2025-08-27
perf-tools-fixes-for-v6.17-2025-09-05
perf-tools-for-v6.17-2025-08-01
v6.17-rc1
v6.17-rc2
v6.17-rc3
v6.17-rc4
v6.17-rc5

Cheers,
-Guilherme


> 
> - Arnaldo
>  
> > $ make -C tools/perf clean && make -B -j16 -C tools/perf DEBUG=1 WERROR=0 NO_SHELLCHECK=1
> > 
> > then called perf --help each time (but perf help record or equivalent
> > also triggers the assertion). I'm using GCC 14 on a 3950X. The features
> > I have enabled and installed dependencies are below. This patch has been
> > backported to at least 6.12 stable, and I can reproduce this with
> > v6.12.45.
> > 
> > gentoo linux $ tools/perf/perf version --build-options
> > perf version 6.16.g45effee4b85a
> >                    aio: [ on  ]  # HAVE_AIO_SUPPORT
> >                    bpf: [ on  ]  # HAVE_LIBBPF_SUPPORT
> >          bpf_skeletons: [ on  ]  # HAVE_BPF_SKEL
> >             debuginfod: [ on  ]  # HAVE_DEBUGINFOD_SUPPORT
> >                  dwarf: [ on  ]  # HAVE_LIBDW_SUPPORT
> >     dwarf_getlocations: [ on  ]  # HAVE_LIBDW_SUPPORT
> >           dwarf-unwind: [ on  ]  # HAVE_DWARF_UNWIND_SUPPORT
> >               auxtrace: [ on  ]  # HAVE_AUXTRACE_SUPPORT
> >                 libbfd: [ OFF ]  # HAVE_LIBBFD_SUPPORT ( tip: Deprecated, license incompatibility, use BUILD_NONDISTRO=1 and install binutils-dev[el] )
> >            libcapstone: [ on  ]  # HAVE_LIBCAPSTONE_SUPPORT
> >              libcrypto: [ on  ]  # HAVE_LIBCRYPTO_SUPPORT
> >     libdw-dwarf-unwind: [ on  ]  # HAVE_LIBDW_SUPPORT
> >                 libelf: [ on  ]  # HAVE_LIBELF_SUPPORT
> >                libnuma: [ on  ]  # HAVE_LIBNUMA_SUPPORT
> >             libopencsd: [ OFF ]  # HAVE_CSTRACE_SUPPORT
> >                libperl: [ on  ]  # HAVE_LIBPERL_SUPPORT
> >                libpfm4: [ on  ]  # HAVE_LIBPFM
> >              libpython: [ on  ]  # HAVE_LIBPYTHON_SUPPORT
> >               libslang: [ on  ]  # HAVE_SLANG_SUPPORT
> >          libtraceevent: [ on  ]  # HAVE_LIBTRACEEVENT
> >              libunwind: [ OFF ]  # HAVE_LIBUNWIND_SUPPORT ( tip: Deprecated, use LIBUNWIND=1 and install libunwind-dev[el] to build with it )
> >                   lzma: [ on  ]  # HAVE_LZMA_SUPPORT
> > numa_num_possible_cpus: [ on  ]  # HAVE_LIBNUMA_SUPPORT
> >                   zlib: [ on  ]  # HAVE_ZLIB_SUPPORT
> >                   zstd: [ on  ]  # HAVE_ZSTD_SUPPORT
> > 
> > And here are the version of all dependencies I have installed:
> > 
> >  * dependency graph for dev-util/perf-6.16-r1
> >  `--  dev-util/perf-6.16-r1
> >    `--  dev-util/babeltrace-1.5.11
> >    `--  dev-libs/libbpf-1.6.2
> >    `--  dev-util/bpftool-7.6.0
> >    `--  dev-util/pahole-1.30
> >    `--  llvm-core/clang-18.1.8-r6
> >    `--  llvm-core/llvm-18.1.8-r6
> >    `--  llvm-core/clang-19.1.7
> >    `--  llvm-core/llvm-19.1.7
> >    `--  llvm-core/clang-20.1.8
> >    `--  llvm-core/llvm-20.1.8
> >    `--  llvm-core/clang-21.1.0
> >    `--  llvm-core/llvm-21.1.0
> >    `--  sys-libs/libcap-2.76
> >    `--  dev-libs/capstone-5.0.6
> >    `--  dev-libs/openssl-3.5.2
> >    `--  x11-libs/gtk+-2.24.33-r3
> >    `--  virtual/jre-21
> >    `--  dev-libs/libpfm-4.13.0
> >    `--  dev-libs/libtraceevent-1.8.4
> >    `--  dev-libs/libtracefs-1.8.2
> >    `--  app-arch/xz-utils-5.8.1-r1
> >    `--  sys-process/numactl-2.0.19
> >    `--  dev-lang/perl-5.42.0
> >    `--  dev-lang/python-0.3.13.7
> >    `--  dev-lang/python-0.3.14.0_rc2
> >    `--  dev-lang/python-3.11.13_p1
> >    `--  dev-lang/python-3.12.11_p1
> >    `--  dev-lang/python-3.13.9999
> >    `--  dev-lang/python-3.14.0_rc2
> >    `--  sys-libs/slang-2.3.3-r1
> >    `--  dev-debug/systemtap-5.3
> >    `--  dev-util/google-perftools-2.17.2
> >    `--  sys-libs/libunwind-1.8.2-r1
> >    `--  app-arch/zstd-1.5.7-r1
> >    `--  dev-libs/elfutils-0.193
> >    `--  sys-libs/binutils-libs-2.45-r1
> >    `--  sys-libs/zlib-1.3.1-r1
> >    `--  virtual/libcrypt-2-r1
> >    `--  sys-kernel/linux-headers-6.16
> >    `--  virtual/jdk-21
> >    `--  app-arch/tar-1.35
> >    `--  dev-python/setuptools-80.9.0-r1
> >    `--  app-alternatives/yacc-1-r2
> >    `--  app-alternatives/lex-0-r1
> >    `--  sys-apps/which-2.23
> >    `--  virtual/pkgconfig-3
> >    `--  app-text/asciidoc-10.2.1
> >    `--  app-text/sgml-common-0.6.3-r7
> >    `--  app-text/xmlto-0.0.28-r11
> >    `--  sys-process/time-1.9-r1
> > 
> > I hope that this helps with reproducing the problem, but if not, let me
> > know which additional information you'd like to have and I will send it.
> > My running kernel is 6.16.4, and glibc is version 2.42.
> > 
> > Best regards,
> > -Guilherme

  parent reply	other threads:[~2025-09-12 11:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-01 20:10 [PATCH v2 1/3] perf test: Check test suite description properly Namhyung Kim
2025-07-01 20:10 ` [PATCH v2 2/3] perf test: Add libsubcmd help tests Namhyung Kim
2025-07-01 20:10 ` [PATCH v2 3/3] perf tools: Fix use-after-free in help_unknown_cmd() Namhyung Kim
2025-09-09  9:49   ` perf --help triggers an assertion Guilherme Amadio
2025-09-09 18:31     ` Ian Rogers
2025-09-10 12:52       ` Guilherme Amadio
2025-09-10 15:04         ` Ian Rogers
2025-12-07 19:08           ` Guilherme Amadio
2025-12-07 21:54             ` Ian Rogers
2025-12-11 14:35               ` Guilherme Amadio
2025-09-11 20:02         ` Arnaldo Carvalho de Melo
2025-09-11 21:12           ` Namhyung Kim
2025-09-12 11:27           ` Guilherme Amadio [this message]
2025-07-01 22:38 ` [PATCH v2 1/3] perf test: Check test suite description properly Ian Rogers
2025-07-02 16:43 ` 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=aMQDkp8ewyxlX_8Z@gentoo.org \
    --to=amadio@gentoo.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /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