Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp874467pxb; Tue, 1 Feb 2022 12:12:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJwQ+I+Yy03ETQkrShLtGfus0JUylxX0F5hok38qrSCbydH/Ccy0hoXZM9V3jU5txM2MVGwd X-Received: by 2002:a17:902:c101:: with SMTP id 1mr27451625pli.70.1643746330312; Tue, 01 Feb 2022 12:12:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643746330; cv=none; d=google.com; s=arc-20160816; b=eJtJscQ2DhIJwGepXRTKb9scf1kg51d1yINncQH/5rzGIygBLLfU/kk7vCWkj1WdGT 0vfXU2VF4zwlnnqD0B5AagQS4EEE2zGBP1Ctzc4/yOnV/zxoNjWWFciRbEcU2zu8xxVc fGWcn4I5VAbI4ZbK1xxAI0uU/aG1taWw/CR5GuE+gqB7hFLtOO3MH30SonuYjTsseWcb 6WtfTE9S3uq1RCIJMyPRIvJ2jkv4ZJ1UjuKo7c+U03EyZCn42NGjT4m9tHIzBfB83SNW 3FU1pvx6Abc1ZgjKtFY/7kFfS8WOdJ/8u5r2SRmm6j+14YMKneSvfc6B9zctFMdO1CIm thGg== 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=F1MYIsq1LDYJpAHNIhbpRSmWmpAyDZ4xnc3AkCIIu6E=; b=iM49C+qrWlO688Pcwj1QHyZtCQkOWcYNOVsz5M8Iuo3Zps41bseyviML1TL/zkE/Q9 EIkXescpaKOKmOEtX1R6dbHq5E5/5ubG1bYSVoAXpoLc6/GwMg6+t8R50R2xaASlPoO8 NDlIlrGhVtlec1uU8gb+Ov2qT2V9TaoaaNesIbhCdw3u1uU5bNaIZOoBvCpyjWYdjgaO BSAZ6xxh0iU5vRLsMKVppGm+AgOTCA3AlKz8jt0GvyLSsJhECUqKRlENDaEocKM+pP1m lW2VlgcglXxMD6hE/+CfoidI2kkcq+pHuAvCmJ8kkAHVl3a3a629QuuO5OWyjrF3R6ZU AdqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="BZ/xzjo0"; 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 q65si4723064pgq.98.2022.02.01.12.11.58; Tue, 01 Feb 2022 12:12:10 -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="BZ/xzjo0"; 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 S1376474AbiAaLlo (ORCPT + 99 others); Mon, 31 Jan 2022 06:41:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350901AbiAaL0k (ORCPT ); Mon, 31 Jan 2022 06:26:40 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67C1EC08ED70; Mon, 31 Jan 2022 03:16:09 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 33892B82A60; Mon, 31 Jan 2022 11:16:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FA31C340EE; Mon, 31 Jan 2022 11:16:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643627767; bh=mSPsDwVGe2ggIIrr8GuSkvCuU4GuWcD6DNl1KssB0Kg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BZ/xzjo0cDasD2QqKJuw0ihXSyX09ASfQRAk7ZDXmc/tWa4bUosUFDJz01bWfjbo1 /fccq54LC9KPJx1bKVydo2VPqJ+T4AXpezWF8HBANvNyKi3AHGyvnYkydNTxFj6BQK A2qbhMCeFjaA4X3XuQ0SXsxQLkDC9ZDJZ7jzf1SM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Carsten Otte , Christian Borntraeger , Heiko Carstens Subject: [PATCH 5.16 019/200] s390/nmi: handle guarded storage validity failures for KVM guests Date: Mon, 31 Jan 2022 11:54:42 +0100 Message-Id: <20220131105234.207279728@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220131105233.561926043@linuxfoundation.org> References: <20220131105233.561926043@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: Christian Borntraeger commit 1ea1d6a847d2b1d17fefd9196664b95f052a0775 upstream. machine check validity bits reflect the state of the machine check. If a guest does not make use of guarded storage, the validity bit might be off. We can not use the host CR bit to decide if the validity bit must be on. So ignore "invalid" guarded storage controls for KVM guests in the host and rely on the machine check being forwarded to the guest. If no other errors happen from a host perspective everything is fine and no process must be killed and the host can continue to run. Cc: stable@vger.kernel.org Fixes: c929500d7a5a ("s390/nmi: s390: New low level handling for machine check happening in guest") Reported-by: Carsten Otte Signed-off-by: Christian Borntraeger Tested-by: Carsten Otte Reviewed-by: Heiko Carstens Signed-off-by: Heiko Carstens Signed-off-by: Greg Kroah-Hartman --- arch/s390/kernel/nmi.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) --- a/arch/s390/kernel/nmi.c +++ b/arch/s390/kernel/nmi.c @@ -316,11 +316,21 @@ static int notrace s390_validate_registe if (cr2.gse) { if (!mci.gs) { /* - * Guarded storage register can't be restored and - * the current processes uses guarded storage. - * It has to be terminated. + * 2 cases: + * - machine check in kernel or userspace + * - machine check while running SIE (KVM guest) + * For kernel or userspace the userspace values of + * guarded storage control can not be recreated, the + * process must be terminated. + * For SIE the guest values of guarded storage can not + * be recreated. This is either due to a bug or due to + * GS being disabled in the guest. The guest will be + * notified by KVM code and the guests machine check + * handling must take care of this. The host values + * are saved by KVM and are not affected. */ - kill_task = 1; + if (!test_cpu_flag(CIF_MCCK_GUEST)) + kill_task = 1; } else { load_gs_cb((struct gs_cb *)mcesa->guarded_storage_save_area); }