mm-madvise-report-sigbus-as-efault-for-madv_populate_readwrite.patch removed from -mm tree
The patch titled
Subject: mm/madvise: report SIGBUS as -EFAULT for MADV_POPULATE_(READ|WRITE)
has been removed from the -mm tree. Its filename was
mm-madvise-report-sigbus-as-efault-for-madv_populate_readwrite.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: David Hildenbrand <[email protected]>
Subject: mm/madvise: report SIGBUS as -EFAULT for MADV_POPULATE_(READ|WRITE)
Doing some extended tests and polishing the man page update for MADV_POPULATE_(READ|WRITE), I realized that we end up converting also SIGBUS (via -EFAULT) to -EINVAL, making it look like yet another madvise() user error.
We want to report only problematic mappings and permission problems that the user could have know as -EINVAL.
Let's not convert -EFAULT arising due to SIGBUS (or SIGSEGV) to -EINVAL, but instead indicate -EFAULT to user space. While we could also convert it to -ENOMEM, using -EFAULT looks more helpful when user space might want to troubleshoot what's going wrong: MADV_POPULATE_(READ|WRITE) is not part of an final Linux release and we can still adjust the behavio= r.
---
mm/gup.c | 7 +++++-- mm/madvise.c | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-)
mm/gup.c renamed from mm/gup.c~mm-madvise-report-sigbus-as-efault-for-madv_populate_readwrite +5 -2
@@ -1558,9 +1558,12 @@ long faultin_vma_page_range(struct vm_ar gup_flags |=FOLL_WRITE ;/* -* See check_vma_flags(): Will return -EFAULT on incompatible mappings -* or with insufficient permissions. +* We want to report -EINVAL instead of -EFAULT for any permission +* problems or incompatible mappings. */ +if (check_vma_flags (vma, gup_flags)) +return -EINVAL ; +return __get_user_pages (mm, start, nr_pages, gup_flags,NULL ,NULL , locked); }
mm/madvise.c renamed from mm/madvise.c~mm-madvise-report-sigbus-as-efault-for-madv_populate_readwrite +3 -1
@@ -862,10 +862,12 @@ static long madvise_populate(struct vm_aswitch (pages) {case -EINTR :return -EINTR ; -case -EFAULT :/* Incompatible mappings / permissions. */ +case -EINVAL :/* Incompatible mappings / permissions. */ return -EINVAL ;case -EHWPOISON :return -EHWPOISON ; +case -EFAULT :/* VM_FAULT_SIGBUS or VM_FAULT_SIGSEGV */ +return -EFAULT ;default :pr_warn_once ("%s: unhandled return value: %ld\n" , __func__, pages);
_
Patches currently in -mm which might be from [email protected] are
memory-hotplugrst-remove-locking-details-from-admin-guide.patch memory-hotplugrst-complete-admin-guide-overhaul.patch mm-memory_hotplug-use-unsigned-long-for-pfn-in-zone_for_pfn_range.patch mm-memory_hotplug-remove-nid-parameter-from-arch_remove_memory.patch mm-memory_hotplug-remove-nid-parameter-from-remove_memory-and-friends.patch acpi-memhotplug-memory-resources-cannot-be-enabled-yet.patch mm-track-present-early-pages-per-zone.patch mm-memory_hotplug-introduce-auto-movable-online-policy.patch drivers-base-memory-introduce-memory-groups-to-logically-group-memory-blocks.patch mm-memory_hotplug-track-present-pages-in-memory-groups.patch acpi-memhotplug-use-a-single-static-memory-group-for-a-single-memory-device.patch dax-kmem-use-a-single-static-memory-group-for-a-single-probed-unit.patch virtio-mem-use-a-single-dynamic-memory-group-for-a-single-virtio-mem-device.patch mm-memory_hotplug-memory-group-aware-auto-movable-online-policy.patch mm-memory_hotplug-improved-dynamic-memory-group-aware-auto-movable-online-policy.patch