[PATCH] selftests/proc: include linux/mman.h for MREMAP_DONTUNMAP
From: Qingshuang Fu
Date: Thu Nov 19 2026 - 21:27:34 EST
glibc versions before 2.32 do not define MREMAP_DONTUNMAP in
<sys/mman.h>, so proc-maps-race fails to build against them (e.g.
glibc 2.31):
$ make -C tools/testing/selftests TARGETS=proc
...
proc-maps-race.c:691:58: error: 'MREMAP_DONTUNMAP' undeclared
(first use in this function)
Include <linux/mman.h> to get the flag from the kernel UAPI headers
instead of depending on the libc version. The proc Makefile already
adds those headers to the include path via $(TOOLS_INCLUDES).
Fixes: 6a45336b9b6f ("selftests/proc: extend /proc/pid/maps tearing test to include vma remapping")
Signed-off-by: Qingshuang Fu <fuqingshuang@xxxxxxxxxx>
---
tools/testing/selftests/proc/proc-maps-race.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/proc/proc-maps-race.c b/tools/testing/selftests/proc/proc-maps-race.c
index bf4c5073f6fc..7d2d9144fedf 100644
--- a/tools/testing/selftests/proc/proc-maps-race.c
+++ b/tools/testing/selftests/proc/proc-maps-race.c
@@ -33,6 +33,7 @@
#include <string.h>
#include <unistd.h>
#include <linux/fs.h>
+#include <linux/mman.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/stat.h>
base-commit: 20eef29b7c8465ac98d7dd6d6f2ac07a8d8056ca
--
2.25.1