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

Ricardo B. Marlière rbm@suse.com
Fri Jul 4 18:35:15 CEST 2025


On Fri Jul 4, 2025 at 1:26 PM -03, Andrea Cervesato wrote:
> 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.
>

Thanks for the pointers, I'll give it a shot 8-)

> - Andrea



More information about the ltp mailing list