Skip to contentSkip to conversation

selftests-nommu-add-nommu-mmap-and-mremap-behavior-tests.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Oct 24

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: selftests/nommu: add nommu mmap and mremap behavior tests
has been removed from the -mm tree. Its filename was
selftests-nommu-add-nommu-mmap-and-mremap-behavior-tests.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Hajime Tazaki <[email protected]>
Subject: selftests/nommu: add nommu mmap and mremap behavior tests
Date: Tue, 6 Oct 2026 17:56:42 +0900

Introduce a kselftest utility to validate memory mapping capabilities under nommu kernels, aligned with Documentation/admin-guide/mm/nommu-mmap.rst.

The test implements basic checks into a generic architecture-agnostic test matrix applicable across nommu targets. It evaluates:

1. MAP_FIXED allocation rejections.
2. Standard MAP_PRIVATE and MAP_ANONYMOUS allocation resilience.
3. Regular file mappings via standard filesystem storage.
4. Block device subsystem mappings (gracefully skipping if node is missing).
5. Shared vs Private backing discrepancies under nommu conditions.
6. mremap limits, ensuring non-expandable restrictions behave properly.

Assisted-by Gemini:Pro [AI_Reviewer] [Sashiko_Linter]
Assisted-by cubic.dev:unspecified
Cc David Hildenbrand <[email protected]>
Cc "Liam R. Howlett" <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Mike Rapoport <[email protected]>
Cc Suren Baghdasaryan <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Shuah Khan <[email protected]>
Cc Ricardo B . Marlière <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Brendan Jackman <[email protected]>
Cc Hangbin Liu <[email protected]>
Cc Jonathan Corbet <[email protected]>
Cc Kees Cook <[email protected]>
Cc Mark Brown <[email protected]>
Cc Will Drewry <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Daniel Palmer <[email protected]>

---

 tools/testing/selftests/nommu/Makefile            |    7 
 tools/testing/selftests/nommu/nommu.h             |   33 +
 tools/testing/selftests/nommu/nommu_mmap_test.c   |  264 ++++++++
 tools/testing/selftests/nommu/nommu_mremap_test.c |  356 ++++++++++++
 4 files changed, 660 insertions(+)
tools/testing/selftests/nommu/Makefile new file +7 -0
new file mode 100644
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0
+# Makefile for nommu selftests
+
+TEST_GEN_PROGS += nommu_mmap_test
+TEST_GEN_PROGS += nommu_mremap_test
+
+include ../lib.mk
tools/testing/selftests/nommu/nommu.h new file +33 -0
new file mode 100644
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef NOMMU_H
+#define NOMMU_H
+
+#include <stdio.h>
+#include <string.h>
+
+/* Returns 1 for NOMMU, 0 for MMU, and -1 if /proc/meminfo is unavailable. */
+static inline int ksft_is_nommu(void)
+{
+	FILE *fp;
+	char line[256];
+	int nommu = 0;
+
+	fp = fopen("/proc/meminfo", "r");
+	if (!fp)
+		return -1;
+
+	while (fgets(line, sizeof(line), fp)) {
+		if (strncmp(line, "MmapCopy:", sizeof("MmapCopy:") - 1) == 0) {
+			nommu = 1;
+			break;
+		}
+	}
+
+	if (ferror(fp))
+		nommu = -1;
+	fclose(fp);
+
+	return nommu;
+}
+
+#endif
tools/testing/selftests/nommu/nommu_mmap_test.c new file +264 -0

264 lines not on this page · raw message

tools/testing/selftests/nommu/nommu_mremap_test.c new file +356 -0

356 lines not on this page · raw message

_

Patches currently in -mm which might be from [email protected] are