perf: Fix perf_event_validate_size()
[ Upstream commit 382c27f4ed28f803b1f1473ac2d8db0afc795a1b ]
Budimir noted that perf_event_validate_size() only checks the size of
the newly added event, even though the sizes of all existing events
can also change due to not all events having the same read_format.
When we attach the new event, perf_group_attach(), we do re-compute
the size for all events.
BUG=b/317059204
TEST=presubmit
RELEASE_NOTE=Fixed CVE-2023-6931 in the Linux kernel.
Fixes: a723968c0ed3 ("perf: Fix u16 overflows")
Reported-by: Budimir Markovic <markovicbudimir@gmail.com>
Change-Id: I5cc97c00e58450e733379e8d186d71fb61ab2cea
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 06dec254c59afd01b7a44838cf8bfc382bef019b)
Signed-off-by: Arnav Kansal <rnv@google.com>
Reviewed-on: https://cos-review.googlesource.com/c/third_party/kernel/+/62595
Tested-by: Cusky Presubmit Bot <presubmit@cos-infra-prod.iam.gserviceaccount.com>
Reviewed-by: Oleksandr Tymoshenko <ovt@google.com>
1 file changed