lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240718021822.1545976-2-quic_obabatun@quicinc.com>
Date: Wed, 17 Jul 2024 19:18:21 -0700
From: Oreoluwa Babatunde <quic_obabatun@...cinc.com>
To: <dalias@...c.org>, <glaubitz@...sik.fu-berlin.de>,
        <ysato@...rs.sourceforge.jp>
CC: <kernel@...cinc.com>, <linux-kernel@...r.kernel.org>,
        <linux-sh@...r.kernel.org>, <robh+dt@...nel.org>,
        Oreoluwa Babatunde
	<quic_obabatun@...cinc.com>
Subject: [PATCH v5 1/2] sh: Restructure call site for early_reserve_mem()

early_reserve_mem() reserves memory for important regions in the kernel
such as kernel text region and bootmem bitmap.
Reserving these memory regions should take precedence over any other
reserved memory allocations so that the system does not unknowingly
reserve them for some other use case.

Hence, move the call site of early_reserve_mem() out of the
paging_init() function and into an earlier point in setup_arch()

Signed-off-by: Oreoluwa Babatunde <quic_obabatun@...cinc.com>
---
 arch/sh/include/asm/mmu.h | 1 +
 arch/sh/kernel/setup.c    | 3 +++
 arch/sh/mm/init.c         | 5 ++---
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/sh/include/asm/mmu.h b/arch/sh/include/asm/mmu.h
index 172e329fd92d..696e303a2f19 100644
--- a/arch/sh/include/asm/mmu.h
+++ b/arch/sh/include/asm/mmu.h
@@ -96,6 +96,7 @@ static inline int pmb_unmap(void __iomem *addr)
 
 #endif /* CONFIG_PMB */
 
+void __init early_reserve_mem(void);
 static inline void __iomem *
 pmb_remap(phys_addr_t phys, unsigned long size, pgprot_t prot)
 {
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index 620e5cf8ae1e..3b0bc191a2a2 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -40,6 +40,7 @@
 #include <asm/setup.h>
 #include <asm/clock.h>
 #include <asm/smp.h>
+#include <asm/mmu.h>
 #include <asm/mmu_context.h>
 #include <asm/mmzone.h>
 #include <asm/processor.h>
@@ -319,6 +320,8 @@ void __init setup_arch(char **cmdline_p)
 
 	sh_mv_setup();
 
+	early_reserve_mem();
+
 	/* Let earlyprintk output early console messages */
 	sh_early_platform_driver_probe("earlyprintk", 1, 1);
 
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index bf1b54055316..643e3617c6a6 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -19,6 +19,7 @@
 #include <linux/io.h>
 #include <linux/dma-mapping.h>
 #include <linux/export.h>
+#include <asm/mmu.h>
 #include <asm/mmu_context.h>
 #include <asm/mmzone.h>
 #include <asm/kexec.h>
@@ -242,7 +243,7 @@ static void __init do_init_bootmem(void)
 	sparse_init();
 }
 
-static void __init early_reserve_mem(void)
+void __init early_reserve_mem(void)
 {
 	unsigned long start_pfn;
 	u32 zero_base = (u32)__MEMORY_START + (u32)PHYSICAL_OFFSET;
@@ -282,8 +283,6 @@ void __init paging_init(void)
 
 	sh_mv.mv_mem_init();
 
-	early_reserve_mem();
-
 	/*
 	 * Once the early reservations are out of the way, give the
 	 * platforms a chance to kick out some memory.
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ