Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1442777rwr; Fri, 5 May 2023 14:20:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6CTdNMDsYKdHRwIGBX+H1+Rg9F9irmdTr4HiOMtAUHjbbTUSwsFY1SYdx49AkX+Dkp9z9f X-Received: by 2002:a05:6a20:9f90:b0:f0:6567:92ba with SMTP id mm16-20020a056a209f9000b000f0656792bamr2695490pzb.58.1683321638674; Fri, 05 May 2023 14:20:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683321638; cv=none; d=google.com; s=arc-20160816; b=qR1rEcjFO/ywnSDRUk+Z2C1y4NngT/+jwtm7AdR+YLdKE0C3RPI4g2a49/iM5KRnOm oPbnD9YgVudW9+Avf5jA4yaKPVz3uRrzVU4+CGeXTryDPZ9Ade6c/v2GMwd/wk20jzQC m2hdjldu/+fD6AvDbsgNIu+L3pLLY/KdqOgLIdiHb4gBUBQ5unztvxGIRwTTEV5Yk+dm 3xkyWogwaCuTp69EmJ4Gwg8xDNJGFujeqDrqcM1ekNdIJusOdDGRBElyH4+LAtvXSV7b EChZbB77CGK84pTp1kjS9WSMM649ioOeuRjq5IuX6pJt6ArXsk0cjTGlK5OgkC+etHA9 p+kQ== 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=e0Yr0jnouhhSTkbs4JmKFMq/J/g5wYFcUAdHYxBE0F4=; b=tecs0TvHZ1geHVcFTXnvoMop/9j6NTyAzOpyKRfzRTCdRxdqjufFaE5yFHWoWNfbnZ hO+9pUZzALbAoszYUqErsR/I983GU8DNatOaC/weFWtEcSLlus2nTQLHXGorfXlzdaU5 2SUPHTCuVy0cVEB1vj9fCWvf2s8ghbqXsGJVrKY9vMndUsf4bNafJo5+AxI6dfG8V/5a tR319LIDt5QETzb0SAOW2f37NzeDqlezzh8oUYjX2sPhkul88Dp7QNH/BbrbIHGKzrew WamHmQHrAvssoQeYTiqqifmjSbmjpAgJ35DDWuBkt68vVlZYyXLg3aJdXWf7v4NBJBTM gG6g== 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 bv65-20020a632e44000000b00528cea36032si3116978pgb.10.2023.05.05.14.20.24; Fri, 05 May 2023 14:20:38 -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 S233421AbjEEUyv convert rfc822-to-8bit (ORCPT + 99 others); Fri, 5 May 2023 16:54:51 -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-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 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 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 >