linux/tools
Peter Xu 9b12488a77 userfaultfd: selftests: add write-protect test
Add uffd tests for write protection.

Instead of introducing new tests for it, let's simply squashing uffd-wp
tests into existing uffd-missing test cases.  Changes are:

(1) Bouncing tests

  We do the write-protection in two ways during the bouncing test:

  - By using UFFDIO_COPY_MODE_WP when resolving MISSING pages: then
    we'll make sure for each bounce process every single page will be
    at least fault twice: once for MISSING, once for WP.

  - By direct call UFFDIO_WRITEPROTECT on existing faulted memories:
    To further torture the explicit page protection procedures of
    uffd-wp, we split each bounce procedure into two halves (in the
    background thread): the first half will be MISSING+WP for each
    page as explained above.  After the first half, we write protect
    the faulted region in the background thread to make sure at least
    half of the pages will be write protected again which is the first
    half to test the new UFFDIO_WRITEPROTECT call.  Then we continue
    with the 2nd half, which will contain both MISSING and WP faulting
    tests for the 2nd half and WP-only faults from the 1st half.

(2) Event/Signal test

  Mostly previous tests but will do MISSING+WP for each page.  For
  sigbus-mode test we'll need to provide standalone path to handle the
  write protection faults.

For all tests, do statistics as well for uffd-wp pages.

Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Andrea Arcangeli <aarcange@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: Jerome Glisse <jglisse@redhat.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-20-peterx@redhat.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-04-07 10:43:40 -07:00
..
accounting SPDX patches for 5.7-rc1. 2020-04-03 13:12:26 -07:00
arch ARM: 2020-04-02 15:13:15 -07:00
bootconfig New tracing features: 2020-04-05 10:36:18 -07:00
bpf SPDX patches for 5.7-rc1. 2020-04-03 13:12:26 -07:00
build perf updates all over the place: 2020-04-05 12:26:24 -07:00
cgroup .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
debugging
edid tools/edid: Move EDID data sets from Documentation/ 2020-02-19 04:10:32 -07:00
firewire
firmware
gpio This is the bulk of GPIO development for the v5.7 kernel cycle. 2020-04-04 10:27:00 -07:00
hv Tools: hv: Reopen the devices if read() or write() returns errors 2020-01-26 22:10:10 -05:00
iio .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
include perf updates all over the place: 2020-04-05 12:26:24 -07:00
io_uring
kvm/kvm_stat tools/kvm_stat: add command line switch '-c' to log in csv format 2020-03-23 15:44:21 -04:00
laptop .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
leds .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
lib perf updates all over the place: 2020-04-05 12:26:24 -07:00
memory-model .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
nfsd
objtool SPDX patches for 5.7-rc1. 2020-04-03 13:12:26 -07:00
pci tools: PCI: Add 'e' to clear IRQ 2020-04-02 17:57:10 +01:00
pcmcia .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
perf perf updates all over the place: 2020-04-05 12:26:24 -07:00
power SPDX patches for 5.7-rc1. 2020-04-03 13:12:26 -07:00
scripts Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-03-25 18:58:11 -07:00
spi SPDX patches for 5.7-rc1. 2020-04-03 13:12:26 -07:00
testing userfaultfd: selftests: add write-protect test 2020-04-07 10:43:40 -07:00
thermal/tmon .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
time
usb .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
virtio .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
vm .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
wmi
Makefile tools: bootconfig: Add bootconfig command 2020-01-13 13:19:39 -05:00