• Peter Xu's avatar
    userfaultfd/selftests: add pagemap uffd-wp test · eb3b2e00
    Peter Xu authored
    Add one anonymous specific test to start using pagemap.  With pagemap
    support, we can directly read the uffd-wp bit from pgtable without
    triggering any fault, so it's easier to do sanity checks in unit tests.
    
    Meanwhile this test also leverages the newly introduced MADV_PAGEOUT
    madvise function to test swap ptes with uffd-wp bit set, and across
    fork()s.
    
    Link: https://lkml.kernel.org/r/20210428225030.9708-7-peterx@redhat.comSigned-off-by: default avatarPeter Xu <peterx@redhat.com>
    Cc: Alexander Viro <viro@zeniv.linux.org.uk>
    Cc: Andrea Arcangeli <aarcange@redhat.com>
    Cc: Axel Rasmussen <axelrasmussen@google.com>
    Cc: Brian Geffon <bgeffon@google.com>
    Cc: "Dr . David Alan Gilbert" <dgilbert@redhat.com>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Jerome Glisse <jglisse@redhat.com>
    Cc: Joe Perches <joe@perches.com>
    Cc: Kirill A. Shutemov <kirill@shutemov.name>
    Cc: Lokesh Gidra <lokeshgidra@google.com>
    Cc: Mike Kravetz <mike.kravetz@oracle.com>
    Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
    Cc: Mina Almasry <almasrymina@google.com>
    Cc: Oliver Upton <oupton@google.com>
    Cc: Shaohua Li <shli@fb.com>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Stephen Rothwell <sfr@canb.auug.org.au>
    Cc: Wang Qing <wangqing@vivo.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    eb3b2e00
userfaultfd.c 42.6 KB