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] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230509110739.241735-3-npiggin@gmail.com>
Date:   Tue,  9 May 2023 21:07:38 +1000
From:   Nicholas Piggin <npiggin@...il.com>
To:     linux-kernel@...r.kernel.org
Cc:     Nicholas Piggin <npiggin@...il.com>, linux-arch@...r.kernel.org,
        Thomas Gleixner <tglx@...utronix.de>,
        Peter Zijlstra <peterz@...radead.org>
Subject: [RFC PATCH 2/3] init: Require archs call start_kernel with arch irqs disabled

Let's require start_kernel() is called with arch_irqs_disabled. For now,
just correct that condition and print a warning if CONFIG_DEBUG_IRQFLAGS
is set.

This prevents core code from disabling irqs when they are already
disabled, in aid of eventually adding a debug check to catch that
condition.

Signed-off-by: Nicholas Piggin <npiggin@...il.com>
---
 init/main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/init/main.c b/init/main.c
index af50044deed5..f3979628943e 100644
--- a/init/main.c
+++ b/init/main.c
@@ -889,7 +889,11 @@ asmlinkage __visible void __init __no_sanitize_address __noreturn start_kernel(v
 
 	cgroup_init_early();
 
-	local_irq_disable();
+	if (!raw_irqs_disabled()) {
+		raw_local_irq_disable();
+		if (IS_ENABLED(CONFIG_DEBUG_IRQFLAGS))
+			WARN_ONCE(1, "arch should call start_kernel with arch_irqs_disabled\n");
+	}
 	early_boot_irqs_disabled = true;
 
 	/*
-- 
2.40.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ