syscalls/munmap04: Increase target map address in case of EEXIST
PATCH v2 1/1 syscalls/munmap04: Increase target map address in case of EEXIST
From: Ricardo B. Marlière <[email protected]>
While trying to exhaust the amount of VMAs, the test should bump the address for the next try in case of EEXIST. Otherwise, it might timeout in an infinite loop.
Fixes 7f70db39ec45 ("syscalls/munmap04: Check errno while trying to exhaust VMA count")
Signed-off-by Ricardo B. Marlière <[email protected]>
---
Changes in v2:
- Use goto instead of continue.
- Link to v1: https://lore.kernel.org/r/[email protected]
--- testcases/kernel/syscalls/munmap/munmap04.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/munmap/munmap04.c +6 -2
@@ -28,6 +28,8 @@ static void run(void)static void setup (void ) { +uintptr_t addr = base; + page_sz =SAFE_SYSCONF (_SC_PAGESIZE); vma_size =MEMSIZE * page_sz;
@@ -36,15 +38,17 @@ static void setup(void) maps[i] =NULL ;while (1 ) { -void *p =mmap ((void *)(base +PAD * vma_size * map_count), +void *p =mmap ((void *) addr, vma_size,PROT_NONE ,MAP_PRIVATE |MAP_ANONYMOUS |MAP_FIXED_NOREPLACE ,-1 ,0 );if (p ==MAP_FAILED && errno ==EEXIST ) -continue ; + goto next_addr;if (p ==MAP_FAILED )break ; maps[map_count++] = p; +next_addr: + addr +=PAD * vma_size; }if (map_count ==MAP_MAX_COUNT )
---
base-commit: 91fa413eb521fde80d57c79bd3d2fb5cbe4ad3f4
change-id: 20250728-fixes-munmap04-02083c550c6b
Best regards,
Signature · 5 lines
Ricardo B. Marlière <[email protected]> -- Mailing list info: https://lists.linux.it/listinfo/ltp
Merged! Thanks
- Andrea
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp