Re: [PATCHv2] perf: Fix race in perf_mmap_close function

2020-09-16 Thread Jiri Olsa
On Wed, Sep 16, 2020 at 03:54:02PM +0200, pet...@infradead.org wrote: > On Wed, Sep 16, 2020 at 01:53:11PM +0200, Jiri Olsa wrote: > > There's a possible race in perf_mmap_close when checking ring buffer's > > mmap_count refcount value. The problem is that the mmap_count check is > > not atomic bec

Re: [PATCHv2] perf: Fix race in perf_mmap_close function

2020-09-16 Thread peterz
On Wed, Sep 16, 2020 at 01:53:11PM +0200, Jiri Olsa wrote: > There's a possible race in perf_mmap_close when checking ring buffer's > mmap_count refcount value. The problem is that the mmap_count check is > not atomic because we call atomic_dec and atomic_read separately. > > perf_mmap_close: >

Re: [PATCHv2] perf: Fix race in perf_mmap_close function

2020-09-16 Thread peterz
On Wed, Sep 16, 2020 at 01:53:11PM +0200, Jiri Olsa wrote: > There's a possible race in perf_mmap_close when checking ring buffer's > mmap_count refcount value. The problem is that the mmap_count check is > not atomic because we call atomic_dec and atomic_read separately. > > perf_mmap_close: >

[PATCHv2] perf: Fix race in perf_mmap_close function

2020-09-16 Thread Jiri Olsa
There's a possible race in perf_mmap_close when checking ring buffer's mmap_count refcount value. The problem is that the mmap_count check is not atomic because we call atomic_dec and atomic_read separately. perf_mmap_close: ... atomic_dec(&rb->mmap_count); ... if (atomic_read(&rb->mm