From: Oscar Salvador osalvador@suse.de
mainline inclusion from mainline-v6.10-rc1 commit 88e4f525002bd3c28fe7a272ffcce743d07c02bd category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/IB0OV7
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i...
--------------------------------
commit 1cb9dc4b475c ("mm: hwpoison: support recovery from HugePage copy-on-write faults") added support to use the mc variants when coping hugetlb pages on CoW faults.
Add the missing VM_FAULT_SET_HINDEX, so the right si_addr_lsb will be passed to userspace to report the extension of the faulty area.
Link: https://lkml.kernel.org/r/20240509100148.22384-3-osalvador@suse.de Signed-off-by: Oscar Salvador osalvador@suse.de Acked-by: Peter Xu peterx@redhat.com Acked-by: Axel Rasmussen axelrasmussen@google.com Cc: Liu Shixin liushixin2@huawei.com Cc: Muchun Song muchun.song@linux.dev Signed-off-by: Andrew Morton akpm@linux-foundation.org
Conflicts: mm/hugetlb.c [Ma Wupeng: context conflict] Signed-off-by: Ma Wupeng mawupeng1@huawei.com --- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 4f4773bd5393..e0730bb22931 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -4730,7 +4730,7 @@ static vm_fault_t hugetlb_cow(struct mm_struct *mm, struct vm_area_struct *vma,
if (copy_user_huge_page(new_page, old_page, address, vma, pages_per_huge_page(h))) { - ret = VM_FAULT_HWPOISON_LARGE; + ret = VM_FAULT_HWPOISON_LARGE | VM_FAULT_SET_HINDEX(hstate_index(h)); goto out_release_all; } __SetPageUptodate(new_page);