Skip to contentSkip to conversation

syscalls: munmap: Add munmap04 to check ENOMEM

PATCH Superseded Ricardo B. Marlière via ltp 1 participant 1 message Jul 7, 2025

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 syscalls: munmap: Add munmap04 to check ENOMEM

From: Ricardo B. Marlière <[email protected]>

The ERRORS section of the mmap(2) manpage says:

ENOMEM: The process's maximum number of mappings would have been exceeded. This error can also occur for munmap(), when unmapping a region in the middle of an existing mapping, since this results in two smaller mappings on either side of the region being unmapped.

Add a new test munmap04 to address this scenario.

---
Changes in v3:
- Added missing include to "lapi/mmap.h"
- Made max_map_count a test option
- Keep the mapped regions in the heap
- Required min. kernel v4.17
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Corrected the commit message
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 runtest/syscalls                            |  1 +
 testcases/kernel/syscalls/munmap/.gitignore |  1 +
 testcases/kernel/syscalls/munmap/munmap04.c | 94 +++++++++++++++++++++++++++++
 3 files changed, 96 insertions(+)
runtest/syscalls +1 -0
index 582422ac9ca8ccae598c626a11cf6ee7c30f0e3a..d918963b7ad616ce5931476d0804d2cb566942c0 100644
@@ -951,6 +951,7 @@ munlockall01 munlockall01
 munmap01 munmap01
 munmap02 munmap02
 munmap03 munmap03
+munmap04 munmap04
 
 nanosleep01 nanosleep01
 nanosleep02 nanosleep02
testcases/kernel/syscalls/munmap/.gitignore +1 -0
index 94d8c10a24cae47c6805546bff41a84a2a2e8173..d418dc4512abe6dffcb279fddbdbde25a4f44230 100644
@@ -1,3 +1,4 @@
 /munmap01
 /munmap02
 /munmap03
+/munmap04
testcases/kernel/syscalls/munmap/munmap04.c new file +94 -0

94 lines not on this page · raw message

---
base-commit: f6b76fe373d1932ce1d2248e83ff284085145797
change-id: 20250704-new-munmap04-a59ca20ae00c

Best regards,

Signature · 5 lines
Ricardo B. Marlière <[email protected]>


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp