The patch titled Subject: userfaultfd: provide unmasked address on page-fault has been added to the -mm tree. Its filename is userfaultfd-provide-unmasked-address-on-page-fault-v3.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/userfaultfd-provide-unmasked-address-on-page-fault-v3.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/userfaultfd-provide-unmasked-address-on-page-fault-v3.patch 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 and is updated there every 3-4 working days ------------------------------------------------------ From: Nadav Amit <namit@xxxxxxxxxx> Subject: userfaultfd: provide unmasked address on page-fault initialize real_address on all code paths, per Jan Link: https://lkml.kernel.org/r/20220226022655.350562-1-namit@xxxxxxxxxx Signed-off-by: Nadav Amit <namit@xxxxxxxxxx> Acked-by: Peter Xu <peterx@xxxxxxxxxx> Reviewed-by: David Hildenbrand <david@xxxxxxxxxx> Reviewed-by: Jan Kara <jack@xxxxxxx> Cc: Andrea Arcangeli <aarcange@xxxxxxxxxx> Cc: Mike Rapoport <rppt@xxxxxxxxxxxxxxxxxx> Cc: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/hugetlb.c | 6 ++++-- mm/swapfile.c | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) --- a/mm/hugetlb.c~userfaultfd-provide-unmasked-address-on-page-fault-v3 +++ a/mm/hugetlb.c @@ -5341,6 +5341,7 @@ static inline vm_fault_t hugetlb_handle_ pgoff_t idx, unsigned int flags, unsigned long haddr, + unsigned long addr, unsigned long reason) { vm_fault_t ret; @@ -5348,6 +5349,7 @@ static inline vm_fault_t hugetlb_handle_ struct vm_fault vmf = { .vma = vma, .address = haddr, + .real_address = addr, .flags = flags, /* @@ -5416,7 +5418,7 @@ retry: /* Check for page in userfault range */ if (userfaultfd_missing(vma)) { ret = hugetlb_handle_userfault(vma, mapping, idx, - flags, haddr, + flags, haddr, address, VM_UFFD_MISSING); goto out; } @@ -5480,7 +5482,7 @@ retry: unlock_page(page); put_page(page); ret = hugetlb_handle_userfault(vma, mapping, idx, - flags, haddr, + flags, haddr, address, VM_UFFD_MINOR); goto out; } --- a/mm/swapfile.c~userfaultfd-provide-unmasked-address-on-page-fault-v3 +++ a/mm/swapfile.c @@ -1951,6 +1951,7 @@ static int unuse_pte_range(struct vm_are struct vm_fault vmf = { .vma = vma, .address = addr, + .real_address = addr, .pmd = pmd, }; _ Patches currently in -mm which might be from namit@xxxxxxxxxx are userfaultfd-mark-uffd_wp-regardless-of-vm_write-flag.patch userfaultfd-provide-unmasked-address-on-page-fault.patch userfaultfd-provide-unmasked-address-on-page-fault-v3.patch