From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752798AbdAZFvF (ORCPT ); Thu, 26 Jan 2017 00:51:05 -0500 Received: from out0-131.mail.aliyun.com ([140.205.0.131]:55044 "EHLO out0-131.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752448AbdAZFvE (ORCPT ); Thu, 26 Jan 2017 00:51:04 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e02c03291;MF=hillf.zj@alibaba-inc.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---.7WH3p4X_1485409828; Reply-To: "Hillf Danton" From: "Hillf Danton" To: "'Mike Rapoport'" , "'Linux-MM'" Cc: "'Andrea Arcangeli'" , "'Andrew Morton'" , "'Dr. David Alan Gilbert'" , "'Mike Kravetz'" , "'Pavel Emelyanov'" , "'LKML'" References: <1485265923-20256-1-git-send-email-rppt@linux.vnet.ibm.com> In-Reply-To: <1485265923-20256-1-git-send-email-rppt@linux.vnet.ibm.com> Subject: Re: [RFC PATCH 0/5] userfaultfd: non-cooperative: better tracking for mapping changes Date: Thu, 26 Jan 2017 13:50:27 +0800 Message-ID: <008001d27798$1dd18390$59748ab0$@alibaba-inc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQJE0r5kG9nlZmEW03QJGE2r3183qqBliiLg Content-Language: zh-cn Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On January 24, 2017 9:52 PM Mike Rapoport wrote: > Hi, > > These patches try to address issues I've encountered during integration of > userfaultfd with CRIU. > Previously added userfaultfd events for fork(), madvise() and mremap() > unfortunately do not cover all possible changes to a process virtual memory > layout required for uffd monitor. > When one or more VMAs is removed from the process mm, the external uffd > monitor has no way to detect those changes and will attempt to fill the > removed regions with userfaultfd_copy. > Another problematic event is the exit() of the process. Here again, the > external uffd monitor will try to use userfaultfd_copy, although mm owning > the memory has already gone. > > The first patch in the series is a minor cleanup and it's not strictly > related to the rest of the series. > > The patches 2 and 3 below add UFFD_EVENT_UNMAP and UFFD_EVENT_EXIT to allow > the uffd monitor track changes in the memory layout of a process. > > The patches 4 and 5 amend error codes returned by userfaultfd_copy to make > the uffd monitor able to cope with races that might occur between delivery > of unmap and exit events and outstanding userfaultfd_copy's. > > The patches are agains current -mm tree. > > Mike Rapoport (5): > mm: call vm_munmap in munmap syscall instead of using open coded version > userfaultfd: non-cooperative: add event for memory unmaps > userfaultfd: non-cooperative: add event for exit() notification > userfaultfd: mcopy_atomic: return -ENOENT when no compatible VMA found > userfaultfd_copy: return -ENOSPC in case mm has gone > > arch/tile/mm/elf.c | 2 +- > arch/x86/entry/vdso/vma.c | 2 +- > arch/x86/mm/mpx.c | 2 +- > fs/aio.c | 2 +- > fs/proc/vmcore.c | 4 +- > fs/userfaultfd.c | 91 ++++++++++++++++++++++++++++++++++++++++ > include/linux/mm.h | 14 ++++--- > include/linux/userfaultfd_k.h | 25 +++++++++++ > include/uapi/linux/userfaultfd.h | 8 +++- > ipc/shm.c | 6 +-- > kernel/exit.c | 2 + > mm/mmap.c | 55 ++++++++++++++---------- > mm/mremap.c | 23 ++++++---- > mm/userfaultfd.c | 42 ++++++++++--------- > mm/util.c | 5 ++- > 15 files changed, 215 insertions(+), 68 deletions(-) > > -- Acked-by: Hillf Danton