Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp16734180rwd; Mon, 26 Jun 2023 14:28:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4rzE6K75pgDUymX+aGE29Y4nohrr7Zg+ird6edbOv+OjOGVoq3FxQ/0siYZc16U7Kn7H6X X-Received: by 2002:a17:903:2352:b0:1b6:4bbd:c3b6 with SMTP id c18-20020a170903235200b001b64bbdc3b6mr5607110plh.9.1687814927110; Mon, 26 Jun 2023 14:28:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687814927; cv=none; d=google.com; s=arc-20160816; b=090KUA2q7PCu3xy35mme4pStu1HRPzAtVkPeMmGuN/mqreOHEpKOhh8PnIYHi9FKQQ /dz9k5qt4LWfn8zPVmoqUlTWMP2XoWwh3j5YiJgSxN7YzIobXKM4AyUO2cCtSKqI32sX qHPy+ZIAzh4MLR2HKHrLVD+qoltBE2ufCZuez22aiZl/T4VjxEylDTfaPFec+Z10V8RP Kn4GluWd3NbN84DeumfojrHUamzhKTcAbSpcleLpG17pgsUN0O4Eye+9j9lg5pp80z6G 9vwg07gIsZCH6C+29vqjmE56cAkC7RDv9o2LUOzEhJldRq7nH1H5orRiZLCOv4RafFWh /ymQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=5WAoOnLqffAQ/gLlsk6GAVw7gUkGvyWNGAqWj9eMqP4=; fh=uiQXZLnrk8dLlpL1VckxvSKygz8HmzCeL1XVPvKVztI=; b=b0J4qkt+Rz/cP1CwYQA17zLUb2tNHi9BmHerS62A3xG3e9p6WyMJPCzeczPpabnvZa TvBxRsVRLNGJGo3ejlTX8ZlBlHuQYxT6kP/jrLnvVp6AXlCTGAMtcEn5WL5grYMSEOd5 1ooQP4V4Ktp0WnZAYdzwpsMzDRh6cqHIocbACowrm8/3TnAq5BPLG9nQcOPOqNvs0lID 7QhXIw8j8mcWkfH1RGCzOddeeqd2DAydB/QpHx1ltw6tQKXjBOY5v4+Mxs4EPnuPH1jh r93ByNuzVJbrmQaeqlm5EfJwXQNP9xBOGLbcNhRG23kRKcOWzFJ6jN4rMvdp0tMtjPjY 3vLw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t10-20020a170902dcca00b001b0473abd39si901043pll.483.2023.06.26.14.28.35; Mon, 26 Jun 2023 14:28:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229762AbjFZU7D convert rfc822-to-8bit (ORCPT + 99 others); Mon, 26 Jun 2023 16:59:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbjFZU7B (ORCPT ); Mon, 26 Jun 2023 16:59:01 -0400 Received: from mail-io1-f48.google.com (mail-io1-f48.google.com [209.85.166.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA6D8125; Mon, 26 Jun 2023 13:59:00 -0700 (PDT) Received: by mail-io1-f48.google.com with SMTP id ca18e2360f4ac-7835bad99fbso51939839f.1; Mon, 26 Jun 2023 13:59:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687813140; x=1690405140; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w8/FilnxQYWJtSiiMwZyoDzlxp4aKzL1HmrYGLutaDA=; b=I/FC7e6oYfoh5WYlgLsSpwjy5JlnkQYYgSXieDjc5ZmPi0qTwpgieg3Zm7ugLK1P5g Jf9po23SZ1ahikTAgW9wNmsr6tXR/8LQzYNNLKx6dchr1RUCzdWoXFdSA1hJSGxzhIgg Il9LNynVx4d5zghKdo8hMP13bxQQ1SKocVOKSMXyysUhYa8amhatR5J/JRV8s22A3M8V PAKrSzsUbE6qjDSCL77s2IVqBtSE3c7fbu0CQtmranJS9fsZXt3tIRW68NK4DB38myQW W60uUF584oz6WzD3Y2mwcjhJ6K4VSK8xq+5uS2yznGHlxDxNUYqF7ROkQ8k7xmsQrixS u2Pw== X-Gm-Message-State: AC+VfDzSSwZH9WP6Ute7h/4ESWHxUTGZU3ZzneiXfgx8HLgGtP7lzrnr pfO2fnP3pc+Qkv1ZYO+nFMnsMrqE7pAOILnbFm0= X-Received: by 2002:a6b:ea03:0:b0:783:5511:7b27 with SMTP id m3-20020a6bea03000000b0078355117b27mr3980870ioc.9.1687813139837; Mon, 26 Jun 2023 13:58:59 -0700 (PDT) MIME-Version: 1.0 References: <20230626201606.2514679-1-jolsa@kernel.org> In-Reply-To: <20230626201606.2514679-1-jolsa@kernel.org> From: Namhyung Kim Date: Mon, 26 Jun 2023 13:58:48 -0700 Message-ID: Subject: Re: [PATCH] perf tools: Add missing else to cmd_daemon subcommand condition To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jiri, On Mon, Jun 26, 2023 at 1:16 PM Jiri Olsa 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 > Signed-off-by: Jiri Olsa 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 After: 85: daemon operations : --- start --- test child forked, pid 80752 test daemon list test daemon reconfig test daemon stop test daemon signal signal 12 sent to session 'test [81022]' signal 12 sent to session 'test [81022]' test daemon ping test daemon lock test child finished with 0 ---- end ---- daemon operations: Ok Tested-by: Namhyung Kim Thanks, Namhyung > --- > tools/perf/builtin-daemon.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/perf/builtin-daemon.c b/tools/perf/builtin-daemon.c > index f5674d824a40..83954af36753 100644 > --- a/tools/perf/builtin-daemon.c > +++ b/tools/perf/builtin-daemon.c > @@ -1524,7 +1524,7 @@ int cmd_daemon(int argc, const char **argv) > if (argc) { > if (!strcmp(argv[0], "start")) > ret = __cmd_start(&__daemon, daemon_options, argc, argv); > - if (!strcmp(argv[0], "signal")) > + else if (!strcmp(argv[0], "signal")) > ret = __cmd_signal(&__daemon, daemon_options, argc, argv); > else if (!strcmp(argv[0], "stop")) > ret = __cmd_stop(&__daemon, daemon_options, argc, argv); > -- > 2.41.0 >