Running the executable mremap_test generated by compiling mremap_test.c,
located at tools/testing/selftests/vm, using the makefile provided in
tools/testing/selftests/vm gives an error of segmentation fault.
The error happens during the execution of the following test case (line
298):
test_cases[4] = MAKE_TEST(_1MB, PTE, _2MB, NON_OVERLAPPING,
EXPECT_SUCCESS, "2MB mremap - Source 1MB-aligned, Destination PTE-aligned");
The seg fault happens on line 145:
dest_addr = mremap(src_addr, c.region_size, c.region_size,
MREMAP_MAYMOVE|MREMAP_FIXED, (char *) addr);
The makefile compiles mremap_test.c using the command: gcc -Wall -I
../../../../usr/include -no-pie mremap_test.c -lrt -lpthread -o
/home/guest/shared/linux-kernel/tools/testing/selftests/vm/mremap_test
I was able to run mremap_test without errors when compiling it without
the -no-pie flag.