Message ID | 167429457670.4906.17321070796908774567.tip-bot2@tip-bot2 |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp651738wrn; Sat, 21 Jan 2023 01:54:45 -0800 (PST) X-Google-Smtp-Source: AMrXdXuPlRGkIg7pbH0I/cWv0GamW258CcktzlXrFJJmM9SHY2XUp/Q5iWiPchBrjULesQI3Tiux X-Received: by 2002:a50:9ee2:0:b0:49e:e12a:a216 with SMTP id a89-20020a509ee2000000b0049ee12aa216mr4234068edf.6.1674294885239; Sat, 21 Jan 2023 01:54:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674294885; cv=none; d=google.com; s=arc-20160816; b=CN5ZhUQ6lCo49gKJumF1ddEjxNUEP6icDXN8wS+v8xJD+gKz9zNg4vsfL2/xj3BhWA 4HscIRG4hksPX7E0eHMJbPyPNs2fxSAiISbU6IP8XY5TRDYvbE/fvvtCklkQISn9097S jFiio4Z9dCS1ZncAj6NcHXY9AGnxA1ZqBy6plBBNehkIDBZ9gIeivlwJ5GzDyh2fsP+i Q2X/QVjMUXSTNcFyfLAa5jgdXr3hQWg93j33aoNkuEtLk8NvdSMpqkc4gHXDtymPU6p8 n8nZGodeh1miyvXDxaTUp2kZDpiYp6TR3DBAZ+WTm+zkp88B3ZDOagCR8l1pBsA5g5Y9 PsJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:cc:subject:to:reply-to:sender:from :dkim-signature:dkim-signature:date; bh=IbbhcF8jjbhatiPNBh3NGG62KRGU4zaxGafUDJYl9Xo=; b=W/12yquGf+J26MmPD3JTniNCZ8GmouXkb6wQ+5WoIl9O/eMt6A+n8HYZkSiqhwMDQD +aavGAsXpHOfxoOBrHZpGWbSqluR1K8pQ4phRkq+K8iRcK/HN0tyMBIsqeujM6OV7q8J 3AK2pdcLahZFXnKm+21NclJE+ccxFi7S2Sa/hf5tPzI+62Okir1bhOPy2sqN7iYSuTY4 Z8riH0/zq3P+Pzxb7hD0jSgExXUG1Zm6je1DexiOSWNz22d2JGzHaP+Ok3HZ57Thd+JC Hrqa2dgWFcJIkEj+VN0D66+2tAz0n9Ygmc4M+ZKaQP7BKxzXeKg+MXzpIpnohwHcGkgP syCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=3qdi+WCe; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p6-20020a05640243c600b0049e267d9398si14588559edc.327.2023.01.21.01.54.21; Sat, 21 Jan 2023 01:54:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=3qdi+WCe; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229955AbjAUJt6 (ORCPT <rfc822;forouhar.linux@gmail.com> + 99 others); Sat, 21 Jan 2023 04:49:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229553AbjAUJtj (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 21 Jan 2023 04:49:39 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 754205C0FD; Sat, 21 Jan 2023 01:49:38 -0800 (PST) Date: Sat, 21 Jan 2023 09:49:36 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1674294577; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IbbhcF8jjbhatiPNBh3NGG62KRGU4zaxGafUDJYl9Xo=; b=3qdi+WCe7F+binSuegDbdFWwtU6R5n49zTlkJ4OQI9qZbjLigiIBGhaDb8eT/hYKFtOHqt 096KIQXmTYg9Lqu+Hxt5rU76EC8cwRXHzfNRZL930XMIB4x6oSFINqYdHXN6aJ2QJx5Ym/ zTDQz5WezMTe2VrEnnR1A1uv/xdN2Ii4ZQC8BauktC/lEbr5lglMQthvFW3+npnNm9J86S R8t5iItd7KxDvmoURglFWukbl2ZK+A1ATS10DhV5CgtWThWJmlZOausUUfdCGCFoI0Bzmt Vs4KiWlNTeu4xJ/fNU8HXb76XoZMW+eXCX5pvMa341U28VDvyDYRzvbZDmIp4w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1674294577; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IbbhcF8jjbhatiPNBh3NGG62KRGU4zaxGafUDJYl9Xo=; b=rty5S76/5R5b00dXHLgRjXA43kXY9IMoRjtQNj+Q+YSpFzPtq9ywb2RGjAeR07Z23bifWb SDZbxU5AE7tSkfBg== From: "tip-bot2 for Nicholas Piggin" <tip-bot2@linutronix.de> Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] exit: Detect and fix irq disabled state in oops Cc: Michael Ellerman <mpe@ellerman.id.au>, Nicholas Piggin <npiggin@gmail.com>, "Peter Zijlstra (Intel)" <peterz@infradead.org>, "Eric W. Biederman" <ebiederm@xmission.com>, x86@kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Message-ID: <167429457670.4906.17321070796908774567.tip-bot2@tip-bot2> Robot-ID: <tip-bot2@linutronix.de> Robot-Unsubscribe: Contact <mailto:tglx@linutronix.de> to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755625433315863097?= X-GMAIL-MSGID: =?utf-8?q?1755625433315863097?= |
Series |
[tip:,sched/core] exit: Detect and fix irq disabled state in oops
|
|
Commit Message
tip-bot2 for Thomas Gleixner
Jan. 21, 2023, 9:49 a.m. UTC
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@gmail.com> AuthorDate: Fri, 20 Jan 2023 11:18:20 +10:00 Committer: Peter Zijlstra <peterz@infradead.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@ellerman.id.au> Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: "Eric W. Biederman" <ebiederm@xmission.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),