Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2255558imm; Mon, 28 May 2018 04:53:24 -0700 (PDT) X-Google-Smtp-Source: AB8JxZphtFG8hNlXRGoYfAaLMEBTBBotyvq2z3aQUdhx12JcKy/RBPbhCzBptpkUAumMFVharwJX X-Received: by 2002:a17:902:8218:: with SMTP id x24-v6mr13356098pln.57.1527508404781; Mon, 28 May 2018 04:53:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527508404; cv=none; d=google.com; s=arc-20160816; b=zosJ1FTMfbZxxssA9E3m4qIsfI4OeEFKKQ043P0jQanVLeO4N5ScY4sdktS4FlOBGX kFpi6mjn9ntJHxOjWMVPE7i1g4EoYjQa4TEiK0TvoYGfBT71m8XM74L9oPP+uEFfvLG1 cg3Wz+ZtEVsQLODXo8h+nI28i9YRuptdf26IeQaj7pL0iaz579hYwi0/h1sDDwtI97eW cR+Rl4Q5tdCFUuzAel/zk4o7mtJ57MCdtUUyGo8HdH3uP8H0xYU3hPdEtHWDMZ4ywSU4 ezX4fm/oZdsBim95CA2zNFwxVrhRKJ2kQZYD3ranl4CUv6g30lB6vcYxRgOs8zYH4PWf af2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=eXhyQHWcO6c2WAaSRmzaecfLjxKyMp/en70uDlCbIhM=; b=mC69CcsRNDFnp5HlaaTKSrMtGH1dW2e+5y6u2kCJzQCNtB530t2VIAaHcaSm2pBThD gBjV5d8fuCrxhd/NH2GFcKOl0NiACFeKnq9Ly7r63NdZpI+GhUh/837zpja64TpEOgdJ g0J0sqBtY1OZL+wdagLF+BJG9+tHScvhbVIYOhWvm+PxU3AnUFRWurcHmE57P9vXqwNL EPpKvwG1WsJE+awsgkkQxEuz+35+VogliWBZhTfP7D/pSkvFMhpklrlNJPrHvn6UbI7k unt9WW12WlL5sKVGTl80qCSG3wur40aQoLJvJG+Mp8PuAikI9LNtBXK1h1hZvhmThyzH aoGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Zd2jCgI9; 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 r2-v6si30365751pli.370.2018.05.28.04.53.10; Mon, 28 May 2018 04:53:24 -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; dkim=pass header.i=@kernel.org header.s=default header.b=Zd2jCgI9; 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 S1423760AbeE1LJ1 (ORCPT + 99 others); Mon, 28 May 2018 07:09:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:57108 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423305AbeE1LJS (ORCPT ); Mon, 28 May 2018 07:09:18 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 58260206B7; Mon, 28 May 2018 11:09:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527505757; bh=WDhykUpeD5dIfBLd3rPWlRh+lKnRtjh6Kjp47fo5pmY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zd2jCgI9Kg8MTEINdpmLn1RN4oA0yyskIn26HsWTz4azQts9f8ISlfNZh2dAy0yeE 4nW/xtjwBcKFZIE8etsW28FHPU0JunOHuZP4JOzDHg+Lo7U5IUj3yJaQgWclgWVXNB c5NO9oylJeCn34III0ExFEi8vhWptO9IEjsYc1ks= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Piggin , Michael Ellerman , Sasha Levin Subject: [PATCH 4.16 089/272] powerpc/64s: sreset panic if there is no debugger or crash dump handlers Date: Mon, 28 May 2018 12:02:02 +0200 Message-Id: <20180528100248.625273444@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100240.256525891@linuxfoundation.org> References: <20180528100240.256525891@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nicholas Piggin [ Upstream commit d40b6768e45bd9213139b2d91d30c7692b6007b1 ] system_reset_exception does most of its own crash handling now, invoking the debugger or crash dumps if they are registered. If not, then it goes through to die() to print stack traces, and then is supposed to panic (according to comments). However after die() prints oopses, it does its own handling which doesn't allow system_reset_exception to panic (e.g., it may just kill the current process). This patch causes sreset exceptions to return from die after it prints messages but before acting. This also stops die from invoking the debugger on 0x100 crashes. system_reset_exception similarly calls the debugger. It had been thought this was harmless (because if the debugger was disabled, neither call would fire, and if it was enabled the first call would return). However in some cases like xmon 'X' command, the debugger returns 0, which currently causes it to be entered again (first in system_reset_exception, then in die), which is confusing. Signed-off-by: Nicholas Piggin Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kernel/traps.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) --- a/arch/powerpc/kernel/traps.c +++ b/arch/powerpc/kernel/traps.c @@ -208,6 +208,12 @@ static void oops_end(unsigned long flags } raw_local_irq_restore(flags); + /* + * system_reset_excption handles debugger, crash dump, panic, for 0x100 + */ + if (TRAP(regs) == 0x100) + return; + crash_fadump(regs, "die oops"); if (kexec_should_crash(current)) @@ -272,8 +278,13 @@ void die(const char *str, struct pt_regs { unsigned long flags; - if (debugger(regs)) - return; + /* + * system_reset_excption handles debugger, crash dump, panic, for 0x100 + */ + if (TRAP(regs) != 0x100) { + if (debugger(regs)) + return; + } flags = oops_begin(regs); if (__die(str, regs, err))