From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7672BC77B7C for ; Fri, 5 May 2023 20:54:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233418AbjEEUyu convert rfc822-to-8bit (ORCPT ); Fri, 5 May 2023 16:54:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233412AbjEEUyq (ORCPT ); Fri, 5 May 2023 16:54:46 -0400 Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F0A149E3; Fri, 5 May 2023 13:54:45 -0700 (PDT) Received: by mail-yb1-f173.google.com with SMTP id 3f1490d57ef6-b9a6ab9ede3so3007110276.2; Fri, 05 May 2023 13:54:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683320084; x=1685912084; 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=uYVGB6plWT1YdfLLw6hoHtv7l2YFMxriyoV+UZStGq4=; b=i+2fanKdhVP8IAFYdSPy2tTMfRJ5D8as/v7bblW1rj2svnhNbK2kDv0yIJA1aGkAs+ FZrDmBZz2kjsCwMl9EW7eRKY7pd3VKIktXKKx4/StL8bW9oAQGgWz0FscqCeXASI0f5P HfkIoqykd+Zu5U28gpG4dqGqE4wxnbFrP32667JG2sNixPAbOOCWfjCkpnmBRBTnx++L jtxITg4PMDDQZXa7FW+jpXfeZetiMC9vMVwpLKsmZWbGD1q1tcLlG9eAzwm0TassVqx5 GsbBun3VZ/FfFXq6YhmIOIg19L3EjCJ3CBaPOhqFDWtHKw4MrIy5mthWG8TtXDxjqmMa 6erQ== X-Gm-Message-State: AC+VfDx0u1g1/JsLCACCl8xAWQ6AflUlXarZYx1gdXw0h/AaTOTlZEF5 bCjjcfPJVIz4PW7lUzU5399DAiyhw4TeviLEmtc= X-Google-Smtp-Source: ACHHUZ7K8c39ZHBIJe/ovC4cnYkkrQsebbP0ZMkYWfv7B2HUDG+87jr0dUz0+X123t+Ee5hn8BDjwnidUGMZKK/LSCA= X-Received: by 2002:a25:1542:0:b0:b9e:84b0:bfa6 with SMTP id 63-20020a251542000000b00b9e84b0bfa6mr2836370ybv.25.1683320084061; Fri, 05 May 2023 13:54:44 -0700 (PDT) MIME-Version: 1.0 References: <20230505204119.3443491-1-irogers@google.com> In-Reply-To: <20230505204119.3443491-1-irogers@google.com> From: Namhyung Kim Date: Fri, 5 May 2023 13:54:33 -0700 Message-ID: Subject: Re: [PATCH v1] perf metrics: Fix segv with --for-each-cgroup To: Ian Rogers Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , Kajol Jain , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-perf-users@vger.kernel.org On Fri, May 5, 2023 at 1:41 PM Ian Rogers wrote: > > Ensure the metric threshold is copied correctly or else a use of > uninitialized memory happens. > > Fixes: d0a3052f6fae ("perf metric: Compute and print threshold values") > > Reported-by: Namhyung Kim > Signed-off-by: Ian Rogers Thanks for the fix. Now it runs ok $ sudo ./perf stat -a --bpf-counters \ > --for-each-cgroup user.slice,system.slice sleep 1 Tested-by: Namhyung Kim Thanks, Namhyung > --- > tools/perf/util/metricgroup.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c > index 4b9a16291b96..c566c6859302 100644 > --- a/tools/perf/util/metricgroup.c > +++ b/tools/perf/util/metricgroup.c > @@ -1730,6 +1730,7 @@ int metricgroup__copy_metric_events(struct evlist *evlist, struct cgroup *cgrp, > return -ENOMEM; > > new_expr->metric_expr = old_expr->metric_expr; > + new_expr->metric_threshold = old_expr->metric_threshold; > new_expr->metric_name = strdup(old_expr->metric_name); > if (!new_expr->metric_name) > return -ENOMEM; > -- > 2.40.1.521.gf1e218fcd8-goog >