Debian Codegraph @

upstream/debian-unstable/man2/UFFDIO_WRITEPROTECT.2const

raw
1 .\" Copyright 2016, International Business Machines Corp.
2 .\" Copyright 2016, Michael Kerrisk <[email protected]>
3 .\" Copyright, the authors of the Linux man-pages project
4 .\"
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\"
7 .TH UFFDIO_WRITEPROTECT 2const 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 UFFDIO_WRITEPROTECT
10 \-
11 write-protect or write-unprotect a userfaultfd-registered memory range
12 .SH LIBRARY
13 Standard C library
14 .RI ( libc ,\~ \-lc )
15 .SH SYNOPSIS
16 .nf
17 .BR "#include <linux/userfaultfd.h>" " /* Definition of " UFFD* " constants */"
18 .B #include <sys/ioctl.h>
19 .P
20 .BI "int ioctl(int " fd ", UFFDIO_WRITEPROTECT, ...);"
21 .P
22 .B #include <linux/userfaultfd.h>
23 .P
24 .fi
25 .EX
26 .B struct uffdio_writeprotect {
27 .BR " struct uffdio_range range;" " /* Range to change write permission*/"
28 .BR " __u64 mode;" " /* Mode to change write permission */"
29 .B };
30 .EE
31 .SH DESCRIPTION
32 Write-protect or write-unprotect a userfaultfd-registered memory range
33 registered with mode
34 .BR UFFDIO_REGISTER_MODE_WP .
35 .P
36 There are two mode bits that are supported in this structure:
37 .TP
38 .B UFFDIO_WRITEPROTECT_MODE_WP
39 When this mode bit is set,
40 the ioctl will be a write-protect operation upon the memory range specified by
41 .IR range .
42 Otherwise it will be a write-unprotect operation upon the specified range,
43 which can be used to resolve a userfaultfd write-protect page fault.
44 .TP
45 .B UFFDIO_WRITEPROTECT_MODE_DONTWAKE
46 When this mode bit is set,
47 do not wake up any thread that waits for
48 page-fault resolution after the operation.
49 This can be specified only if
50 .B UFFDIO_WRITEPROTECT_MODE_WP
51 is not specified.
52 .SH RETURN VALUE
53 On success,
54 0 is returned.
55 On error, \-1 is returned and
56 .I errno
57 is set to indicate the error.
58 .SH ERRORS
59 .TP
60 .B EINVAL
61 The
62 .I start
63 or the
64 .I len
65 field of the
66 .I ufdio_range
67 structure was not a multiple of the system page size;
68 or
69 .I len
70 was zero;
71 or the specified range was otherwise invalid.
72 .TP
73 .B EAGAIN
74 The process was interrupted;
75 retry this call.
76 .TP
77 .B ENOENT
78 The range specified in
79 .I range
80 is not valid.
81 For example, the virtual address does not exist,
82 or not registered with userfaultfd write-protect mode.
83 .TP
84 .B EFAULT
85 Encountered a generic fault during processing.
86 .SH STANDARDS
87 Linux.
88 .SH HISTORY
89 Linux 5.7.
90 .SH EXAMPLES
91 See
92 .BR userfaultfd (2).
93 .SH SEE ALSO
94 .BR ioctl (2),
95 .BR ioctl_userfaultfd (2),
96 .BR userfaultfd (2)
97 .P
98 .I Documentation/admin\-guide/mm/userfaultfd.rst
99 in the Linux kernel source tree