Re: [PATCH 4/4] tools/selftests: add file/shmem-backed mapping guard region tests

From: Vlastimil Babka
Date: Tue Feb 18 2025 - 09:18:29 EST


On 2/13/25 19:17, Lorenzo Stoakes wrote:
> Extend the guard region self tests to explicitly assert that guard regions
> work correctly for functionality specific to file-backed and shmem
> mappings.
>
> In addition to testing all of the existing guard region functionality that
> is currently tested against anonymous mappings against file-backed and
> shmem mappings (except those which are exclusive to anonymous mapping), we
> now also:
>
> * Test that MADV_SEQUENTIAL does not cause unexpected readahead behaviour.
> * Test that MAP_PRIVATE behaves as expected with guard regions installed in
> both a shared and private mapping of an fd.
> * Test that a read-only file can correctly establish guard regions.
> * Test a probable fault-around case does not interfere with guard regions
> (or vice-versa).
> * Test that truncation does not eliminate guard regions.
> * Test that hole punching functions as expected in the presence of guard
> regions.
> * Test that a read-only mapping of a memfd write sealed mapping can have
> guard regions established within it and function correctly without
> violation of the seal.
> * Test that guard regions installed into a mapping of the anonymous zero
> page function correctly.

Impressive.

> Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>

Acked-by: Vlastimil Babka <vbabka@xxxxxxx>