Skip to content

Commit 0734d0b

Browse files
committed
perf: Fix check before add_event_to_groups() in perf_group_detach()
Bugzilla: https://bugzilla.redhat.com/2192660 CVE: CVE-2023-2235 upstream ======== commit fd0815f Author: Budimir Markovic <markovicbudimir@gmail.com> Date: Wed Mar 15 00:29:01 2023 -0700 description =========== Events should only be added to a groups rb tree if they have not been removed from their context by list_del_event(). Since remove_on_exec made it possible to call list_del_event() on individual events before they are detached from their group, perf_group_detach() should check each sibling's attach_state before calling add_event_to_groups() on it. Fixes: 2e498d0 ("perf: Add support for event removal on exec") Signed-off-by: Budimir Markovic <markovicbudimir@gmail.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/ZBFzvQV9tEqoHEtH@gentoo Signed-off-by: Michael Petlan <mpetlan@redhat.com>
1 parent ae052f6 commit 0734d0b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/events/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2169,7 +2169,7 @@ static void perf_group_detach(struct perf_event *event)
21692169
/* Inherit group flags from the previous leader */
21702170
sibling->group_caps = event->group_caps;
21712171

2172-
if (!RB_EMPTY_NODE(&event->group_node)) {
2172+
if (sibling->attach_state & PERF_ATTACH_CONTEXT) {
21732173
add_event_to_groups(sibling, event->ctx);
21742174

21752175
if (sibling->state == PERF_EVENT_STATE_ACTIVE)

0 commit comments

Comments
 (0)