* [PATCH] selftests/proc: include linux/mman.h for MREMAP_DONTUNMAP
@ 2026-11-20 2:27 Qingshuang Fu
2026-11-20 3:24 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Qingshuang Fu @ 2026-11-20 2:27 UTC (permalink / raw)
To: Andy Whitcroft, Joe Perches, Shuah Khan, Andrew Morton,
Suren Baghdasaryan, Liam R . Howlett, Karl Mehltretter,
Bala-Vignesh-Reddy
Cc: linux-fsdevel, linux-kselftest, linux-kernel, Qingshuang Fu
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@kylinos.cn>
---
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] selftests/proc: include linux/mman.h for MREMAP_DONTUNMAP
2026-11-20 2:27 [PATCH] selftests/proc: include linux/mman.h for MREMAP_DONTUNMAP Qingshuang Fu
@ 2026-11-20 3:24 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2026-11-20 3:24 UTC (permalink / raw)
To: Qingshuang Fu
Cc: Andy Whitcroft, Joe Perches, Shuah Khan, Suren Baghdasaryan,
Liam R . Howlett, Karl Mehltretter, Bala-Vignesh-Reddy,
linux-fsdevel, linux-kselftest, linux-kernel
On Fri, 20 Nov 2026 10:27:10 +0800 Qingshuang Fu <fuqingshuang@kylinos.cn> wrote:
> 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).
Boy, anyone who is running 6 year old glibc has bigger problems than
this. 2.31 is full of scary-looking CVEs.
> --- 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>
but OK, patch looks harmless enough and lots of selftests/ are including
linux/mman.h.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-20 3:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-20 2:27 [PATCH] selftests/proc: include linux/mman.h for MREMAP_DONTUNMAP Qingshuang Fu
2026-11-20 3:24 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®