Revision 9e368259ad988356c4c95150fafd1a06af095d98 authored by Andrea Arcangeli on 30 November 2018, 22:09:25 UTC, committed by Linus Torvalds on 30 November 2018, 22:56:14 UTC
Patch series "userfaultfd shmem updates".

Jann found two bugs in the userfaultfd shmem MAP_SHARED backend: the
lack of the VM_MAYWRITE check and the lack of i_size checks.

Then looking into the above we also fixed the MAP_PRIVATE case.

Hugh by source review also found a data loss source if UFFDIO_COPY is
used on shmem MAP_SHARED PROT_READ mappings (the production usages
incidentally run with PROT_READ|PROT_WRITE, so the data loss couldn't
happen in those production usages like with QEMU).

The whole patchset is marked for stable.

We verified QEMU postcopy live migration with guest running on shmem
MAP_PRIVATE run as well as before after the fix of shmem MAP_PRIVATE.
Regardless if it's shmem or hugetlbfs or MAP_PRIVATE or MAP_SHARED, QEMU
unconditionally invokes a punch hole if the guest mapping is filebacked
and a MADV_DONTNEED too (needed to get rid of the MAP_PRIVATE COWs and
for the anon backend).

This patch (of 5):

We internally used EFAULT to communicate with the caller, switch to
ENOENT, so EFAULT can be used as a non internal retval.

Link: http://lkml.kernel.org/r/20181126173452.26955-2-aarcange@redhat.com
Fixes: 4c27fe4c4c84 ("userfaultfd: shmem: add shmem_mcopy_atomic_pte for userfaultfd support")
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Reviewed-by: Mike Rapoport <rppt@linux.ibm.com>
Reviewed-by: Hugh Dickins <hughd@google.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Jann Horn <jannh@google.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: <stable@vger.kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 5618cf0
History
File Mode Size
Kconfig -rw-r--r-- 3.9 KB
Makefile -rw-r--r-- 870 bytes
array.c -rw-r--r-- 20.8 KB
base.c -rw-r--r-- 86.6 KB
cmdline.c -rw-r--r-- 415 bytes
consoles.c -rw-r--r-- 1.9 KB
cpuinfo.c -rw-r--r-- 698 bytes
devices.c -rw-r--r-- 1.1 KB
fd.c -rw-r--r-- 7.7 KB
fd.h -rw-r--r-- 539 bytes
generic.c -rw-r--r-- 17.4 KB
inode.c -rw-r--r-- 13.2 KB
internal.h -rw-r--r-- 8.8 KB
interrupts.c -rw-r--r-- 841 bytes
kcore.c -rw-r--r-- 15.0 KB
kmsg.c -rw-r--r-- 1.5 KB
loadavg.c -rw-r--r-- 880 bytes
meminfo.c -rw-r--r-- 5.1 KB
namespaces.c -rw-r--r-- 4.1 KB
nommu.c -rw-r--r-- 2.9 KB
page.c -rw-r--r-- 7.0 KB
proc_net.c -rw-r--r-- 9.2 KB
proc_sysctl.c -rw-r--r-- 41.0 KB
proc_tty.c -rw-r--r-- 4.5 KB
root.c -rw-r--r-- 4.9 KB
self.c -rw-r--r-- 1.8 KB
softirqs.c -rw-r--r-- 741 bytes
stat.c -rw-r--r-- 5.6 KB
task_mmu.c -rw-r--r-- 43.7 KB
task_nommu.c -rw-r--r-- 6.6 KB
thread_self.c -rw-r--r-- 1.9 KB
uptime.c -rw-r--r-- 922 bytes
util.c -rw-r--r-- 361 bytes
version.c -rw-r--r-- 515 bytes
vmcore.c -rw-r--r-- 39.9 KB

back to top