summaryrefslogtreecommitdiffstats
path: root/mm/page_ext.c
diff options
context:
space:
mode:
authorNadav Amit <namit@vmware.com>2021-10-18 15:15:25 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2021-10-18 20:22:02 -1000
commitcb185d5f1ebf900f4ae3bf84cee212e6dd035aca (patch)
tree1156aa57eb9c1c0c0c52a72ddb33fa91e827584f /mm/page_ext.c
parent8913970c19915bbe773d97d42989cd85b7fdc098 (diff)
downloadlinux-cb185d5f1ebf900f4ae3bf84cee212e6dd035aca.tar.gz
linux-cb185d5f1ebf900f4ae3bf84cee212e6dd035aca.tar.bz2
linux-cb185d5f1ebf900f4ae3bf84cee212e6dd035aca.zip
userfaultfd: fix a race between writeprotect and exit_mmap()
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. Link: https://lkml.kernel.org/r/20210921200247.25749-1-namit@vmware.com Fixes: 63b2d4174c4ad ("userfaultfd: wp: add the writeprotect API to userfaultfd ioctl") Signed-off-by: Nadav Amit <namit@vmware.com> Tested-by: Li Wang <liwang@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_ext.c')
0 files changed, 0 insertions, 0 deletions