Re: [PATCH] events: Reuse value read using READ_ONCE instead of re-reading it
From: Peter Zijlstra
Date: Fri Sep 10 2021 - 12:21:21 EST
On Mon, Sep 06, 2021 at 11:53:10AM +1000, Baptiste Lepers wrote:
> In perf_event_addr_filters_apply, the task associated with
> the event (event->ctx->task) is read using READ_ONCE at the beginning
> of the function, checked, and then re-read from event->ctx->task,
> voiding all guarantees of the checks. Reuse the value that was read by
> READ_ONCE to ensure the consistency of the task struct throughout the
> function.
>
> Signed-off-by: Baptiste Lepers <baptiste.lepers@xxxxxxxxx>
> Fixes: 375637bc52495 ("perf/core: Introduce address range filtering")
Thanks!