From: Aboorva Devarajan <aboorvad@linux.ibm.com>
To: akpm@linux-foundation.org, Liam.Howlett@oracle.com,
lorenzo.stoakes@oracle.com, shuah@kernel.org, pfalcato@suse.de,
david@redhat.com, ziy@nvidia.com, baolin.wang@linux.alibaba.com,
npache@redhat.com, ryan.roberts@arm.com, dev.jain@arm.com,
baohua@kernel.org
Cc: linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org, donettom@linux.ibm.com,
ritesh.list@gmail.com, aboorvad@linux.ibm.com
Subject: [PATCH 1/6] mm/selftests: Fix virtual_address_range test issues.
Date: Mon, 16 Jun 2025 21:36:27 +0530 [thread overview]
Message-ID: <20250616160632.35250-2-aboorvad@linux.ibm.com> (raw)
In-Reply-To: <20250616160632.35250-1-aboorvad@linux.ibm.com>
From: Donet Tom <donettom@linux.ibm.com>
In this patch, we are fixing three issues in the virtual_address_range
test.
1. validate_addr() checks if the allocated address is within the range.
In the current implementation, if addr is greater than HIGH_ADDR_MARK,
the test fails. However, addr will be greater than HIGH_ADDR_MARK if
high_addr is set. Therefore, if high_addr is set, we should not check
the (addr > HIGH_ADDR_MARK) condition.
2.In main(), the high address is stored in hptr, but for mark_range(),
the address passed is ptr, not hptr. Fixed this by changing ptr[i] to
hptr[i] in mark_range() function call.
3./proc/self/maps may not always have gaps smaller than MAP_CHUNK_SIZE.
The gap between the first high address mapping and the previous mapping
is not smaller than MAP_CHUNK_SIZE.
$cat /proc/3713/maps
10000000-10010000 r-xp 00000000 fd:00 36140094
10010000-10020000 r--p 00000000 fd:00 36140094
10020000-10030000 rw-p 00010000 fd:00 36140094
4ee80000-4eeb0000 rw-p 00000000 00:00 0
578f0000-57c00000 rw-p 00000000 00:00 0
57c00000-7fff97c00000 r--p 00000000 00:00 0
7fff97c00000-7fff97e20000 r-xp 00000000 fd:00 33558923
7fff97e20000-7fff97e30000 r--p 00220000 fd:00 33558923
7fff97e30000-7fff97e40000 rw-p 00230000 fd:00 33558923
7fff97f40000-7fff98020000 r-xp 00000000 fd:00 33558924
7fff98020000-7fff98030000 r--p 000d0000 fd:00 33558924
7fff98030000-7fff98040000 rw-p 000e0000 fd:00 33558924
7fff98050000-7fff98090000 r--p 00000000 00:00 0
7fff98090000-7fff980a0000 r-xp 00000000 00:00 0
7fff980a0000-7fff980f0000 r-xp 00000000 fd:00 2634
7fff980f0000-7fff98100000 r--p 00040000 fd:00 2634
7fff98100000-7fff98110000 rw-p 00050000 fd:00 2634
7fffcf8a0000-7fffcf9b0000 rw-p 00000000 00:00 0
1000000000000-1000040000000 r--p 00000000 00:00 0 --> High Addr
2000000000000-2000040000000 r--p 00000000 00:00 0
4000000000000-4000040000000 r--p 00000000 00:00 0
8000000000000-8000040000000 r--p 00000000 00:00 0
e800098110000-fffff98110000 r--p 00000000 00:00 0
$
In this patch, the condition that checks for gaps smaller than MAP_CHUNK_SIZE has been removed.
Fixes: d1d86ce28d0f ("selftests/mm: virtual_address_range: conform to TAP format output")
Fixes: b2a79f62133a ("selftests/mm: virtual_address_range: unmap chunks after validation")
Fixes: 010409649885 ("selftests/mm: confirm VA exhaustion without reliance on correctness of mmap()")
Signed-off-by: Donet Tom <donettom@linux.ibm.com>
Signed-off-by: Aboorva Devarajan <aboorvad@linux.ibm.com>
---
tools/testing/selftests/mm/virtual_address_range.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/tools/testing/selftests/mm/virtual_address_range.c b/tools/testing/selftests/mm/virtual_address_range.c
index b380e102b22f..606e601a8984 100644
--- a/tools/testing/selftests/mm/virtual_address_range.c
+++ b/tools/testing/selftests/mm/virtual_address_range.c
@@ -80,7 +80,7 @@ static void validate_addr(char *ptr, int high_addr)
if (high_addr && addr < HIGH_ADDR_MARK)
ksft_exit_fail_msg("Bad address %lx\n", addr);
- if (addr > HIGH_ADDR_MARK)
+ if (!high_addr && addr > HIGH_ADDR_MARK)
ksft_exit_fail_msg("Bad address %lx\n", addr);
}
@@ -117,7 +117,7 @@ static int validate_lower_address_hint(void)
static int validate_complete_va_space(void)
{
- unsigned long start_addr, end_addr, prev_end_addr;
+ unsigned long start_addr, end_addr;
char line[400];
char prot[6];
FILE *file;
@@ -134,7 +134,6 @@ static int validate_complete_va_space(void)
if (file == NULL)
ksft_exit_fail_msg("cannot open /proc/self/maps\n");
- prev_end_addr = 0;
while (fgets(line, sizeof(line), file)) {
const char *vma_name = NULL;
int vma_name_start = 0;
@@ -151,12 +150,6 @@ static int validate_complete_va_space(void)
if (start_addr & (1UL << 63))
return 0;
- /* /proc/self/maps must have gaps less than MAP_CHUNK_SIZE */
- if (start_addr - prev_end_addr >= MAP_CHUNK_SIZE)
- return 1;
-
- prev_end_addr = end_addr;
-
if (prot[0] != 'r')
continue;
@@ -223,8 +216,7 @@ int main(int argc, char *argv[])
if (hptr[i] == MAP_FAILED)
break;
-
- mark_range(ptr[i], MAP_CHUNK_SIZE);
+ mark_range(hptr[i], MAP_CHUNK_SIZE);
validate_addr(hptr[i], 1);
}
hchunks = i;
--
2.43.5
next prev parent reply other threads:[~2025-06-16 16:07 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-16 16:06 [PATCH 0/6] selftests/mm: Fix false positives and skip unsupported tests Aboorva Devarajan
2025-06-16 16:06 ` Aboorva Devarajan [this message]
2025-06-16 16:27 ` [PATCH 1/6] mm/selftests: Fix virtual_address_range test issues Dev Jain
2025-06-18 10:06 ` Donet Tom
2025-06-18 10:35 ` Dev Jain
2025-06-18 11:22 ` Lorenzo Stoakes
2025-06-18 11:28 ` Dev Jain
2025-06-18 11:37 ` Lorenzo Stoakes
2025-06-18 11:45 ` Dev Jain
2025-06-18 11:57 ` Lorenzo Stoakes
2025-06-18 11:59 ` Lorenzo Stoakes
2025-06-18 13:58 ` Dev Jain
2025-06-18 14:07 ` Lorenzo Stoakes
2025-06-18 14:17 ` Dev Jain
2025-06-18 14:35 ` Lorenzo Stoakes
2025-06-18 14:43 ` Dev Jain
2025-06-19 8:23 ` Donet Tom
2025-06-19 9:02 ` Dev Jain
2025-06-19 15:31 ` Donet Tom
2025-06-19 16:14 ` Dev Jain
2025-06-20 14:45 ` Dev Jain
2025-06-21 17:55 ` Donet Tom
2025-06-23 4:53 ` Dev Jain
2025-06-23 4:55 ` Dev Jain
2025-06-23 17:32 ` Donet Tom
2025-06-24 6:15 ` Dev Jain
2025-06-25 9:36 ` Donet Tom
2025-06-25 10:45 ` Dev Jain
2025-06-25 12:52 ` Dev Jain
2025-06-25 17:17 ` Donet Tom
2025-06-26 3:57 ` Dev Jain
2025-06-26 5:42 ` Donet Tom
2025-06-26 5:55 ` Dev Jain
2025-06-26 6:35 ` Dev Jain
2025-06-26 6:52 ` Donet Tom
2025-06-18 11:50 ` Lorenzo Stoakes
2025-06-16 16:06 ` [PATCH 2/6] selftest/mm: Fix ksm_funtional_test failures Aboorva Devarajan
2025-06-16 17:04 ` Liam R. Howlett
2025-06-17 15:10 ` donettom
2025-06-16 16:06 ` [PATCH 3/6] selftests/mm : fix test_prctl_fork_exec failure Aboorva Devarajan
2025-06-16 16:28 ` Dev Jain
2025-06-17 15:04 ` donettom
2025-06-16 16:06 ` [PATCH 4/6] mm/selftests: Fix split_huge_page_test failure on systems with 64KB page size Aboorva Devarajan
2025-06-16 16:06 ` [PATCH 5/6] selftests/mm: Fix child process exit codes in KSM tests Aboorva Devarajan
2025-06-16 16:06 ` [PATCH 6/6] selftests/mm: Mark thuge-gen as skipped if shmmax is too small or no 1G pages Aboorva Devarajan
2025-06-16 16:11 ` [PATCH 0/6] selftests/mm: Fix false positives and skip unsupported tests Lorenzo Stoakes
2025-06-17 7:53 ` Aboorva Devarajan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250616160632.35250-2-aboorvad@linux.ibm.com \
--to=aboorvad@linux.ibm.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=david@redhat.com \
--cc=dev.jain@arm.com \
--cc=donettom@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=npache@redhat.com \
--cc=pfalcato@suse.de \
--cc=ritesh.list@gmail.com \
--cc=ryan.roberts@arm.com \
--cc=shuah@kernel.org \
--cc=ziy@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).