[LTP] [PATCH 4/4] syscalls/mmap04: Rewrite the test using new LTP API

Cyril Hrubis chrubis@suse.cz
Fri Sep 1 14:28:04 CEST 2023


Hi!
> > This is nearly identical to the mmap02.c and the same comments apply
> > here.
> > 
> > Also the test does not check the PROT_EXEC part at all. If we wanted to
> > properly test PROT_EXEC we would have to copy a function code to the
> > file first then execute it, something that mprotect04 does, but since
> > that flag is already tested in mprotect04 it does not make that much
> > sense to have it here as well.
> 
> Yes, I agree this test does not cover PROT_EXEC scenario. So, if this case is 
> covered in mprotect04, do you recommend dropping this test altogether from 
> here?

Testing that the flag is accepted by mmap() and mmap succeeds is
actually enough of test, that validates that the flag parsing in
sys_mmap() function in kernel works fine.

One option how to make the test more interesting would be to:

1) create mappings with different PROT_* flags
2) parse /proc/self/maps and check that the flags match what is there

That way we would validate that all valid flag combination are parsed
fine and printed correctly in /proc/self/maps.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list