[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YUs+HZOf6mnI6mm2@t490s>
Date: Wed, 22 Sep 2021 10:30:53 -0400
From: Peter Xu <peterx@...hat.com>
To: Nadav Amit <nadav.amit@...il.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
linux-fsdevel@...r.kernel.org, Nadav Amit <namit@...are.com>,
Andrea Arcangeli <aarcange@...hat.com>, stable@...r.kernel.org
Subject: Re: [PATCH] userfaultfd: fix a race between writeprotect and
exit_mmap()
On Tue, Sep 21, 2021 at 01:02:47PM -0700, Nadav Amit wrote:
> From: Nadav Amit <namit@...are.com>
>
> A race is possible when a process exits, its VMAs are removed
> by exit_mmap() and at the same time userfaultfd_writeprotect() is
> called.
>
> The race was detected by KASAN on a development kernel, but it appears
> to be possible on vanilla kernels as well.
>
> Use mmget_not_zero() to prevent the race as done in other userfaultfd
> operations.
>
> Cc: Peter Xu <peterx@...hat.com>
> Cc: Andrea Arcangeli <aarcange@...hat.com>
> Cc: stable@...r.kernel.org
> Fixes: 63b2d4174c4ad ("userfaultfd: wp: add the writeprotect API to userfaultfd ioctl")
> Signed-off-by: Nadav Amit <namit@...are.com>
Reviewed-by: Peter Xu <peterx@...hat.com>
Thanks!
--
Peter Xu
Powered by blists - more mailing lists