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]
Date:   Thu, 29 Jun 2023 18:58:39 +0800
From:   Song Shuai <suagrfillet@...il.com>
To:     paul.walmsley@...ive.com, palmer@...belt.com,
        aou@...s.berkeley.edu, conor.dooley@...rochip.com,
        ajones@...tanamicro.com, sunilvl@...tanamicro.com,
        heiko.stuebner@...ll.eu, apatel@...tanamicro.com,
        suagrfillet@...il.com, evan@...osinc.com, greentime.hu@...ive.com,
        leyfoon.tan@...rfivetech.com
Cc:     linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH] riscv: BUG_ON() for no cpu nodes in setup_smp

When booting with ACPI tables, the tiny devictree created by
EFI Stub doesn't provide cpu nodes.

In setup_smp(), of_parse_and_init_cpus() will bug on !found_boot_cpu
if acpi_disabled. That's unclear, so bug for no cpu nodes before
of_parse_and_init_cpus().

Signed-off-by: Song Shuai <suagrfillet@...il.com>
---
 arch/riscv/kernel/smpboot.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c
index 6ca2b5309aab..243a7b533ad7 100644
--- a/arch/riscv/kernel/smpboot.c
+++ b/arch/riscv/kernel/smpboot.c
@@ -187,8 +187,13 @@ static void __init of_parse_and_init_cpus(void)
 
 void __init setup_smp(void)
 {
-	if (acpi_disabled)
+	if (acpi_disabled) {
+		/* When booting with ACPI tables, the devictree created by EFI Stub
+		 * doesn't provide cpu nodes. So BUG here for any acpi_disabled.
+		 */
+		BUG_ON(!of_get_next_cpu_node(NULL));
 		of_parse_and_init_cpus();
+	}
 	else
 		acpi_parse_and_init_cpus();
 }
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ