Files
linux/include/linux
Peter Zijlstra 32671e3799 perf: Disallow mis-matched inherited group reads
Because group consistency is non-atomic between parent (filedesc) and children
(inherited) events, it is possible for PERF_FORMAT_GROUP read() to try and sum
non-matching counter groups -- with non-sensical results.

Add group_generation to distinguish the case where a parent group removes and
adds an event and thus has the same number, but a different configuration of
events as inherited groups.

This became a problem when commit fa8c269353 ("perf/core: Invert
perf_read_group() loops") flipped the order of child_list and sibling_list.
Previously it would iterate the group (sibling_list) first, and for each
sibling traverse the child_list. In this order, only the group composition of
the parent is relevant. By flipping the order the group composition of the
child (inherited) events becomes an issue and the mis-match in group
composition becomes evident.

That said; even prior to this commit, while reading of a group that is not
equally inherited was not broken, it still made no sense.

(Ab)use ECHILD as error return to indicate issues with child process group
composition.

Fixes: fa8c269353 ("perf/core: Invert perf_read_group() loops")
Reported-by: Budimir Markovic <markovicbudimir@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20231018115654.GK33217@noisy.programming.kicks-ass.net
2023-10-19 10:09:42 +02:00
..
2023-06-16 12:27:04 -06:00
2023-05-20 19:20:30 +02:00
2023-05-19 23:23:52 +05:30
2023-08-23 08:21:37 +01:00
2023-09-11 15:24:16 -07:00
2023-08-09 08:21:22 +02:00
2023-09-19 16:41:26 -07:00
2023-05-31 13:06:57 +02:00
2023-05-25 09:26:19 +02:00
2023-04-17 18:01:23 +02:00
2023-08-24 16:20:30 -07:00
2023-03-06 15:49:07 -06:00
2023-09-01 00:29:34 +02:00
2023-03-19 10:02:04 -07:00
2023-06-13 16:49:23 +02:00
2023-09-13 10:48:48 +02:00
2023-05-01 17:50:18 -07:00
2023-08-04 11:02:46 +01:00
2023-08-05 08:18:04 -04:00
2023-07-14 13:47:07 -06:00
2023-08-18 10:12:10 -07:00
2023-08-15 14:57:25 -07:00
2023-08-18 10:18:59 -07:00
2023-07-11 14:12:19 -07:00
2023-06-20 20:17:10 -07:00
2023-05-24 18:08:49 +02:00
2023-08-18 10:12:25 -07:00
2023-08-21 14:28:45 -07:00
2023-06-23 16:59:30 -07:00
2023-06-05 09:36:39 +02:00
2023-07-18 10:07:47 +02:00
2023-09-29 17:20:46 -07:00
2023-03-06 09:57:07 +01:00
2023-08-12 09:18:47 -07:00
2023-10-06 11:01:23 +02:00
2023-10-06 11:01:23 +02:00
2023-05-23 12:55:12 -07:00
2023-09-02 15:17:33 -07:00
2023-07-15 11:34:49 -07:00
2023-06-23 16:59:28 -07:00
2023-05-18 19:52:31 -07:00
2023-06-11 18:22:47 +02:00
2023-10-10 19:35:54 -07:00
2023-07-18 10:07:47 +02:00
2023-06-05 09:36:39 +02:00
2023-06-24 15:50:13 -07:00
2023-08-21 13:37:26 -07:00
2023-08-06 08:24:55 +01:00
2023-08-07 17:55:54 +00:00
2023-08-11 21:12:47 +02:00
2023-03-16 13:08:39 -07:00
2023-03-23 17:25:46 +01:00
2023-08-24 13:27:47 -05:00
2023-03-29 08:19:38 +01:00
2023-04-05 20:03:01 -07:00
2023-04-21 03:02:34 -04:00
2023-08-21 14:52:16 +02:00
2023-08-21 13:37:27 -07:00