Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp801850img; Fri, 22 Mar 2019 08:52:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqzNly7CykPypjcRG2oICmd/+f3twN9g/+OPWXN2YUFC7ZBnYIBs77MJ8JfzAu94JsO3H4Se X-Received: by 2002:a65:4341:: with SMTP id k1mr9519253pgq.175.1553269943843; Fri, 22 Mar 2019 08:52:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553269943; cv=none; d=google.com; s=arc-20160816; b=Tr/78+ccqny8aiqHsqZeM0I4s8z89pBKAourXqeyxF/+jpOejVlXn5IPSM4Cnt2NVs nqt0MGJedWo6cMwwTN6kstWH7BCBGKbPbgnFP9aQEzDLaRy1pxWN5kMdHu/0zshea8s4 yDZbxpykx+CVJ8FHkMjPBJ8YGWHDJmNbwaZM9GtyibMGUGRE/bN2GuLX7500zvQozNX9 fnPYgLPTp+E9xTwVsm+IdWWjN5opueWEOY03nNOvX6jAWm+jy8RtlNFmqcjrQqMZxoUU S1RCwjLYiR/EikqCKHv/e8MWwQaMY+0jE8OPrNB/aAUIVlOCtQYsg2jO3BtYtyCZ9TM6 BFPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=xaCS74E8r/tvOFvSakTM4krToKDvkt8sYK91i3lQ7uQ=; b=e0iQ84UqDp1apxVY1jRCd9vRwXYZLBSMvj4STeNZ1hRwsKYzg3km13++1rB21pTkqu USbdDJuaLEOw6HnvEEIKrnHf+h2GrlxXXlZVVfxXSnEGMtXAxQTNZTWmebR+KrUl6Z2f 4VqqhZ2QN12BsSIvzD3eNdXXuMHTTWqVj7jNOu3zO7oCfqSCOfKxjO4xICIswGN4wBo0 QYhr7NA31vopwEtTfkN73nR/A23GcITkzADeIiU+3SFEu1WMzMsmqtpuUn4/d1vErkpQ czUGWLK4852LQcA2Xz+Au6wDrvxzFrxtswV5ze99xHKFm1kGepEtlJqUjFc5qH0YGdby H8tw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o7si6924148pgh.273.2019.03.22.08.52.05; Fri, 22 Mar 2019 08:52:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727873AbfCVPt4 (ORCPT + 99 others); Fri, 22 Mar 2019 11:49:56 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:59885 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725981AbfCVPtz (ORCPT ); Fri, 22 Mar 2019 11:49:55 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1MUXh8-1hXrXA13M8-00QWTC; Fri, 22 Mar 2019 16:49:24 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Catalin Marinas , Will Deacon , Mark Rutland , "Eric W. Biederman" , Marc Zyngier , Anshuman Khandual , Andrey Konovalov Cc: Qiao Zhou , Arnd Bergmann , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.4.y 21/25] arm64: traps: disable irq in die() Date: Fri, 22 Mar 2019 16:44:12 +0100 Message-Id: <20190322154425.3852517-22-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190322154425.3852517-1-arnd@arndb.de> References: <20190322154425.3852517-1-arnd@arndb.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:3h0I8WSBNcOUW2oBof6q4Zhu/MkBQ6JfTTEKDc7C3t0ARWbsWDW LpKGcnzl45jHUFU9EP6rpjw/bhSVoXTjFVkix+HREzEV0D6h29XjIBciuqjvbl5ioglPyhZ o09rVRymoVQv97+wPo7JbUcvIqc+YXMps+5gOFwSUMbgnrjZ60/CJxMhUelO3jFDPtnRZnA qwT+QalE3JUyoRCgW6ApA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:OyNCwkcqWVk=:fnMCXM6qGiqalwHEgD8Iu2 pdyteGzjvepTLU+a3gAQMbqAZA+7QMp2r6Duc6ZGbHyBsvLRqjmRyEa8RPuMCpy4zJg8nSt2q 9NZRKRPGRykTQCCVwky0x4qJZ6zhOJXjP+z9dlHqcxrywdgoAcMOPrGibkrMEQhxCNC+/Xwvl S1TJ3gfoefECcdTdnEtUg8CUVdGEPTa5eaaOiUlneggP0hVD6RYYE/fPg9OVCpBICv0YqxfRb TshicGNuaCMyxlndntEGftdpt/cQCLNbKzlyNxSnwIXGST2AxFEn2+e4Koi+zrLAgx3yq8tEK AXigKZZr7JElicNSnXOAAq9uDVWMk9EV6l0wN5zZmOMqYPkDAbBZ+LscXN4B8UGUQRrNOHsjZ ZAt+2niyO+5EWFq4Zs+Ui5zONBpbxw4MiDOchKYerKvLuyr6RPMOIt+vyPbxzA9JNCr28IZrC S7b82gW4MQE359l+cI5RidYzYbMaDt4GteSbccTGYgIW5xa5PLYMY98/4thvelGEzNYBjbnRy VxQ0q1+sN/sRtpHEfx9YEte8Fjhs5Vx8cL1ThvWJf7PxnmXWqin//WwhlYAscLw+ZT1OQ5SIF FmC0A1Fxrzjdbofrt1Bo74vw8VdKyD7g4xMjxXlMPjjB5cHJoqAyI2uxcZzbjth40ZfxtY08X HVNXqZ3TNYDPmIFPcUo81haz7hCLWZR3/DWLQinW4+VRyS9nWS0sb7mK9yZ2ntWlrLZjByeCf GYKkMLUnW8IRzldjnvyioNNCGZVG2KYUfaCl3w== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Qiao Zhou In current die(), the irq is disabled for __die() handle, not including the possible panic() handling. Since the log in __die() can take several hundreds ms, new irq might come and interrupt current die(). If the process calling die() holds some critical resource, and some other process scheduled later also needs it, then it would deadlock. The first panic will not be executed. So here disable irq for the whole flow of die(). Signed-off-by: Qiao Zhou Signed-off-by: Will Deacon (cherry picked from commit 6f44a0bacb79a03972c83759711832b382b1b8ac) Signed-off-by: Arnd Bergmann --- arch/arm64/kernel/traps.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index 5d270ca76aec..6b4579e07aa2 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -239,10 +239,12 @@ void die(const char *str, struct pt_regs *regs, int err) { struct thread_info *thread = current_thread_info(); int ret; + unsigned long flags; + + raw_spin_lock_irqsave(&die_lock, flags); oops_enter(); - raw_spin_lock_irq(&die_lock); console_verbose(); bust_spinlocks(1); ret = __die(str, err, thread, regs); @@ -252,13 +254,15 @@ void die(const char *str, struct pt_regs *regs, int err) bust_spinlocks(0); add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE); - raw_spin_unlock_irq(&die_lock); oops_exit(); if (in_interrupt()) panic("Fatal exception in interrupt"); if (panic_on_oops) panic("Fatal exception"); + + raw_spin_unlock_irqrestore(&die_lock, flags); + if (ret != NOTIFY_STOP) do_exit(SIGSEGV); } -- 2.20.0