lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YK97DXkDbhH5BMdI@hirez.programming.kicks-ass.net>
Date:   Thu, 27 May 2021 12:57:17 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Marco Elver <elver@...gle.com>
Cc:     mingo@...hat.com, acme@...nel.org, mark.rutland@....com,
        alexander.shishkin@...ux.intel.com, jolsa@...hat.com,
        namhyung@...nel.org, linux-perf-users@...r.kernel.org,
        linux-kernel@...r.kernel.org, kasan-dev@...glegroups.com,
        dvyukov@...gle.com,
        syzbot+142c9018f5962db69c7e@...kaller.appspotmail.com
Subject: Re: [PATCH] perf: Fix data race between pin_count increment/decrement

On Thu, May 27, 2021 at 12:47:11PM +0200, Marco Elver wrote:
> KCSAN reports a data race between increment and decrement of pin_count:
> 
>   write to 0xffff888237c2d4e0 of 4 bytes by task 15740 on cpu 1:
>    find_get_context		kernel/events/core.c:4617
>    __do_sys_perf_event_open	kernel/events/core.c:12097 [inline]
>    __se_sys_perf_event_open	kernel/events/core.c:11933
>    ...
>   read to 0xffff888237c2d4e0 of 4 bytes by task 15743 on cpu 0:
>    perf_unpin_context		kernel/events/core.c:1525 [inline]
>    __do_sys_perf_event_open	kernel/events/core.c:12328 [inline]
>    __se_sys_perf_event_open	kernel/events/core.c:11933
>    ...
> 
> Because neither read-modify-write here is atomic, this can lead to one of the
> operations being lost, resulting in an inconsistent pin_count. Fix it by adding
> the missing locking in the CPU-event case.
> 

Indeed so!

Fixes: fe4b04fa31a6 ("perf: Cure task_oncpu_function_call() races")

> Reported-by: syzbot+142c9018f5962db69c7e@...kaller.appspotmail.com
> Signed-off-by: Marco Elver <elver@...gle.com>

Thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ