Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp406989pxu; Tue, 1 Dec 2020 14:29:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJyqc1jCJJF6l00H3qDLSDM/K8hyUjs/TPjM/DkFbpU0P7AdJiLemP+TktjX2xgULV+7i1sL X-Received: by 2002:a17:906:6d58:: with SMTP id a24mr4934262ejt.298.1606861744126; Tue, 01 Dec 2020 14:29:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606861744; cv=none; d=google.com; s=arc-20160816; b=fvAM2owPDxe5jYkI3zPO765t/G/bpINJZm2IqqlNBnzlrfkSDPvnmbelrpCPvM7cp2 5yGoKFEgmrzlRBRENgLfC8CregCA4zwq1QNbmG4vaTwVgYppyWNe4TyM6O92Kc3+ErGa +duMMQU7AWWbEFrLGh8qb/C0CTQ2TySlUW5sb4ZaHogY3AFqOqn2OKRj52XU6px36jkA SDMEBh55jAEdj7OacEbR/4aaF1Mp+al0mooZp8e4bFSH9jAH8KOfSCG437wwpMzXn89U PMUFiwsB50uhB5YLm1lYVyVlZYlrWelaAUlMxGhA6U85fdumHhH8HqiAUDTmJw0nOmrQ 5C6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=beL5t+ajqbeT3FWZVWI91JPvMcvJBxV9HwPH81JlVJk=; b=SCmxyhub9p3kES91dJdA3of8fvdP2Ziu5vmtWFxTYDGs6z50Dy/suXi6Wt82UAtL1r aQ7k4DSb2rBV+1+FO7GxGX61SmvUFj19WjMVTgtFMBMh9rL8zlsLmd0spUQQzxdq1ML5 oU6dedMpxrd+eBdhcAc0C2cx4mPLLnh3K2+rA+IibJlqW65tAIBOT+oIGtVm0xiOBMjs CqjsxYFVj3IZHx6cGD0rdNU4+oeTpDpdY4Z9iXZFB81DUyizE9Ji+kPoso/zQgOtXr73 ej/HUhJzWOBgBH5IRUpJ8CNN3rTTy9oTGshrXLntSqMia3+kEtnsDR2wIMyOTpTSPwNG jQkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=P1PTznhS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p25si838716ejx.88.2020.12.01.14.28.41; Tue, 01 Dec 2020 14:29:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=P1PTznhS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390202AbgLAJPo (ORCPT + 99 others); Tue, 1 Dec 2020 04:15:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:54084 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390443AbgLAJPQ (ORCPT ); Tue, 1 Dec 2020 04:15:16 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 3F3B620656; Tue, 1 Dec 2020 09:14:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606814075; bh=1uaD0cjVTc0yfXt0xJqIVsB+2NUgvutpUbrpETVOIcA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P1PTznhSzNr2VC03go1GCjDQ5ZSV1VA6IeK1nxb6CZEjW8yZsFv3HxASGHHl9MAbn iNAMnB5MEhabroWMwnR1BV+1YROU4wI6XzXQ6AWHUSkoC2+ZnUugIJUS6K4lac2xkd lAWpMmyVJB0rTh7L+EK5elffAQbGixVmtz1sT6MM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gabriele Paoloni , Borislav Petkov , Tony Luck Subject: [PATCH 5.9 148/152] x86/mce: Do not overwrite no_way_out if mce_end() fails Date: Tue, 1 Dec 2020 09:54:23 +0100 Message-Id: <20201201084731.240832074@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201201084711.707195422@linuxfoundation.org> References: <20201201084711.707195422@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Gabriele Paoloni commit 25bc65d8ddfc17cc1d7a45bd48e9bdc0e729ced3 upstream. Currently, if mce_end() fails, no_way_out - the variable denoting whether the machine can recover from this MCE - is determined by whether the worst severity that was found across the MCA banks associated with the current CPU, is of panic severity. However, at this point no_way_out could have been already set by mca_start() after looking at all severities of all CPUs that entered the MCE handler. If mce_end() fails, check first if no_way_out is already set and, if so, stick to it, otherwise use the local worst value. [ bp: Massage. ] Signed-off-by: Gabriele Paoloni Signed-off-by: Borislav Petkov Reviewed-by: Tony Luck Cc: Link: https://lkml.kernel.org/r/20201127161819.3106432-2-gabriele.paoloni@intel.com Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/mce/core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -1363,8 +1363,10 @@ noinstr void do_machine_check(struct pt_ * When there's any problem use only local no_way_out state. */ if (!lmce) { - if (mce_end(order) < 0) - no_way_out = worst >= MCE_PANIC_SEVERITY; + if (mce_end(order) < 0) { + if (!no_way_out) + no_way_out = worst >= MCE_PANIC_SEVERITY; + } } else { /* * If there was a fatal machine check we should have