linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Jiri Olsa <olsajiri@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	lkml <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Ingo Molnar <mingo@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	linux-perf-users@vger.kernel.org
Subject: Re: [PATCH] perf tools: Add missing else to cmd_daemon subcommand condition
Date: Tue, 27 Jun 2023 12:33:02 -0700	[thread overview]
Message-ID: <CAM9d7chRtGNG6KLkWQRBz0aNVwDJWm-StPbMuXN4bumpUsNG-g@mail.gmail.com> (raw)
In-Reply-To: <ZJqfUL1gnkTbUx5n@krava>

On Tue, Jun 27, 2023 at 1:35 AM Jiri Olsa <olsajiri@gmail.com> wrote:
>
> On Mon, Jun 26, 2023 at 01:58:48PM -0700, Namhyung Kim wrote:
> > Hi Jiri,
> >
> > On Mon, Jun 26, 2023 at 1:16 PM Jiri Olsa <jolsa@kernel.org> wrote:
> > >
> > > Namhyung reported segfault in perf daemon start command.
> > >
> > > It's caused by extra check on argv[0] which is set to NULL by previous
> > > __cmd_start call. Adding missing else to skip the extra check.
> > >
> > > Fixes: 92294b906e6c ("perf daemon: Dynamically allocate path to perf")
> > > Reported-by: Namhyung Kim <namhyung@kernel.org>
> > > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> >
> > Thanks for the fix.  Now it runs ok.
> >
> > Before:
> >   $ sudo ./perf test -v daemon
> >    85: daemon operations                                               :
> >   --- start ---
> >   test child forked, pid 82420
> >   test daemon list
> >   ./tests/shell/daemon.sh: line 133: 82426 Segmentation fault
> > perf daemon start --config ${config}
> >   test daemon reconfig
> >   ./tests/shell/daemon.sh: line 133: 82520 Segmentation fault
> > perf daemon start --config ${config}
> >   test daemon stop
> >   ./tests/shell/daemon.sh: line 133: 82636 Segmentation fault
> > perf daemon start --config ${config}
> >   test daemon signal
> >   ./tests/shell/daemon.sh: line 133: 82674 Segmentation fault
> > perf daemon start --config ${config}
> >   signal 12 sent to session 'test [82676]'
> >   signal 12 sent to session 'test [82676]'
> >   test daemon ping
> >   ./tests/shell/daemon.sh: line 133: 82702 Segmentation fault
> > perf daemon start --config ${config}
> >   test daemon lock
> >   ./tests/shell/daemon.sh: line 133: 82734 Segmentation fault
> > perf daemon start --config ${config}
> >   test child finished with 0
> >   ---- end ----
> >   daemon operations: Ok
> >
> > Maybe we need to investigate more why it was ok..
> > But at least I don't see segfaults anymore
>
> yea, for some reason parse_options would put NULL into argv[0]
>
> I'll try to check what changed, in any case the fix makes the
> condition alligned with the other legs and fixes the segfault

Yep, thanks for checking.

In the meantime, Thomas Richter reported the same problem and
fix.  I'll take yours but leave it for the record.

  http://lore.kernel.org/r/20230627092633.2135105-1-tmricht@linux.ibm.com

Applied to perf-tools-next, thanks!

      reply	other threads:[~2023-06-27 19:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-26 20:16 [PATCH] perf tools: Add missing else to cmd_daemon subcommand condition Jiri Olsa
2023-06-26 20:58 ` Namhyung Kim
2023-06-27  8:35   ` Jiri Olsa
2023-06-27 19:33     ` Namhyung Kim [this message]

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=CAM9d7chRtGNG6KLkWQRBz0aNVwDJWm-StPbMuXN4bumpUsNG-g@mail.gmail.com \
    --to=namhyung@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@kernel.org \
    --cc=olsajiri@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).