diff options
| author | Mike Rapoport <rppt@linux.vnet.ibm.com> | 2017-02-24 17:58:22 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-02-24 20:46:55 -0500 |
| commit | 897ab3e0c49e24b62e2d54d165c7afec6bbca65b (patch) | |
| tree | 5fa7e09864d6c959cef33849f6cb10ed04e459e4 /arch/x86/mm/mpx.c | |
| parent | 846b1a0f1db065a8479159dd8fecddb1ebf30547 (diff) | |
userfaultfd: non-cooperative: add event for memory unmaps
When a non-cooperative userfaultfd monitor copies pages in the
background, it may encounter regions that were already unmapped.
Addition of UFFD_EVENT_UNMAP allows the uffd monitor to track precisely
changes in the virtual memory layout.
Since there might be different uffd contexts for the affected VMAs, we
first should create a temporary representation for the unmap event for
each uffd context and then notify them one by one to the appropriate
userfault file descriptors.
The event notification occurs after the mmap_sem has been released.
[arnd@arndb.de: fix nommu build]
Link: http://lkml.kernel.org/r/20170203165141.3665284-1-arnd@arndb.de
[mhocko@suse.com: fix nommu build]
Link: http://lkml.kernel.org/r/20170202091503.GA22823@dhcp22.suse.cz
Link: http://lkml.kernel.org/r/1485542673-24387-3-git-send-email-rppt@linux.vnet.ibm.com
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Hillf Danton <hillf.zj@alibaba-inc.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86/mm/mpx.c')
| -rw-r--r-- | arch/x86/mm/mpx.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/mm/mpx.c b/arch/x86/mm/mpx.c index aad4ac386f98..c98079684bdb 100644 --- a/arch/x86/mm/mpx.c +++ b/arch/x86/mm/mpx.c | |||
| @@ -51,7 +51,7 @@ static unsigned long mpx_mmap(unsigned long len) | |||
| 51 | 51 | ||
| 52 | down_write(&mm->mmap_sem); | 52 | down_write(&mm->mmap_sem); |
| 53 | addr = do_mmap(NULL, 0, len, PROT_READ | PROT_WRITE, | 53 | addr = do_mmap(NULL, 0, len, PROT_READ | PROT_WRITE, |
| 54 | MAP_ANONYMOUS | MAP_PRIVATE, VM_MPX, 0, &populate); | 54 | MAP_ANONYMOUS | MAP_PRIVATE, VM_MPX, 0, &populate, NULL); |
| 55 | up_write(&mm->mmap_sem); | 55 | up_write(&mm->mmap_sem); |
| 56 | if (populate) | 56 | if (populate) |
| 57 | mm_populate(addr, populate); | 57 | mm_populate(addr, populate); |
| @@ -893,7 +893,7 @@ static int unmap_entire_bt(struct mm_struct *mm, | |||
| 893 | * avoid recursion, do_munmap() will check whether it comes | 893 | * avoid recursion, do_munmap() will check whether it comes |
| 894 | * from one bounds table through VM_MPX flag. | 894 | * from one bounds table through VM_MPX flag. |
| 895 | */ | 895 | */ |
| 896 | return do_munmap(mm, bt_addr, mpx_bt_size_bytes(mm)); | 896 | return do_munmap(mm, bt_addr, mpx_bt_size_bytes(mm), NULL); |
| 897 | } | 897 | } |
| 898 | 898 | ||
| 899 | static int try_unmap_single_bt(struct mm_struct *mm, | 899 | static int try_unmap_single_bt(struct mm_struct *mm, |
