android_kernel_motorola_sm6375/kernel/events
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Peter Zijlstra 7252c8b981 perf: Disallow mis-matched inherited group reads
commit 32671e3799ca2e4590773fd0e63aaa4229e50c06 upstream.

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 <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2023-10-25 11:53:24 +02:00
..
callchain.c
core.c perf: Disallow mis-matched inherited group reads 2023-10-25 11:53:24 +02:00
hw_breakpoint.c
internal.h perf: Fix get_recursion_context() 2020-11-18 19:20:28 +01:00
Makefile
ring_buffer.c
uprobes.c treewide: Remove uninitialized_var() usage 2023-06-09 10:29:01 +02:00