summaryrefslogtreecommitdiff
path: root/kernel/acct.c
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2022-05-20 20:38:06 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-05-25 09:17:55 +0200
commit3ee8e109c3c316073a3e0f83ec0769c7ee8a7375 (patch)
treea9d7952b8417c071d105848b7034522b36fa8bb1 /kernel/acct.c
parent18fb7d533c79909675749f1795dc312246143c6d (diff)
perf: Fix sys_perf_event_open() race against self
commit 3ac6487e584a1eb54071dbe1212e05b884136704 upstream. Norbert reported that it's possible to race sys_perf_event_open() such that the looser ends up in another context from the group leader, triggering many WARNs. The move_group case checks for races against itself, but the !move_group case doesn't, seemingly relying on the previous group_leader->ctx == ctx check. However, that check is racy due to not holding any locks at that time. Therefore, re-check the result after acquiring locks and bailing if they no longer match. Additionally, clarify the not_move_group case from the move_group-vs-move_group race. Fixes: f63a8daa5812 ("perf: Fix event->ctx locking") Reported-by: Norbert Slusarek <nslusarek@gmx.net> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel/acct.c')
0 files changed, 0 insertions, 0 deletions