[LTP] [PATCH 3/3] syscalls: munmap03: Convert to new API

Andrea Cervesato andrea.cervesato@suse.com
Fri Jul 4 18:26:21 CEST 2025


On 7/4/25 5:23 PM, Ricardo B. Marlière wrote:
> Most of those are for mmap. The only one left seems to be ENOMEM, which
> I don't think it's viable to test. WDYT?
I guess you mean:

        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.

Luckily it is testable, but we need a new test for that. What we can do 
is to read 
https://docs.kernel.org/admin-guide/sysctl/vm.html#max-map-count and to 
map the maximum amount of memory map areas. Then we munmap() in the 
middle of one of them, resulting in +1 mapped areas and obtaining ENOMEM 
from the syscall. Feel free to explore it.

- Andrea



More information about the ltp mailing list