The patch titled Subject: userfaultfd: selftests: modify selftest to use /dev/userfaultfd has been added to the -mm mm-unstable branch. Its filename is userfaultfd-selftests-modify-selftest-to-use-dev-userfaultfd-v7.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/userfaultfd-selftests-modify-selftest-to-use-dev-userfaultfd-v7.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Axel Rasmussen <axelrasmussen@xxxxxxxxxx> Subject: userfaultfd: selftests: modify selftest to use /dev/userfaultfd Date: Fri, 19 Aug 2022 13:51:59 -0700 modify selftest to exit with KSFT_SKIP *only* when features are unsupported, exiting with 1 in other error cases, per Mike Link: https://lkml.kernel.org/r/20220819205201.658693-4-axelrasmussen@xxxxxxxxxx Signed-off-by: Axel Rasmussen <axelrasmussen@xxxxxxxxxx> Acked-by: Mike Rapoport <rppt@xxxxxxxxxxxxx> Acked-by: Peter Xu <peterx@xxxxxxxxxx> Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx> Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx> Cc: Dmitry V. Levin <ldv@xxxxxxxxxxxx> Cc: Gleb Fotengauer-Malinovskiy <glebfm@xxxxxxxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Cc: Jan Kara <jack@xxxxxxx> Cc: Jonathan Corbet <corbet@xxxxxxx> Cc: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx> Cc: Mike Kravetz <mike.kravetz@xxxxxxxxxx> Cc: Mike Rapoport <rppt@xxxxxxxxxx> Cc: Nadav Amit <namit@xxxxxxxxxx> Cc: Shuah Khan <shuah@xxxxxxxxxx> Cc: Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx> Cc: Suren Baghdasaryan <surenb@xxxxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Cc: Zhang Yi <yi.zhang@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- tools/testing/selftests/vm/userfaultfd.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) --- a/tools/testing/selftests/vm/userfaultfd.c~userfaultfd-selftests-modify-selftest-to-use-dev-userfaultfd-v7 +++ a/tools/testing/selftests/vm/userfaultfd.c @@ -402,13 +402,16 @@ static void assert_expected_ioctls_prese static int __userfaultfd_open_dev(void) { - int fd, _uffd = -1; + int fd, _uffd; fd = open("/dev/userfaultfd", O_RDWR | O_CLOEXEC); if (fd < 0) - return -1; + errexit(KSFT_SKIP, "opening /dev/userfaultfd failed"); _uffd = ioctl(fd, USERFAULTFD_IOC_NEW, UFFD_FLAGS); + if (_uffd < 0) + errexit(errno == ENOTTY ? KSFT_SKIP : 1, + "creating userfaultfd failed"); close(fd); return _uffd; } @@ -419,10 +422,12 @@ static void userfaultfd_open(uint64_t *f if (test_dev_userfaultfd) uffd = __userfaultfd_open_dev(); - else + else { uffd = syscall(__NR_userfaultfd, UFFD_FLAGS); - if (uffd < 0) - errexit(KSFT_SKIP, "creating userfaultfd failed"); + if (uffd < 0) + errexit(errno == ENOSYS ? KSFT_SKIP : 1, + "creating userfaultfd failed"); + } uffd_flags = fcntl(uffd, F_GETFD, NULL); uffdio_api.api = UFFD_API; _ Patches currently in -mm which might be from axelrasmussen@xxxxxxxxxx are selftests-vm-add-hugetlb_shared-userfaultfd-test-to-run_vmtestssh.patch userfaultfd-add-dev-userfaultfd-for-fine-grained-access-control.patch userfaultfd-add-dev-userfaultfd-for-fine-grained-access-control-v7.patch userfaultfd-selftests-modify-selftest-to-use-dev-userfaultfd.patch userfaultfd-selftests-modify-selftest-to-use-dev-userfaultfd-v7.patch userfaultfd-update-documentation-to-describe-dev-userfaultfd.patch userfaultfd-update-documentation-to-describe-dev-userfaultfd-v7.patch selftests-vm-add-dev-userfaultfd-test-cases-to-run_vmtestssh.patch