mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-26 12:30:23 +09:00
FROMGIT: userfaultfd/selftests: use user mode only
Patch series "userfaultfd/selftests: A few cleanups". I wanted to cleanup userfaultfd.c fault handling for a long time. If it's not cleaned, when the new code grows the file it'll also grow the size that needs to be cleaned... This is my attempt to cleanup the userfaultfd selftest on fault handling, to use an err() macro instead of either fprintf() or perror() then another exit() call. The huge cleanup is done in the last patch. The first 4 patches are some other standalone cleanups for the same file, so I put them together. This patch (of 5): Userfaultfd selftest does not need to handle kernel initiated fault. Set user mode so it can be run even if unprivileged_userfaultfd=0 (which is the default). Link: https://lkml.kernel.org/r/20210310004511.51996-2-peterx@redhat.com Signed-off-by: Peter Xu <peterx@redhat.com> Reviewed-by: Axel Rasmussen <axelrasmussen@google.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Nadav Amit <nadav.amit@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> (cherry picked from commit eaf221e6a1916d2471309800e4534bdc0698af33 https: //git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git akpm) Link: https://lore.kernel.org/patchwork/patch/1392475/ Signed-off-by: Lokesh Gidra <lokeshgidra@google.com> Bug: 160737021 Bug: 169683130 Change-Id: Ie3f0708b3c1a25ea66e4e0795e4ea54ca938c7a1
This commit is contained in:
@@ -372,7 +372,7 @@ static int userfaultfd_open(uint64_t *features)
|
||||
{
|
||||
struct uffdio_api uffdio_api;
|
||||
|
||||
uffd = syscall(__NR_userfaultfd, O_CLOEXEC | O_NONBLOCK);
|
||||
uffd = syscall(__NR_userfaultfd, O_CLOEXEC | O_NONBLOCK | UFFD_USER_MODE_ONLY);
|
||||
if (uffd < 0) {
|
||||
fprintf(stderr,
|
||||
"userfaultfd syscall not available in this kernel\n");
|
||||
|
||||
Reference in New Issue
Block a user