userfaultfd: provide unmasked address on page-fault
Userfaultfd is supposed to provide the full address (i.e., unmasked) of the faulting access back to userspace. However, that is not the case for quite some time. Even running "userfaultfd_demo" from the userfaultfd man page provides the wrong output (and contradicts the man page). Notice that "UFFD_EVENT_PAGEFAULT event" shows the masked address (7fc5e30b3000) and not the first read address (0x7fc5e30b300f). Address returned by mmap() = 0x7fc5e30b3000 fault_handler_thread(): poll() returns: nready = 1; POLLIN = 1; POLLERR = 0 UFFD_EVENT_PAGEFAULT event: flags = 0; address = 7fc5e30b3000 (uffdio_copy.copy returned 4096) Read address 0x7fc5e30b300f in main(): A Read address 0x7fc5e30b340f in main(): A Read address 0x7fc5e30b380f in main(): A Read address 0x7fc5e30b3c0f in main(): A The exact address is useful for various reasons and specifically for prefetching decisions. If it is known that the memory is populated by certain objec...
Showing
- fs/userfaultfd.c 4 additions, 1 deletionfs/userfaultfd.c
- include/linux/mm.h 2 additions, 1 deletioninclude/linux/mm.h
- include/uapi/linux/userfaultfd.h 7 additions, 1 deletioninclude/uapi/linux/userfaultfd.h
- mm/hugetlb.c 4 additions, 2 deletionsmm/hugetlb.c
- mm/memory.c 1 addition, 0 deletionsmm/memory.c
- mm/swapfile.c 1 addition, 0 deletionsmm/swapfile.c
Please register or sign in to comment