[LTP] [PATCH] open_posix_testsuite/mmap24-2: Relax condition a bit

Cyril Hrubis chrubis@suse.cz
Tue Oct 16 15:02:09 CEST 2018


Hi!
> Linux kernel code: arch/mips/mm/mmap.c
> if (flags & MAP_FIXED) {
>     /* Even MAP_FIXED mappings must reside within TASK_SIZE */
>     if (TASK_SIZE - len < addr)
>         return -EINVAL;
> 
> Relax the condition and accept both ENOMEM and EINVAL
> as expected outcome.

Hmm, it's always complicated with these POSIX tests, since we have to
follow the POSIX specification there.

And the POSIX clearly says that mmap() shall fail with ENOMEM if
MAP_FIXED was specified, and the range [addr,addr+len) exceeds that
allowed for the address space of a process. So I guess that the best
solution here would be limiting the address space with rlimit, so that
we actually happen to hit the ENOMEM instead of EINVAL.

At least we cannot say that we passed the test with EINVAL because the
assertion we tried to test wasn't triggered.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list