From c2b3668b373048958fab20dba85cf50145f85134 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Thu, 27 Apr 2017 19:19:20 +0200 Subject: [PATCH] userfaultfd.2: Minor tweaks to Mike Rapoport's patch Signed-off-by: Michael Kerrisk --- man2/userfaultfd.2 | 58 +++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 32 deletions(-) diff --git a/man2/userfaultfd.2 b/man2/userfaultfd.2 index a6c482766..e6fcd3f3b 100644 --- a/man2/userfaultfd.2 +++ b/man2/userfaultfd.2 @@ -101,11 +101,10 @@ needs to be aware of the changes in the virtual memory layout of the faulting process to avoid memory corruption. Starting from Linux 4.11, -userfaultfd may notify the fault-handling threads about changes +userfaultfd can also notify the fault-handling threads about changes in the virtual memory layout of the faulting process. In addition, if the faulting process invokes -.BR fork (2) -system call, +.BR fork (2), the userfaultfd objects associated with the parent may be duplicated into the child process and the userfaultfd monitor will be notified about the file descriptor associated with the userfault objects @@ -164,7 +163,6 @@ operation. Up to Linux 4.11, userfaultfd can be used only with anonymous private memory mappings. - Since Linux 4.11, userfaultfd can be also used with hugetlbfs and shared memory mappings. @@ -180,30 +178,29 @@ or an event required for the non-cooperative userfaultfd usage: .nf .in +4n struct uffd_msg { - __u8 event; /* Type of event */ + __u8 event; /* Type of event */ ... union { struct { - __u64 flags; /* Flags describing fault */ - __u64 address; /* Faulting address */ + __u64 flags; /* Flags describing fault */ + __u64 address; /* Faulting address */ } pagefault; - struct { - __u32 ufd; /* userfault file descriptor - of the child process */ - } fork; /* since Linux 4.11 */ - struct { - __u64 from; /* old address of the - remapped area */ - __u64 to; /* new address of the - remapped area */ - __u64 len; /* original mapping length */ - } remap; /* since Linux 4.11 */ - struct { - __u64 start; /* start address of the - removed area */ - __u64 end; /* end address of the - removed area */ - } remove; /* since Linux 4.11 */ + + struct { /* Since Linux 4.11 */ + __u32 ufd; /* Userfault file descriptor + of the child process */ + } fork; + + struct { /* Since Linux 4.11 */ + __u64 from; /* Old address of remapped area */ + __u64 to; /* New address of remapped area */ + __u64 len; /* Original mapping length */ + } remap; + + struct { /* Since Linux 4.11 */ + __u64 start; /* Start address of removed area */ + __u64 end; /* End address of removed area */ + } remove; ... } arg; @@ -252,8 +249,7 @@ field. .TP .BR UFFD_EVENT_FORK " (since Linux 4.11)" Generated when the faulting process invokes -.BR fork (2) -system call. +.BR fork (2). The event details are available in the .I fork field. @@ -261,8 +257,7 @@ field. .TP .BR UFFD_EVENT_REMAP " (since Linux 4.11)" Generated when the faulting process invokes -.BR mremap (2) -system call. +.BR mremap (2). The event details are available in the .I remap field. @@ -270,7 +265,7 @@ field. .BR UFFD_EVENT_REMOVE " (since Linux 4.11)" Generated when the faulting process invokes .BR madvise (2) -system call with +with .BR MADV_DONTNEED or .BR MADV_REMOVE @@ -283,11 +278,10 @@ field. Generated when the faulting process unmaps a memory range, either explicitly using .BR munmap (2) -system call or implicitly during +or implicitly during .BR mmap (2) or -.BR mremap (2) -system calls. +.BR mremap (2). The event details are available in the .I remove field.