Commit d9f411ba authored by Peter Xu's avatar Peter Xu Committed by Linus Torvalds

userfaultfd/selftests: hint the test runner on required privilege

Now userfaultfd test program requires either root or ptrace privilege due
to the signal/event tests.  When UFFDIO_API failed, hint the test runner
about this fact verbosely.

Link: https://lkml.kernel.org/r/20201208024709.7701-4-peterx@redhat.comSigned-off-by: default avatarPeter Xu <peterx@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 1e17a24e
...@@ -794,7 +794,8 @@ static int userfaultfd_open(int features) ...@@ -794,7 +794,8 @@ static int userfaultfd_open(int features)
uffdio_api.api = UFFD_API; uffdio_api.api = UFFD_API;
uffdio_api.features = features; uffdio_api.features = features;
if (ioctl(uffd, UFFDIO_API, &uffdio_api)) { if (ioctl(uffd, UFFDIO_API, &uffdio_api)) {
fprintf(stderr, "UFFDIO_API\n"); fprintf(stderr, "UFFDIO_API failed.\nPlease make sure to "
"run with either root or ptrace capability.\n");
return 1; return 1;
} }
if (uffdio_api.api != UFFD_API) { if (uffdio_api.api != UFFD_API) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment