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

Richard Palethorpe rpalethorpe@suse.de
Fri Sep 1 11:11:52 CEST 2023


Hello,

Cyril Hrubis <chrubis@suse.cz> writes:

> 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.

There is some overlap with mmap13 because that does check for
SIGBUS. Possibly these could be combined?

-- 
Thank you,
Richard.


More information about the ltp mailing list