lkml.org 
[lkml]   [2021]   [Sep]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.4 219/260] events: Reuse value read using READ_ONCE instead of re-reading it
    Date
    From: Baptiste Lepers <baptiste.lepers@gmail.com>

    commit b89a05b21f46150ac10a962aa50109250b56b03b upstream.

    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.

    Fixes: 375637bc52495 ("perf/core: Introduce address range filtering")
    Signed-off-by: Baptiste Lepers <baptiste.lepers@gmail.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Link: https://lkml.kernel.org/r/20210906015310.12802-1-baptiste.lepers@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    kernel/events/core.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    --- a/kernel/events/core.c
    +++ b/kernel/events/core.c
    @@ -9259,7 +9259,7 @@ static void perf_event_addr_filters_appl
    return;

    if (ifh->nr_file_filters) {
    - mm = get_task_mm(event->ctx->task);
    + mm = get_task_mm(task);
    if (!mm)
    goto restart;


    \
     
     \ /
      Last update: 2021-09-20 20:24    [W:4.052 / U:0.080 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site