Commit 63b2d41
userfaultfd: wp: add the writeprotect API to userfaultfd ioctl
Introduce the new uffd-wp APIs for userspace.
Firstly, we'll allow to do UFFDIO_REGISTER with write protection tracking
using the new UFFDIO_REGISTER_MODE_WP flag. Note that this flag can
co-exist with the existing UFFDIO_REGISTER_MODE_MISSING, in which case the
userspace program can not only resolve missing page faults, and at the
same time tracking page data changes along the way.
Secondly, we introduced the new UFFDIO_WRITEPROTECT API to do page level
write protection tracking. Note that we will need to register the memory
region with UFFDIO_REGISTER_MODE_WP before that.
[peterx@redhat.com: write up the commit message]
[peterx@redhat.com: remove useless block, write commit message, check against
VM_MAYWRITE rather than VM_WRITE when register]
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Cc: Bobby Powers <bobbypowers@gmail.com>
Cc: Brian Geffon <bgeffon@google.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Denis Plotnikov <dplotnikov@virtuozzo.com>
Cc: "Dr . David Alan Gilbert" <dgilbert@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: "Kirill A . Shutemov" <kirill@shutemov.name>
Cc: Martin Cracauer <cracauer@cons.org>
Cc: Marty McFadden <mcfadden8@llnl.gov>
Cc: Maya Gokhale <gokhale2@llnl.gov>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
Cc: Pavel Emelyanov <xemul@openvz.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Shaohua Li <shli@fb.com>
Link: http://lkml.kernel.org/r/20200220163112.11409-14-peterx@redhat.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>1 parent ffd0579 commit 63b2d41
2 files changed
+89
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
314 | 314 | | |
315 | 315 | | |
316 | 316 | | |
317 | | - | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
318 | 320 | | |
| 321 | + | |
319 | 322 | | |
320 | 323 | | |
321 | 324 | | |
| |||
328 | 331 | | |
329 | 332 | | |
330 | 333 | | |
| 334 | + | |
| 335 | + | |
331 | 336 | | |
332 | 337 | | |
333 | 338 | | |
| |||
1287 | 1292 | | |
1288 | 1293 | | |
1289 | 1294 | | |
1290 | | - | |
| 1295 | + | |
| 1296 | + | |
1291 | 1297 | | |
1292 | | - | |
1293 | | - | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
1294 | 1302 | | |
1295 | 1303 | | |
1296 | 1304 | | |
| |||
1322 | 1330 | | |
1323 | 1331 | | |
1324 | 1332 | | |
1325 | | - | |
| 1333 | + | |
1326 | 1334 | | |
1327 | | - | |
1328 | | - | |
1329 | | - | |
1330 | | - | |
1331 | | - | |
1332 | | - | |
1333 | | - | |
1334 | 1335 | | |
1335 | 1336 | | |
1336 | 1337 | | |
| |||
1380 | 1381 | | |
1381 | 1382 | | |
1382 | 1383 | | |
1383 | | - | |
| 1384 | + | |
1384 | 1385 | | |
1385 | 1386 | | |
1386 | 1387 | | |
| |||
1408 | 1409 | | |
1409 | 1410 | | |
1410 | 1411 | | |
| 1412 | + | |
| 1413 | + | |
1411 | 1414 | | |
1412 | 1415 | | |
1413 | 1416 | | |
| |||
1437 | 1440 | | |
1438 | 1441 | | |
1439 | 1442 | | |
1440 | | - | |
| 1443 | + | |
1441 | 1444 | | |
1442 | 1445 | | |
1443 | 1446 | | |
| |||
1575 | 1578 | | |
1576 | 1579 | | |
1577 | 1580 | | |
1578 | | - | |
| 1581 | + | |
1579 | 1582 | | |
1580 | 1583 | | |
1581 | 1584 | | |
| |||
1589 | 1592 | | |
1590 | 1593 | | |
1591 | 1594 | | |
1592 | | - | |
| 1595 | + | |
1593 | 1596 | | |
1594 | 1597 | | |
1595 | 1598 | | |
| |||
1802 | 1805 | | |
1803 | 1806 | | |
1804 | 1807 | | |
| 1808 | + | |
| 1809 | + | |
| 1810 | + | |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
1805 | 1852 | | |
1806 | 1853 | | |
1807 | 1854 | | |
| |||
1883 | 1930 | | |
1884 | 1931 | | |
1885 | 1932 | | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
1886 | 1936 | | |
1887 | 1937 | | |
1888 | 1938 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| |||
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| 72 | + | |
| 73 | + | |
71 | 74 | | |
72 | 75 | | |
73 | 76 | | |
| |||
232 | 235 | | |
233 | 236 | | |
234 | 237 | | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
235 | 258 | | |
0 commit comments