Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2886087rwb; Mon, 15 Aug 2022 13:18:43 -0700 (PDT) X-Google-Smtp-Source: AA6agR4upZc9LFKth9u/mRwW+5NlkoyCws1dgk3fNHhqMxMGnWHFsneVr+07GiF41TQZTCQxmxH/ X-Received: by 2002:a05:6a00:234f:b0:525:1f7c:f2bf with SMTP id j15-20020a056a00234f00b005251f7cf2bfmr18109757pfj.14.1660594722752; Mon, 15 Aug 2022 13:18:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660594722; cv=none; d=google.com; s=arc-20160816; b=otkkZmsBUDhi7bBVz49/OYI6IabAFpuR4J6WmceU03B3+ESVATIQqMaJc0k/1wkobV Zx1JOATlOUC4GbSDMXANyEbs/GAcmJdTBKN6VWOuPq2186Te8TA/bKOaT18msdlhkhNV 1r7reuGonwFHSgUO+dH0wTd5dQYAYKU1KKw8TY6RMGWzp2NsedIMkLmB2ZWcR7pcUl8x RnmU/jqe8GgXPPtdTX3LgR9RqbRJUy1xvvSiLWT4zVIAdvpzqdRdkX+OU9/H8I9cv1aY iOQFdEwH3O+XLMdBzjXI9PG1d90OPNVzbp8YcshDmjEuAjcKlhjFHnh3Riik4fFNxRo7 7juQ== 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=FvQw1bANMbkJ24vd4JJrNx9/f+29IYaA6xAdEVTZq6M=; b=h5DxIzBvxUkAZ1d1HQUliRnlOfcBVbcCx3qUUyIj7ACaObPTfwLMUWJQwjbXpy/jrY UoHAXib2qkKF1E81cponZdSrcr/r+1WOS12oChh2A/Qkv++bTM0vvRvt8ACahJzo2T+6 g+xQpDsODqgO336xkxDYh8xbHY6qNc9ETe8WL7ZSh8/ThgzS2aYQmAbhQyQ8t9DigyZm y/gWRO5MQK+clzEPzarbBU4dHF3E8WJYHztVRWenYElatciQ9azPlERsBI5YtfgbjQZI KjVgw09sUSMozt1D05yQXq6WXESgpEFLErscRYqRvStjsEj8gQPM+5B6/0YGl5x69FK0 vHyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Cp7X1vCd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x26-20020a056a00189a00b0052e068f159bsi13228571pfh.145.2022.08.15.13.18.31; Mon, 15 Aug 2022 13:18:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Cp7X1vCd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S1345286AbiHOTwK (ORCPT + 99 others); Mon, 15 Aug 2022 15:52:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345452AbiHOTvM (ORCPT ); Mon, 15 Aug 2022 15:51:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4038073917; Mon, 15 Aug 2022 11:50:06 -0700 (PDT) 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 4D8F3B810A0; Mon, 15 Aug 2022 18:50:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95244C433D6; Mon, 15 Aug 2022 18:50:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589403; bh=0e3KF+qI57KTHNycoInlGErLM+dGABZAMKRt2dMdo/g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cp7X1vCdSnXv5QvN/ALGJkyrGKbblh7Xsn7vYgE0zMlZgQ0l08MGeAkcSejmYLnyl XzBVQ3m44U4uRIdZwtwbLa184syEi8u4I8sJ4AOvjYvtbJeSnem8LGzc3Um37T1Tpo qabqLe2uG1YAlRhOnQdoJSqL2I/iUVD9UzY8ZXMQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lev Kujawski , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.15 708/779] KVM: set_msr_mce: Permit guests to ignore single-bit ECC errors Date: Mon, 15 Aug 2022 20:05:52 +0200 Message-Id: <20220815180407.691309003@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lev Kujawski [ Upstream commit 0471a7bd1bca2a47a5f378f2222c5cf39ce94152 ] Certain guest operating systems (e.g., UNIXWARE) clear bit 0 of MC1_CTL to ignore single-bit ECC data errors. Single-bit ECC data errors are always correctable and thus are safe to ignore because they are informational in nature rather than signaling a loss of data integrity. Prior to this patch, these guests would crash upon writing MC1_CTL, with resultant error messages like the following: error: kvm run failed Operation not permitted EAX=fffffffe EBX=fffffffe ECX=00000404 EDX=ffffffff ESI=ffffffff EDI=00000001 EBP=fffdaba4 ESP=fffdab20 EIP=c01333a5 EFL=00000246 [---Z-P-] CPL=0 II=0 A20=1 SMM=0 HLT=0 ES =0108 00000000 ffffffff 00c09300 DPL=0 DS [-WA] CS =0100 00000000 ffffffff 00c09b00 DPL=0 CS32 [-RA] SS =0108 00000000 ffffffff 00c09300 DPL=0 DS [-WA] DS =0108 00000000 ffffffff 00c09300 DPL=0 DS [-WA] FS =0000 00000000 ffffffff 00c00000 GS =0000 00000000 ffffffff 00c00000 LDT=0118 c1026390 00000047 00008200 DPL=0 LDT TR =0110 ffff5af0 00000067 00008b00 DPL=0 TSS32-busy GDT= ffff5020 000002cf IDT= ffff52f0 000007ff CR0=8001003b CR2=00000000 CR3=0100a000 CR4=00000230 DR0=00000000 DR1=00000000 DR2=00000000 DR3=00000000 DR6=ffff0ff0 DR7=00000400 EFER=0000000000000000 Code=08 89 01 89 51 04 c3 8b 4c 24 08 8b 01 8b 51 04 8b 4c 24 04 <0f> 30 c3 f7 05 a4 6d ff ff 10 00 00 00 74 03 0f 31 c3 33 c0 33 d2 c3 8d 74 26 00 0f 31 c3 Signed-off-by: Lev Kujawski Message-Id: <20220521081511.187388-1-lkujaw@member.fsf.org> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin --- arch/x86/kvm/x86.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 24875dc87b13..dac2892d095c 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -3102,10 +3102,13 @@ static int set_msr_mce(struct kvm_vcpu *vcpu, struct msr_data *msr_info) /* only 0 or all 1s can be written to IA32_MCi_CTL * some Linux kernels though clear bit 10 in bank 4 to * workaround a BIOS/GART TBL issue on AMD K8s, ignore - * this to avoid an uncatched #GP in the guest + * this to avoid an uncatched #GP in the guest. + * + * UNIXWARE clears bit 0 of MC1_CTL to ignore + * correctable, single-bit ECC data errors. */ if ((offset & 0x3) == 0 && - data != 0 && (data | (1 << 10)) != ~(u64)0) + data != 0 && (data | (1 << 10) | 1) != ~(u64)0) return -1; /* MCi_STATUS */ -- 2.35.1