* [PATCH v1] perf metrics: Fix segv with --for-each-cgroup
@ 2023-05-05 20:41 Ian Rogers
2023-05-05 20:54 ` Namhyung Kim
0 siblings, 1 reply; 2+ messages in thread
From: Ian Rogers @ 2023-05-05 20:41 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
Ian Rogers, Adrian Hunter, Kajol Jain, linux-perf-users,
linux-kernel
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 <namhyung@kernel.org>
Signed-off-by: Ian Rogers <irogers@google.com>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1] perf metrics: Fix segv with --for-each-cgroup
2023-05-05 20:41 [PATCH v1] perf metrics: Fix segv with --for-each-cgroup Ian Rogers
@ 2023-05-05 20:54 ` Namhyung Kim
0 siblings, 0 replies; 2+ messages in thread
From: Namhyung Kim @ 2023-05-05 20:54 UTC (permalink / raw)
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, linux-kernel
On Fri, May 5, 2023 at 1:41 PM Ian Rogers <irogers@google.com> 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 <namhyung@kernel.org>
> Signed-off-by: Ian Rogers <irogers@google.com>
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 <namhyung@kernel.org>
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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-05-05 20:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-05 20:41 [PATCH v1] perf metrics: Fix segv with --for-each-cgroup Ian Rogers
2023-05-05 20:54 ` Namhyung Kim
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).