Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp408270pxu; Tue, 1 Dec 2020 14:31:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJwbVizETC2Qu0MzjpgBaiIjVsRXoxNbAl2jZ/3cLefRr8SoGeKyG//JPvlbeNEr2q1ZVDBo X-Received: by 2002:a17:906:f1cc:: with SMTP id gx12mr5091438ejb.164.1606861874820; Tue, 01 Dec 2020 14:31:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606861874; cv=none; d=google.com; s=arc-20160816; b=bBPCzUmMEfcmkb32J1Wrg4rH3QQMXPB/2sOUPI2lz/bZAAczfe0SHVKUG9TG4lj49c L9Q1n/LJNuJs6aIqeuZq9WhnheafowsBFAM6FU10Xa8VGveKVpcwsKzEmtZoizllgBPs zUbxjhtRtQXXzCuxJZwSHjiwc6t8dWhiTN4G0xXR1BT8iqEwf2RXKMw45NqeIJta7wmO f1NehrgjJKhGAQInB48BfSMA04SHUNnnUu5O3ph1+StAuE31E/zx34JNUzVnmL5b+dk5 ich6K1mr0bvxmN0gxL7LDYyePDCgaZJxhdvZQGjniNqQVgFvg+C6MovDAL5xnOJsQmUM QoyQ== 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=FHl2xTOnHxEoIsvYxw95Ypqx76T8uX6vbTkVYYj8UrI=; b=QPwvqz1JyowWP9Yb/hmQjgI8oUpVvxXPiYMQWWz4bwnvOazqWP4muleys+89zgMCFN AoQf0gbUfKswVNQrrLs47ZlfzW/POhTxn0NGQEKnTf6j+6Wo5GPHYA9O868GsXU+z6ta Lydab46zUIcBJKILlWiStVYGSxR3gyhXLknwmQfk3JusqxrFMYczpnNlqoLwOHysxbKu mfMzrPYmAnQjprek/idw/OIgiDtAm3Rmaw6sDqf2ii04tNTBw/08ZP4zrWlACBVuRqNI 1GUyfIhXs/cJoo4Lp2AL84iOIpMolvMA0UQw/ZxZW7I6KDXe5aoiftrP1PWIA4nnsTFG nIwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GZ5RFX1q; 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 gb14si760551ejc.507.2020.12.01.14.30.52; Tue, 01 Dec 2020 14:31:14 -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=GZ5RFX1q; 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 S1729552AbgLAJXq (ORCPT + 99 others); Tue, 1 Dec 2020 04:23:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:42546 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388615AbgLAJGe (ORCPT ); Tue, 1 Dec 2020 04:06:34 -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 10AAF20671; Tue, 1 Dec 2020 09:06:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606813578; bh=Z0sBvT0EL6CU55gckHLrogO86kVHb6i9O8ryaExbsL0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GZ5RFX1qv1ow0kQ/SCZxPk/2tHZFyQKEXO6usgekd2R2/mrPfGoM3EabRTraKUHua KxwPHj1QGBNlgk+72pXfdiWQGLR8J3rdhpJ7Pk5PxFlO5ycrwrClkMeD9uPX3V2T03 DWxlYiBDH9EtHehI3MWxgE5+z0VxB2iWO3slOX0s= 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.4 86/98] x86/mce: Do not overwrite no_way_out if mce_end() fails Date: Tue, 1 Dec 2020 09:54:03 +0100 Message-Id: <20201201084659.257135691@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201201084652.827177826@linuxfoundation.org> References: <20201201084652.827177826@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 @@ -1361,8 +1361,10 @@ void do_machine_check(struct pt_regs *re * 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