github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/linux/uffd.txt (about)

     1  # Copyright 2018 syzkaller project authors. All rights reserved.
     2  # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  include <uapi/linux/ioctl.h>
     5  include <uapi/linux/fcntl.h>
     6  include <uapi/linux/userfaultfd.h>
     7  
     8  resource fd_uffd[fd]
     9  
    10  userfaultfd(flags flags[userfaultfd_flags]) fd_uffd
    11  
    12  ioctl$UFFDIO_API(fd fd_uffd, cmd const[UFFDIO_API], arg ptr[in, uffdio_api])
    13  ioctl$UFFDIO_REGISTER(fd fd_uffd, cmd const[UFFDIO_REGISTER], arg ptr[in, uffdio_register])
    14  ioctl$UFFDIO_UNREGISTER(fd fd_uffd, cmd const[UFFDIO_UNREGISTER], arg ptr[in, uffdio_range])
    15  ioctl$UFFDIO_WAKE(fd fd_uffd, cmd const[UFFDIO_WAKE], arg ptr[in, uffdio_range])
    16  ioctl$UFFDIO_COPY(fd fd_uffd, cmd const[UFFDIO_COPY], arg ptr[in, uffdio_copy])
    17  ioctl$UFFDIO_ZEROPAGE(fd fd_uffd, cmd const[UFFDIO_ZEROPAGE], arg ptr[in, uffdio_zeropage])
    18  ioctl$UFFDIO_WRITEPROTECT(fd fd_uffd, cmd const[UFFDIO_WRITEPROTECT], arg ptr[in, uffdio_writeprotect])
    19  ioctl$UFFDIO_CONTINUE(fd fd_uffd, cmd const[UFFDIO_CONTINUE], arg ptr[in, uffdio_continue])
    20  
    21  userfaultfd_flags = O_NONBLOCK, O_CLOEXEC, UFFD_USER_MODE_ONLY
    22  uffdio_register_mode = UFFDIO_REGISTER_MODE_MISSING, UFFDIO_REGISTER_MODE_WP, UFFDIO_REGISTER_MODE_MINOR
    23  uffdio_copy_mode = UFFDIO_COPY_MODE_DONTWAKE, UFFDIO_COPY_MODE_WP
    24  uffdio_zero_mode = UFFDIO_ZEROPAGE_MODE_DONTWAKE
    25  uffdio_features = UFFD_FEATURE_PAGEFAULT_FLAG_WP, UFFD_FEATURE_EVENT_FORK, UFFD_FEATURE_EVENT_REMAP, UFFD_FEATURE_EVENT_REMOVE, UFFD_FEATURE_MISSING_HUGETLBFS, UFFD_FEATURE_MISSING_SHMEM, UFFD_FEATURE_EVENT_UNMAP, UFFD_FEATURE_SIGBUS, UFFD_FEATURE_THREAD_ID, UFFD_FEATURE_MINOR_HUGETLBFS, UFFD_FEATURE_MINOR_SHMEM
    26  
    27  uffdio_api {
    28  	api	const[UFFD_API, int64]
    29  	featur	flags[uffdio_features, int64]
    30  	ioctls	const[0, int64]
    31  }
    32  
    33  uffdio_range {
    34  	start	vma64
    35  	len	len[start, int64]
    36  }
    37  
    38  uffdio_register {
    39  	range	uffdio_range
    40  	mode	flags[uffdio_register_mode, int64]
    41  	ioctls	const[0, int64]
    42  }
    43  
    44  uffdio_copy {
    45  	dst	vma64
    46  	src	vma64
    47  	len	len[dst, int64]
    48  	mode	flags[uffdio_copy_mode, int64]
    49  	copy	const[0, int64]
    50  }
    51  
    52  uffdio_zeropage {
    53  	range	uffdio_range
    54  	mode	flags[uffdio_zero_mode, int64]
    55  	zeropg	const[0, int64]
    56  }
    57  
    58  uffdio_writeprotect {
    59  	range	uffdio_range
    60  	mode	flags[uffdio_writeprotect_mode, int64]
    61  }
    62  
    63  uffdio_writeprotect_mode = UFFDIO_WRITEPROTECT_MODE_WP, UFFDIO_WRITEPROTECT_MODE_DONTWAKE
    64  
    65  uffdio_continue {
    66  	range	uffdio_range
    67  	mode	flags[uffdio_continue_mode, int64]
    68  	mapped	int64	(out)
    69  }
    70  
    71  uffdio_continue_mode = UFFDIO_CONTINUE_MODE_DONTWAKE