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>] [day] [month] [year] [list]
Message-ID: <167429457670.4906.17321070796908774567.tip-bot2@tip-bot2>
Date:   Sat, 21 Jan 2023 09:49:36 -0000
From:   "tip-bot2 for Nicholas Piggin" <tip-bot2@...utronix.de>
To:     linux-tip-commits@...r.kernel.org
Cc:     Michael Ellerman <mpe@...erman.id.au>,
        Nicholas Piggin <npiggin@...il.com>,
        "Peter Zijlstra (Intel)" <peterz@...radead.org>,
        "Eric W. Biederman" <ebiederm@...ssion.com>, x86@...nel.org,
        linux-kernel@...r.kernel.org
Subject: [tip: sched/core] exit: Detect and fix irq disabled state in oops

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     001c28e57187570e4b5aa4492c7a957fb6d65d7b
Gitweb:        https://git.kernel.org/tip/001c28e57187570e4b5aa4492c7a957fb6d65d7b
Author:        Nicholas Piggin <npiggin@...il.com>
AuthorDate:    Fri, 20 Jan 2023 11:18:20 +10:00
Committer:     Peter Zijlstra <peterz@...radead.org>
CommitterDate: Sat, 21 Jan 2023 00:06:10 +01:00

exit: Detect and fix irq disabled state in oops

If a task oopses with irqs disabled, this can cause various cascading
problems in the oops path such as sleep-from-invalid warnings, and
potentially worse.

Since commit 0258b5fd7c712 ("coredump: Limit coredumps to a single
thread group"), the unconditional irq enable in coredump_task_exit()
will "fix" the irq state to be enabled early in do_exit(), so currently
this may not be triggerable, but that is coincidental and fragile.

Detect and fix the irqs_disabled() condition in the oops path before
calling do_exit(), similarly to the way in_atomic() is handled.

Reported-by: Michael Ellerman <mpe@...erman.id.au>
Signed-off-by: Nicholas Piggin <npiggin@...il.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Acked-by: "Eric W. Biederman" <ebiederm@...ssion.com>
Link: https://lore.kernel.org/lkml/20221004094401.708299-1-npiggin@gmail.com/
---
 kernel/exit.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/kernel/exit.c b/kernel/exit.c
index 15dc2ec..bccfa42 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -807,6 +807,8 @@ void __noreturn do_exit(long code)
 	struct task_struct *tsk = current;
 	int group_dead;
 
+	WARN_ON(irqs_disabled());
+
 	synchronize_group_exit(tsk, code);
 
 	WARN_ON(tsk->plug);
@@ -938,6 +940,11 @@ void __noreturn make_task_dead(int signr)
 	if (unlikely(!tsk->pid))
 		panic("Attempted to kill the idle task!");
 
+	if (unlikely(irqs_disabled())) {
+		pr_info("note: %s[%d] exited with irqs disabled\n",
+			current->comm, task_pid_nr(current));
+		local_irq_enable();
+	}
 	if (unlikely(in_atomic())) {
 		pr_info("note: %s[%d] exited with preempt_count %d\n",
 			current->comm, task_pid_nr(current),

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ