Re: [PATCH] perf: Fix race between close() and fork()

From: Alexander Shishkin
Date: Tue Jun 25 2019 - 08:20:38 EST

Peter Zijlstra <peterz@xxxxxxxxxxxxx> writes:

> Solve it by using the fact that detached events still have a reference
> count on their (previous) context. With this perf_event_free_task()
> can detect when events have escaped and wait for their destruction.
> Cc: Mark Rutland <mark.rutland@xxxxxxx>
> Fixes: 82d94856fa22 ("perf/core: Fix lock inversion between perf,trace,cpuhp")
> Reported-by: syzbot+a24c397a29ad22d86c98@xxxxxxxxxxxxxxxxxxxxxxxxx
> Debugged-by: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>

Reviewed-by: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>