* + selftests-mm-fix-soft-dirty-kselftest-supported-check.patch added to mm-new branch
@ 2026-02-19 22:37 Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2026-02-19 22:37 UTC (permalink / raw)
To: mm-commits, vbabka, surenb, shuah, rppt, mhocko, lorenzo.stoakes,
liam.howlett, david, audra, akpm
The patch titled
Subject: selftests/mm: fix soft-dirty kselftest supported check
has been added to the -mm mm-new branch. Its filename is
selftests-mm-fix-soft-dirty-kselftest-supported-check.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/selftests-mm-fix-soft-dirty-kselftest-supported-check.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
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 via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Audra Mitchell <audra@redhat.com>
Subject: selftests/mm: fix soft-dirty kselftest supported check
Date: Wed, 18 Feb 2026 13:42:10 -0500
On architectures with separate user address space, such as s390 or those
without an MMU, the call to __access_ok will return true. The soft-dirty
test attempts to check if the PAGEMAP_SCAN feature is supported by
providing an invalid address and expecting __access_ok to return false,
thus throwing an EFAULT error on return. Because of this assumption, this
check will always fail for the architectures aforementioned. Update the
supported check to handle the return being zero for these types of cases.
Link: https://lkml.kernel.org/r/20260218184210.206466-1-audra@redhat.com
Signed-off-by: Audra Mitchell <audra@redhat.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
tools/testing/selftests/mm/vm_util.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
--- a/tools/testing/selftests/mm/vm_util.c~selftests-mm-fix-soft-dirty-kselftest-supported-check
+++ a/tools/testing/selftests/mm/vm_util.c
@@ -77,10 +77,8 @@ static bool pagemap_scan_supported(int f
/* Provide an invalid address in order to trigger EFAULT. */
ret = __pagemap_scan_get_categories(fd, start, (struct page_region *) ~0UL);
- if (ret == 0)
- ksft_exit_fail_msg("PAGEMAP_SCAN succeeded unexpectedly\n");
- supported = errno == EFAULT;
+ supported = (ret == 0) || (errno == EFAULT);
return supported;
}
_
Patches currently in -mm which might be from audra@redhat.com are
selftests-mm-fix-soft-dirty-kselftest-supported-check.patch
^ permalink raw reply [flat|nested] 2+ messages in thread
* + selftests-mm-fix-soft-dirty-kselftest-supported-check.patch added to mm-new branch
@ 2026-08-06 23:50 Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2026-08-06 23:50 UTC (permalink / raw)
To: mm-commits, vbabka, usama.anjum, surenb, shuah, rppt, raquini,
mhocko, ljs, liam, david, colin.i.king, avagin, audra, akpm
The patch titled
Subject: selftests/mm: fix soft-dirty kselftest supported check
has been added to the -mm mm-new branch. Its filename is
selftests-mm-fix-soft-dirty-kselftest-supported-check.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/selftests-mm-fix-soft-dirty-kselftest-supported-check.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
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 via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Audra Mitchell <audra@redhat.com>
Subject: selftests/mm: fix soft-dirty kselftest supported check
Date: Thu, 6 Aug 2026 14:17:04 -0400
On architectures with separate user address space, such as s390 or those
without an MMU, the soft-dirty kselftest may fail when checking to see if
the feature is supported.
# --------------------
# running ./soft-dirty
# --------------------
# TAP version 13
# 1..15
# Bail out! PAGEMAP_SCAN succeeded unexpectedly
# # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:0 error:0
# [FAIL]
not ok 1 soft-dirty # exit=1
# SUMMARY: PASS=0 SKIP=0 FAIL=1
The soft-dirty test will initate an ioctl with the PAGEMAP_SCAN flag with
an invalid address for the page_region. This is done intentionally to
have the ioctl return with an expected EFAULT and with the correct
categories returned.
However, on architectures with separate user address space, such as s390
or those without an MMU, the call to __access_ok (used to validate the
variables provided with the ioctl) will always return true and we will not
fail as expected.
if (IS_ENABLED(CONFIG_ALTERNATE_USER_ADDRESS_SPACE) ||
!IS_ENABLED(CONFIG_MMU))
return true;
Let's simplify the check for PAGEMAP_SCAN and provide a valid page_region
address so that we get a non-errno return if it is supported.
Link: https://lore.kernel.org/20260806181843.1839943-3-audra@redhat.com
Fixes: 600bca580579 ("selftests/mm: check that PAGEMAP_SCAN returns correct categories")
Signed-off-by: Audra Mitchell <audra@redhat.com>
Cc: Andrei Vagin <avagin@google.com>
Cc: Colin Ian King <colin.i.king@gmail.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Muhammad Usama Anjum <usama.anjum@arm.com>
Cc: Rafael Aquini <raquini@redhat.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
tools/testing/selftests/mm/vm_util.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
--- a/tools/testing/selftests/mm/vm_util.c~selftests-mm-fix-soft-dirty-kselftest-supported-check
+++ a/tools/testing/selftests/mm/vm_util.c
@@ -69,20 +69,25 @@ static uint64_t pagemap_scan_get_categor
}
/* `start` is any valid address. */
-static bool pagemap_scan_supported(int fd, char *start)
+static bool pagemap_scan_supported(int fd)
{
+ const size_t pagesize = getpagesize();
static int supported = -1;
- int ret;
+ struct page_region r;
+ void *test_area;
if (supported != -1)
return supported;
- /* Provide an invalid address in order to trigger EFAULT. */
- ret = __pagemap_scan_get_categories(fd, start, (struct page_region *) ~0UL);
- if (ret == 0)
- ksft_exit_fail_msg("PAGEMAP_SCAN succeeded unexpectedly\n");
-
- supported = errno == EFAULT;
+ test_area = mmap(0, pagesize, PROT_READ | PROT_WRITE,
+ MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+ if (test_area == MAP_FAILED) {
+ ksft_print_msg("WARN: mmap() failed: %s\n", strerror(errno));
+ supported = 0;
+ } else {
+ supported = __pagemap_scan_get_categories(fd, test_area, &r) >= 0;
+ munmap(test_area, pagesize);
+ }
return supported;
}
@@ -92,7 +97,7 @@ static bool page_entry_is(int fd, char *
{
bool m = pagemap_get_entry(fd, start) & pagemap_flags;
- if (pagemap_scan_supported(fd, start)) {
+ if (pagemap_scan_supported(fd)) {
bool s = pagemap_scan_get_categories(fd, start) & pagescan_flags;
if (m == s)
_
Patches currently in -mm which might be from audra@redhat.com are
correct-__pagemap_scan_get_categories-return-value.patch
selftests-mm-fix-soft-dirty-kselftest-supported-check.patch
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-06 23:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-06 23:50 + selftests-mm-fix-soft-dirty-kselftest-supported-check.patch added to mm-new branch Andrew Morton
-- strict thread matches above, loose matches on Subject: below --
2026-02-19 22:37 Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.