userfaultfd.2: Minor tweaks to Mike Rapoport's patch

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2017-04-27 19:19:20 +02:00
parent 6c12d34e9f
commit c2b3668b37
1 changed files with 26 additions and 32 deletions

View File

@ -101,11 +101,10 @@ needs to be aware of the changes in the virtual memory layout
of the faulting process to avoid memory corruption. of the faulting process to avoid memory corruption.
Starting from Linux 4.11, 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 the virtual memory layout of the faulting process.
In addition, if the faulting process invokes In addition, if the faulting process invokes
.BR fork (2) .BR fork (2),
system call,
the userfaultfd objects associated with the parent may be duplicated the userfaultfd objects associated with the parent may be duplicated
into the child process and the userfaultfd monitor will be notified into the child process and the userfaultfd monitor will be notified
about the file descriptor associated with the userfault objects about the file descriptor associated with the userfault objects
@ -164,7 +163,6 @@ operation.
Up to Linux 4.11, Up to Linux 4.11,
userfaultfd can be used only with anonymous private memory mappings. userfaultfd can be used only with anonymous private memory mappings.
Since Linux 4.11, Since Linux 4.11,
userfaultfd can be also used with hugetlbfs and shared memory mappings. 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 .nf
.in +4n .in +4n
struct uffd_msg { struct uffd_msg {
__u8 event; /* Type of event */ __u8 event; /* Type of event */
... ...
union { union {
struct { struct {
__u64 flags; /* Flags describing fault */ __u64 flags; /* Flags describing fault */
__u64 address; /* Faulting address */ __u64 address; /* Faulting address */
} pagefault; } pagefault;
struct {
__u32 ufd; /* userfault file descriptor struct { /* Since Linux 4.11 */
of the child process */ __u32 ufd; /* Userfault file descriptor
} fork; /* since Linux 4.11 */ of the child process */
struct { } fork;
__u64 from; /* old address of the
remapped area */ struct { /* Since Linux 4.11 */
__u64 to; /* new address of the __u64 from; /* Old address of remapped area */
remapped area */ __u64 to; /* New address of remapped area */
__u64 len; /* original mapping length */ __u64 len; /* Original mapping length */
} remap; /* since Linux 4.11 */ } remap;
struct {
__u64 start; /* start address of the struct { /* Since Linux 4.11 */
removed area */ __u64 start; /* Start address of removed area */
__u64 end; /* end address of the __u64 end; /* End address of removed area */
removed area */ } remove;
} remove; /* since Linux 4.11 */
... ...
} arg; } arg;
@ -252,8 +249,7 @@ field.
.TP .TP
.BR UFFD_EVENT_FORK " (since Linux 4.11)" .BR UFFD_EVENT_FORK " (since Linux 4.11)"
Generated when the faulting process invokes Generated when the faulting process invokes
.BR fork (2) .BR fork (2).
system call.
The event details are available in the The event details are available in the
.I fork .I fork
field. field.
@ -261,8 +257,7 @@ field.
.TP .TP
.BR UFFD_EVENT_REMAP " (since Linux 4.11)" .BR UFFD_EVENT_REMAP " (since Linux 4.11)"
Generated when the faulting process invokes Generated when the faulting process invokes
.BR mremap (2) .BR mremap (2).
system call.
The event details are available in the The event details are available in the
.I remap .I remap
field. field.
@ -270,7 +265,7 @@ field.
.BR UFFD_EVENT_REMOVE " (since Linux 4.11)" .BR UFFD_EVENT_REMOVE " (since Linux 4.11)"
Generated when the faulting process invokes Generated when the faulting process invokes
.BR madvise (2) .BR madvise (2)
system call with with
.BR MADV_DONTNEED .BR MADV_DONTNEED
or or
.BR MADV_REMOVE .BR MADV_REMOVE
@ -283,11 +278,10 @@ field.
Generated when the faulting process unmaps a memory range, Generated when the faulting process unmaps a memory range,
either explicitly using either explicitly using
.BR munmap (2) .BR munmap (2)
system call or implicitly during or implicitly during
.BR mmap (2) .BR mmap (2)
or or
.BR mremap (2) .BR mremap (2).
system calls.
The event details are available in the The event details are available in the
.I remove .I remove
field. field.