* [PATCH] selftests/proc: include linux/mman.h for MREMAP_DONTUNMAP
@ 2026-11-20 2:27 Qingshuang Fu
2026-11-20 3:24 ` Andrew Morton
2026-11-20 3:24 ` + selftests-proc-include-linux-mmanh-for-mremap_dontunmap.patch added to mm-new branch Andrew Morton
0 siblings, 2 replies; 3+ 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 related [flat|nested] 3+ 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
2026-11-20 3:24 ` + selftests-proc-include-linux-mmanh-for-mremap_dontunmap.patch added to mm-new branch Andrew Morton
1 sibling, 0 replies; 3+ 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] 3+ messages in thread
* + selftests-proc-include-linux-mmanh-for-mremap_dontunmap.patch added to mm-new branch
2026-11-20 2:27 [PATCH] selftests/proc: include linux/mman.h for MREMAP_DONTUNMAP Qingshuang Fu
2026-11-20 3:24 ` Andrew Morton
@ 2026-11-20 3:24 ` Andrew Morton
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2026-11-20 3:24 UTC (permalink / raw)
To: mm-commits, surenb, shuah, reddybalavignesh9979, liam,
kmehltretter, joe, apw, fuqingshuang, akpm
The patch titled
Subject: selftests/proc: include linux/mman.h for MREMAP_DONTUNMAP
has been added to the -mm mm-new branch. Its filename is
selftests-proc-include-linux-mmanh-for-mremap_dontunmap.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/selftests-proc-include-linux-mmanh-for-mremap_dontunmap.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Qingshuang Fu <fuqingshuang@kylinos.cn>
Subject: selftests/proc: include linux/mman.h for MREMAP_DONTUNMAP
Date: Fri, 20 Nov 2026 10:27:10 +0800
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).
Link: https://patch.msgid.link/20261120022710.1585112-1-fuqingshuang@kylinos.cn
Fixes: 6a45336b9b6f ("selftests/proc: extend /proc/pid/maps tearing test to include vma remapping")
Signed-off-by: Qingshuang Fu <fuqingshuang@kylinos.cn>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Whitcroft <apw@canonical.com>
Cc: Joe Perches <joe@perches.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Karl Mehltretter <kmehltretter@gmail.com>
Cc: Bala-Vignesh-Reddy <reddybalavignesh9979@gmail.com>
tools/testing/selftests/proc/proc-maps-race.c | 1 +
1 file changed, 1 insertion(+)
--- a/tools/testing/selftests/proc/proc-maps-race.c~selftests-proc-include-linux-mmanh-for-mremap_dontunmap
+++ a/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>
_
Patches currently in -mm which might be from fuqingshuang@kylinos.cn are
selftests-proc-include-linux-mmanh-for-mremap_dontunmap.patch
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-20 3:24 UTC | newest]
Thread overview: 3+ 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
2026-11-20 3:24 ` + selftests-proc-include-linux-mmanh-for-mremap_dontunmap.patch added to mm-new branch Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.