On Mon, Aug 10, 2020 at 8:32 AM Yauheni Kaliuta <yauheni.kaliuta@xxxxxxxxxx> wrote: > > The idea of adv_mmap tests is to map/unmap pages in arbitrary > order. It works fine as soon as the kernel allocates first 3 pages > for from a region with unallocated page after that. If it's not the > case, the last remapping of 4 pages with MAP_FIXED will remap the > page to bpf map which will break the code which worked with the data > located there before. > > Change the test to map first the whole bpf map, 4 pages, and then > manipulate the mappings. > > Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@xxxxxxxxxx> > --- [0] is fixing the same issue with a slightly different approach by "preallocating" 4 anonymous mmap pages. I think I like that one a bit better. Please take a look as well. [0] https://patchwork.ozlabs.org/project/netdev/patch/20200810153940.125508-1-Jianlin.Lv@xxxxxxx/ > tools/testing/selftests/bpf/prog_tests/mmap.c | 23 ++++++++++++------- > 1 file changed, 15 insertions(+), 8 deletions(-) > [...]