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-next>] [day] [month] [year] [list]
Message-Id: <20210206125940.111766-1-ikhoronz@cisco.com>
Date:   Sat,  6 Feb 2021 12:59:40 +0000
From:   Ivan Khoronzhuk <ikhoronz@...co.com>
To:     linux-mips@...r.kernel.org, tsbogend@...ha.franken.de,
        linux-kernel@...r.kernel.org
Cc:     yangtiezhu@...ngson.cn, rppt@...nel.org, ivan.khoronzhuk@...il.com,
        Ivan Khoronzhuk <ikhoronz@...co.com>
Subject: [PATCH] mips: kernel: setup: fix crash kernel resource allocation

In order to avoid crash kernel corruption, its memory is reserved
early in memblock and as result, in time when resources are inited
it's not present in memblock.memory, so crash kernel memory is out
of ranges listed with for_each_mem_range(). To avoid it and still
keep memory reserved lets reseve it out of loop by inserting it in
iomem_resource.

Fixes: a94e4f24ec83 ("MIPS: init: Drop boot_mem_map")
Signed-off-by: Ivan Khoronzhuk <ikhoronz@...co.com>
---
Based on linux-next/master

 arch/mips/kernel/setup.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 3785c72bc3bc..25e376ef2f2a 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -473,14 +473,15 @@ static void __init mips_parse_crashkernel(void)
 	crashk_res.end	 = crash_base + crash_size - 1;
 }
 
-static void __init request_crashkernel(struct resource *res)
+static void __init request_crashkernel(void)
 {
 	int ret;
 
 	if (crashk_res.start == crashk_res.end)
 		return;
 
-	ret = request_resource(res, &crashk_res);
+	/* The crashk resource shoud be located in normal mem */
+	ret = insert_resource(&iomem_resource, &crashk_res);
 	if (!ret)
 		pr_info("Reserving %ldMB of memory at %ldMB for crashkernel\n",
 			(unsigned long)(resource_size(&crashk_res) >> 20),
@@ -734,8 +735,9 @@ static void __init resource_init(void)
 		request_resource(res, &code_resource);
 		request_resource(res, &data_resource);
 		request_resource(res, &bss_resource);
-		request_crashkernel(res);
 	}
+
+	request_crashkernel();
 }
 
 #ifdef CONFIG_SMP
-- 
2.23.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ