John Garry
fc96ec4d5d
perf metricgroup: Fix find_evsel_group() event selector
...
The following command segfaults on my x86 broadwell:
$ ./perf stat -M frontend_bound,retiring,backend_bound,bad_speculation sleep 1
WARNING: grouped events cpus do not match, disabling group:
anon group { raw 0x10e }
anon group { raw 0x10e }
perf: util/evsel.c:1596: get_group_fd: Assertion `!(!leader->core.fd)' failed.
Aborted (core dumped)
The issue shows itself as a use-after-free in evlist__check_cpu_maps(),
whereby the leader of an event selector (evsel) has been deleted (yet we
still attempt to verify for an evsel).
Fundamentally the problem comes from metricgroup__setup_events() ->
find_evsel_group(), and has developed from the previous fix attempt in
commit 9c880c24cb0d ("perf metricgroup: Fix for metrics containing
duration_time").
The problem now is that the logic in checking if an evsel is in the same
group is subtly broken for the "cycles" event. For the "cycles" event,
the pmu_name is NULL; however the logic in find_evsel_group() may set an
event matched against "cycles" as used, when it should not be.
This leads to a condition where an evsel is set, yet its leader is not.
Fix the check for evsel pmu_name by not matching evsels when either has a
NULL pmu_name.
There is still a pre-existing metric issue whereby the ordering of the
metrics may break the 'stat' function, as discussed at:
https://lore.kernel.org/lkml/49c6fccb-b716-1bf0-18a6-cace1cdb66b9@huawei.com/
Fixes: 9c880c24cb0d ("perf metricgroup: Fix for metrics containing duration_time")
Signed-off-by: John Garry <john.garry@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> # On a Thinkpad T450S
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/1623335580-187317-2-git-send-email-john.garry@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-06-19 10:06:46 -03:00
..
2021-04-07 16:23:20 -03:00
2021-03-23 17:46:44 -03:00
2020-01-14 12:02:19 -03:00
2021-03-23 17:13:43 -03:00
2020-11-12 17:55:41 -03:00
2021-05-19 10:31:04 -03:00
2021-03-23 17:13:43 -03:00
2021-03-23 17:13:43 -03:00
2019-11-28 08:08:38 -03:00
2019-11-28 08:08:38 -03:00
2021-04-20 08:40:20 -03:00
2021-03-06 16:42:31 -03:00
2019-03-11 11:56:02 -03:00
2021-02-16 11:52:00 -03:00
2021-04-23 15:34:32 -03:00
2021-02-18 16:11:19 -03:00
2021-04-07 16:18:49 -03:00
2020-03-09 21:43:25 -03:00
2019-01-25 15:12:09 +01:00
2019-01-25 15:12:09 +01:00
2021-06-01 10:56:27 -03:00
2021-04-29 10:30:58 -03:00
2019-02-19 16:11:56 -03:00
2019-02-19 16:11:56 -03:00
2021-03-16 10:01:44 -03:00
2020-05-05 16:35:29 -03:00
2021-03-23 17:13:43 -03:00
2020-11-04 09:42:40 -03:00
2020-06-09 12:40:04 -03:00
2019-09-20 09:19:20 -03:00
2020-05-28 10:03:27 -03:00
2021-05-10 09:01:00 -03:00
2021-02-18 16:41:40 -03:00
2021-02-18 16:41:40 -03:00
2019-08-29 17:38:32 -03:00
2019-08-26 11:58:29 -03:00
2019-07-09 10:13:27 -03:00
2021-03-23 17:13:43 -03:00
2021-03-23 17:13:43 -03:00
2020-10-14 13:34:26 -03:00
2019-08-14 10:48:39 -03:00
2020-04-16 12:19:08 -03:00
2021-02-08 16:39:14 -03:00
2020-09-28 09:18:06 -03:00
2020-08-06 09:33:57 -03:00
2020-08-06 09:33:57 -03:00
2020-05-28 10:03:26 -03:00
2019-08-31 22:24:10 -03:00
2019-08-31 22:24:10 -03:00
2019-01-25 15:12:08 +01:00
2019-07-09 10:13:26 -03:00
2019-01-25 15:12:09 +01:00
2019-05-15 16:36:49 -03:00
2021-04-29 10:30:58 -03:00
2021-01-20 14:34:21 -03:00
2019-10-15 12:05:18 -03:00
2019-09-25 09:51:49 -03:00
2020-05-28 10:03:27 -03:00
2020-05-28 10:03:27 -03:00
2019-02-06 10:00:39 -03:00
2020-12-24 10:05:28 -03:00
2020-12-24 10:05:28 -03:00
2019-08-22 17:16:57 -03:00
2020-05-28 10:03:27 -03:00
2021-03-23 17:13:43 -03:00
2021-03-23 17:13:43 -03:00
2021-04-29 10:30:58 -03:00
2021-04-29 10:30:58 -03:00
2021-04-29 10:30:58 -03:00
2021-04-20 14:46:48 -03:00
2020-11-27 08:37:15 -03:00
2021-02-18 16:12:51 -03:00
2019-07-29 18:34:42 -03:00
2021-01-20 14:34:20 -03:00
2021-01-20 14:34:20 -03:00
2021-03-23 17:13:43 -03:00
2021-03-30 12:45:59 -03:00
2021-02-17 15:15:06 -03:00
2019-09-20 09:19:20 -03:00
2020-11-27 08:36:53 -03:00
2021-03-23 17:13:43 -03:00
2020-10-14 11:28:52 -03:00
2019-11-19 19:12:26 -03:00
2018-12-28 16:33:02 -03:00
2018-12-28 16:33:02 -03:00
2021-06-01 10:11:24 -03:00
2021-03-23 17:13:43 -03:00
2021-03-01 14:47:50 -03:00
2021-06-04 10:26:20 -03:00
2020-11-04 09:42:41 -03:00
2021-02-08 17:09:11 -03:00
2021-05-21 16:41:37 -03:00
2021-04-29 10:30:59 -03:00
2021-04-29 10:30:59 -03:00
2021-04-29 10:30:59 -03:00
2021-05-21 16:50:17 -03:00
2021-04-15 16:33:57 -03:00
2020-05-28 10:03:24 -03:00
2021-01-20 14:34:21 -03:00
2020-05-28 10:03:24 -03:00
2021-06-04 10:04:20 -03:00
2021-06-04 10:04:20 -03:00
2020-11-30 09:48:07 -03:00
2019-08-15 12:25:55 -03:00
2020-11-16 14:09:18 -03:00
2021-03-23 17:13:43 -03:00
2020-06-22 16:28:09 -03:00
2020-11-16 14:09:18 -03:00
2019-01-08 13:28:13 -03:00
2019-11-28 08:08:38 -03:00
2019-11-28 08:08:38 -03:00
2020-05-29 16:51:38 -03:00
2019-11-29 12:20:45 -03:00
2019-09-25 16:26:41 -03:00
2019-08-26 11:58:29 -03:00
2019-07-09 10:13:26 -03:00
2020-11-03 08:26:55 -03:00
2020-11-27 14:19:33 -03:00
2021-03-23 17:13:43 -03:00
2020-08-06 09:35:06 -03:00
2019-07-09 10:13:26 -03:00
2021-04-29 10:30:59 -03:00
2021-04-29 10:30:59 -03:00
2020-05-05 16:35:30 -03:00
2019-06-05 17:36:37 +02:00
2021-05-19 10:35:31 -03:00
2019-06-05 17:36:37 +02:00
2021-02-08 17:02:00 -03:00
2021-02-08 17:02:00 -03:00
2021-04-20 08:40:20 -03:00
2021-04-20 08:40:20 -03:00
2021-02-03 13:10:44 -03:00
2021-04-29 10:31:00 -03:00
2020-05-28 10:03:27 -03:00
2019-09-20 10:28:26 -03:00
2021-03-23 17:13:43 -03:00
2021-03-23 17:13:43 -03:00
2019-08-29 17:38:32 -03:00
2019-09-20 09:19:20 -03:00
2021-03-23 17:13:43 -03:00
2021-02-18 16:14:33 -03:00
2020-12-19 17:52:24 -03:00
2021-04-23 16:03:09 -03:00
2021-03-23 17:13:43 -03:00
2019-11-26 11:07:46 -03:00
2020-11-04 09:42:40 -03:00
2019-08-31 19:10:40 -03:00
2021-02-08 16:25:00 -03:00
2021-04-06 13:32:03 -03:00
2019-09-20 09:19:22 -03:00
2021-06-19 10:06:46 -03:00
2021-04-08 14:23:39 -03:00
2020-03-12 11:32:46 -03:00
2020-01-06 11:46:09 -03:00
2021-02-03 13:10:44 -03:00
2021-02-03 13:10:44 -03:00
2020-04-30 10:48:32 -03:00
2020-05-28 10:03:27 -03:00
2019-08-31 19:10:19 -03:00
2021-04-29 10:30:59 -03:00
2021-04-29 10:30:59 -03:00
2021-05-21 07:47:56 -03:00
2021-04-29 10:30:59 -03:00
2021-05-19 14:23:23 -03:00
2021-04-29 10:30:59 -03:00
2020-12-17 14:36:16 -03:00
2019-05-15 16:36:49 -03:00
2020-08-14 09:15:47 -03:00
2020-08-14 09:15:47 -03:00
2019-08-31 22:24:10 -03:00
2019-08-31 22:24:10 -03:00
2021-06-01 10:32:00 -03:00
2021-06-01 10:32:00 -03:00
2021-02-08 16:25:00 -03:00
2019-10-10 09:29:33 -03:00
2021-02-18 16:24:43 -03:00
2019-09-20 09:19:20 -03:00
2019-05-28 18:37:44 -03:00
2021-05-19 10:30:37 -03:00
2020-05-29 16:51:38 -03:00
2021-04-29 10:30:59 -03:00
2021-04-29 10:30:59 -03:00
2021-04-29 10:30:59 -03:00
2021-04-29 10:30:59 -03:00
2020-10-01 12:10:56 -03:00
2021-03-23 17:13:43 -03:00
2019-11-18 19:09:23 -03:00
2020-12-28 09:53:28 -03:00
2019-11-18 19:08:02 -03:00
2021-06-01 10:11:24 -03:00
2020-09-18 09:20:47 -03:00
2020-05-28 10:03:27 -03:00
2021-04-29 10:30:59 -03:00
2021-04-29 10:30:58 -03:00
2019-01-25 15:12:10 +01:00
2019-06-05 17:37:04 +02:00
2019-01-25 15:12:10 +01:00
2021-05-10 09:00:59 -03:00
2021-01-20 14:34:20 -03:00
2019-07-09 14:59:11 -03:00
2019-07-09 14:59:11 -03:00
2019-09-20 09:19:20 -03:00
2020-04-16 12:19:15 -03:00
2018-08-08 15:26:48 -03:00
2021-03-23 17:13:43 -03:00
2018-08-03 10:34:18 -03:00
2021-04-08 14:24:14 -03:00
2020-11-30 15:15:30 -03:00
2020-11-30 15:15:30 -03:00
2021-06-11 12:54:24 -03:00
2021-04-29 10:30:59 -03:00
2019-07-09 10:13:26 -03:00
2021-01-20 14:34:21 -03:00
2020-11-30 14:56:52 -03:00
2020-05-05 16:35:29 -03:00
2021-03-26 08:50:00 -03:00
2021-03-26 08:49:54 -03:00
2019-10-11 10:57:00 -03:00
2019-10-11 10:57:00 -03:00
2019-11-28 08:08:38 -03:00
2019-02-06 10:00:38 -03:00
2020-01-30 11:55:26 +01:00
2019-01-25 15:12:09 +01:00
2021-06-04 10:05:23 -03:00
2021-04-20 08:40:20 -03:00
2021-03-09 09:03:40 -03:00
2021-04-20 08:40:20 -03:00
2019-08-31 19:10:19 -03:00
2021-03-23 17:13:43 -03:00
2020-10-14 13:34:26 -03:00
2020-10-14 13:34:26 -03:00
2019-07-09 10:13:26 -03:00
2021-03-23 17:13:43 -03:00
2021-02-17 15:15:06 -03:00
2021-02-17 15:15:06 -03:00
2019-07-09 10:13:26 -03:00
2019-01-25 15:12:10 +01:00
2019-09-20 09:19:21 -03:00
2019-08-29 17:38:31 -03:00
2021-02-08 17:09:11 -03:00
2021-03-08 11:17:51 -03:00
2021-06-04 10:06:27 -03:00
2020-10-14 08:46:42 -03:00
2021-02-18 16:38:31 -03:00
2020-11-03 08:30:34 -03:00
2019-08-31 22:24:05 -03:00
2021-03-29 10:39:10 -03:00
2020-04-03 09:37:55 -03:00
2021-03-01 14:49:28 -03:00
2020-05-29 16:50:26 -03:00
2021-01-20 14:25:28 -03:00
2021-04-29 10:30:58 -03:00
2019-08-29 08:36:12 -03:00
2019-08-29 08:36:12 -03:00
2020-05-05 16:35:29 -03:00
2021-03-25 08:59:10 -03:00
2020-04-18 09:05:01 -03:00
2020-04-18 09:05:01 -03:00
2019-10-15 08:36:22 -03:00
2019-10-15 08:36:22 -03:00
2020-07-10 08:20:01 -03:00
2020-05-05 16:35:30 -03:00
2020-05-05 16:35:29 -03:00
2020-09-17 15:47:58 -03:00
2020-09-17 15:47:58 -03:00
2021-02-03 13:13:53 -03:00
2019-11-05 08:39:27 -03:00
2021-03-06 16:54:26 -03:00
2019-08-29 17:38:32 -03:00
2019-09-20 09:19:20 -03:00
2019-11-05 08:39:27 -03:00
2019-08-29 17:38:32 -03:00
2021-04-29 10:31:00 -03:00
2021-04-29 10:31:00 -03:00
2021-03-15 11:36:54 -03:00
2021-03-15 11:36:54 -03:00
2021-02-18 14:20:32 -03:00
2021-03-23 17:13:43 -03:00
2019-11-26 11:07:46 -03:00
2019-11-26 11:07:46 -03:00
2019-09-20 09:19:20 -03:00
2020-04-16 12:19:08 -03:00
2020-09-10 11:55:37 -03:00
2019-08-31 19:10:19 -03:00
2021-03-24 10:38:56 -03:00
2019-09-20 09:19:20 -03:00
2020-09-01 12:15:21 -03:00