[LTP] [PATCH 2/5] syscalls/mmap09: Rewrite the test using new LTP API

Cyril Hrubis chrubis@suse.cz
Fri Sep 1 11:04:21 CEST 2023


Hi!
> > +	addr = mmap(0, mapsize, PROT_READ | PROT_WRITE, MAP_FILE |
> > MAP_SHARED, fd, 0);
> 
> Why don't we use SAFE_MMAP?

I guess mainly because that would produce TBROK instead of TFAIL.

> Can we use all file systems?
> 
> The test is mapping a file and performing an operation on it. So this is
> basically a file system test.
> 
> BTW this test seems weak. I don't know what truncating the file without
> then trying to access the newly OOB memory achieves. However it's what
> the original test did, so it's up to you if you want to change anything.

I would vote for adding additional checks like this. I suppose that you
will get SIGBUS when accessing pages beyond new file size, so we should
probably fork a child, let it touch the truncated part of the file, and
check that it was killed by SIGBUS.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list