Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp865790pxb; Tue, 1 Feb 2022 12:03:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJxw/Dyb4VSBr7sJ51yTWmxoFUAu8jHJUgz/Lgc6t8F4Lt4heYAj0XYYCZDLhqBuGehv6AXh X-Received: by 2002:aa7:c647:: with SMTP id z7mr26914000edr.55.1643745797907; Tue, 01 Feb 2022 12:03:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643745797; cv=none; d=google.com; s=arc-20160816; b=LvVFWVMtNK/1D6rCIvLcgqW+r+9lo1B5dHFEDZ2SpQtUBLeWEbNpQtLlBGs3kVMZ8q kuJrs9fiyDVMsvl71NGFUm05O9E9nBT4GM2IlJP+N6/g45MkD955d2TN3glJ5aohz7Ja +YkqvZTGDh92ZdOsE6ge2lizSL5GtvdsOnAuP3dB9VwQAjag0Y2RbH5AkgUqQrwT7osz ojhD9dtFqBRwd3J8Awd2am0kwNdAG+MgpXZ/WZAVtr0vciCZw6o4u5ZClKM6Q9asm+Zc sW60FNJp6MbyPsnAWqXFVbXbIt/rdv1Zqs5NXA//4+NG+/ZOOSlDqWZ2GddBl/8fJnwX e8Zg== 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=aNmxXsRvyDwNeGjTDjg5xn4N19YNX9vI9R+hJVSdb2CWYSr91eRPJ6CFl4K3H8OtAn NN2UQZL1lAzYf/g1NJkjChCWsWv03sZsfplr2tBQS8NN7jTgrz7e4kL+5UFICDRPkfmk dZcnEZ05zb/+mvv+VEBo5EOICqc1t5yy9v+fQTDYtJSvj/xRGyQIoO3LUwUOczANtjCF ePfynYXG6CNx7iAMyFRUusl/nMQUE93tvGPsVu2yxLv3M897TxotuFpdgpy1ie2D+zdo lFj1cL//NGnQtHauvzIh9dLXGTtese5Vlsk/1JyIUiroDkAcqVNMHsas6rTpbu8NLiz8 iGfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xREsLyd4; 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 dr21si9980760ejc.150.2022.02.01.12.02.44; Tue, 01 Feb 2022 12:03:17 -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=xREsLyd4; 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 S1376988AbiAaLNb (ORCPT + 99 others); Mon, 31 Jan 2022 06:13:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377274AbiAaLJw (ORCPT ); Mon, 31 Jan 2022 06:09:52 -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 EBD93C0613AD; Mon, 31 Jan 2022 03:06:53 -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 B0D2BB82A4E; Mon, 31 Jan 2022 11:06:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 077DCC340E8; Mon, 31 Jan 2022 11:06:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643627211; bh=mSPsDwVGe2ggIIrr8GuSkvCuU4GuWcD6DNl1KssB0Kg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xREsLyd4VJpd8VCTtT9meBAbnHWSe8s+ph1Po9gvdVVfBuIaVO2kb/YOUoInOiTEf eEEww25gCdpvIOgwAm1eLiSVRPjqbcFvA4mS0gpL0RaMnnCQdhqsi4N/iz+kKHiTNv daY0SRNlsrZvJBOsu1tQW2eu9lwIIq3GUJFwzxJ8= 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.15 010/171] s390/nmi: handle guarded storage validity failures for KVM guests Date: Mon, 31 Jan 2022 11:54:35 +0100 Message-Id: <20220131105230.348610431@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220131105229.959216821@linuxfoundation.org> References: <20220131105229.959216821@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); }