[merged mm-stable] s390-mm-define-kmsan-metadata-for-vmalloc-and-modules.patch removed from -mm tree

0 views
Skip to first unread message

Andrew Morton

unread,
Jun 28, 2024, 10:31:21 PM (4 days ago) Jun 28
to mm-co...@vger.kernel.org, vba...@suse.cz, sv...@linux.ibm.com, ros...@goodmis.org, roman.g...@linux.dev, rien...@google.com, pen...@kernel.org, mhir...@kernel.org, mark.r...@arm.com, kasa...@googlegroups.com, iamjoon...@lge.com, h...@linux.ibm.com, g...@linux.ibm.com, gli...@google.com, el...@google.com, dvy...@google.com, c...@linux.com, bornt...@linux.ibm.com, agor...@linux.ibm.com, 42.h...@gmail.com, i...@linux.ibm.com, ak...@linux-foundation.org

The quilt patch titled
Subject: s390/mm: define KMSAN metadata for vmalloc and modules
has been removed from the -mm tree. Its filename was
s390-mm-define-kmsan-metadata-for-vmalloc-and-modules.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: Ilya Leoshkevich <i...@linux.ibm.com>
Subject: s390/mm: define KMSAN metadata for vmalloc and modules
Date: Fri, 21 Jun 2024 13:35:15 +0200

The pages for the KMSAN metadata associated with most kernel mappings are
taken from memblock by the common code. However, vmalloc and module
metadata needs to be defined by the architectures.

Be a little bit more careful than x86: allocate exactly MODULES_LEN for
the module shadow and origins, and then take 2/3 of vmalloc for the
vmalloc shadow and origins. This ensures that users passing small
vmalloc= values on the command line do not cause module metadata
collisions.

Link: https://lkml.kernel.org/r/20240621113706...@linux.ibm.com
Signed-off-by: Ilya Leoshkevich <i...@linux.ibm.com>
Reviewed-by: Alexander Potapenko <gli...@google.com>
Acked-by: Alexander Gordeev <agor...@linux.ibm.com>
Acked-by: Heiko Carstens <h...@linux.ibm.com>
Cc: Christian Borntraeger <bornt...@linux.ibm.com>
Cc: Christoph Lameter <c...@linux.com>
Cc: David Rientjes <rien...@google.com>
Cc: Dmitry Vyukov <dvy...@google.com>
Cc: Hyeonggon Yoo <42.h...@gmail.com>
Cc: Joonsoo Kim <iamjoon...@lge.com>
Cc: <kasa...@googlegroups.com>
Cc: Marco Elver <el...@google.com>
Cc: Mark Rutland <mark.r...@arm.com>
Cc: Masami Hiramatsu (Google) <mhir...@kernel.org>
Cc: Pekka Enberg <pen...@kernel.org>
Cc: Roman Gushchin <roman.g...@linux.dev>
Cc: Steven Rostedt (Google) <ros...@goodmis.org>
Cc: Sven Schnelle <sv...@linux.ibm.com>
Cc: Vasily Gorbik <g...@linux.ibm.com>
Cc: Vlastimil Babka <vba...@suse.cz>
Signed-off-by: Andrew Morton <ak...@linux-foundation.org>
---

arch/s390/boot/startup.c | 7 +++++++
arch/s390/include/asm/pgtable.h | 12 ++++++++++++
2 files changed, 19 insertions(+)

--- a/arch/s390/boot/startup.c~s390-mm-define-kmsan-metadata-for-vmalloc-and-modules
+++ a/arch/s390/boot/startup.c
@@ -301,11 +301,18 @@ static unsigned long setup_kernel_memory
MODULES_END = round_down(kernel_start, _SEGMENT_SIZE);
MODULES_VADDR = MODULES_END - MODULES_LEN;
VMALLOC_END = MODULES_VADDR;
+ if (IS_ENABLED(CONFIG_KMSAN))
+ VMALLOC_END -= MODULES_LEN * 2;

/* allow vmalloc area to occupy up to about 1/2 of the rest virtual space left */
vsize = (VMALLOC_END - FIXMAP_SIZE) / 2;
vsize = round_down(vsize, _SEGMENT_SIZE);
vmalloc_size = min(vmalloc_size, vsize);
+ if (IS_ENABLED(CONFIG_KMSAN)) {
+ /* take 2/3 of vmalloc area for KMSAN shadow and origins */
+ vmalloc_size = round_down(vmalloc_size / 3, _SEGMENT_SIZE);
+ VMALLOC_END -= vmalloc_size * 2;
+ }
VMALLOC_START = VMALLOC_END - vmalloc_size;

__memcpy_real_area = round_down(VMALLOC_START - MEMCPY_REAL_SIZE, PAGE_SIZE);
--- a/arch/s390/include/asm/pgtable.h~s390-mm-define-kmsan-metadata-for-vmalloc-and-modules
+++ a/arch/s390/include/asm/pgtable.h
@@ -107,6 +107,18 @@ static inline int is_module_addr(void *a
return 1;
}

+#ifdef CONFIG_KMSAN
+#define KMSAN_VMALLOC_SIZE (VMALLOC_END - VMALLOC_START)
+#define KMSAN_VMALLOC_SHADOW_START VMALLOC_END
+#define KMSAN_VMALLOC_SHADOW_END (KMSAN_VMALLOC_SHADOW_START + KMSAN_VMALLOC_SIZE)
+#define KMSAN_VMALLOC_ORIGIN_START KMSAN_VMALLOC_SHADOW_END
+#define KMSAN_VMALLOC_ORIGIN_END (KMSAN_VMALLOC_ORIGIN_START + KMSAN_VMALLOC_SIZE)
+#define KMSAN_MODULES_SHADOW_START KMSAN_VMALLOC_ORIGIN_END
+#define KMSAN_MODULES_SHADOW_END (KMSAN_MODULES_SHADOW_START + MODULES_LEN)
+#define KMSAN_MODULES_ORIGIN_START KMSAN_MODULES_SHADOW_END
+#define KMSAN_MODULES_ORIGIN_END (KMSAN_MODULES_ORIGIN_START + MODULES_LEN)
+#endif
+
#ifdef CONFIG_RANDOMIZE_BASE
#define KASLR_LEN (1UL << 31)
#else
_

Patches currently in -mm which might be from i...@linux.ibm.com are


Reply all
Reply to author
Forward
0 new messages