Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3079689rwb; Mon, 15 Aug 2022 17:37:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR7F5bord5nkkqQRetNHHWZVxuPoXgWyrL63uwXEM1rOvmkcxlukc7F+8fmGAJmv/l1E/Vln X-Received: by 2002:a17:907:1c9d:b0:732:f9da:aa51 with SMTP id nb29-20020a1709071c9d00b00732f9daaa51mr12253192ejc.654.1660610246703; Mon, 15 Aug 2022 17:37:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660610246; cv=none; d=google.com; s=arc-20160816; b=XKs2jMbCTrWJbj4K361X1GGfkzSfUqT72PHpP0fgsE3xY86tC+JsbeflsscZNIT+5N DxmnM0kaeRPkWV5DK/ryqKVHgHTNynpz2OXzNDKcFAcpmt8Cv4yFp9F/qyGuphWuiBAn SrZ76bv8rF98tQVaBhmq44kNM/q1kaUiHKX+GptnVq1rOhIQClR7WCbvVpmNRl3hvm+G JUnXP8coOL6nMLC4D6IiSB+xE3oWMsDHe9/I3aQnhRr5nqD8KctDMC5co1AUlOmQ85OB r8XC9ff3uwkCpRkyTbuA76o1XXc37kTW3J71ToozKD/8JDMqw4mdHFv8aY6b2MB3GQmC 1RwQ== 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=QDlRWGUAIdH6YE0lROMBViLeswWPJqN41k266UGpGfQ=; b=jiOnvCNb9nMgLQ165aNUCQTkg8vanqGhhY8C7vIRZKhF8Au6r8qD5Xxzq+zIr8R1MW gJkMCguUKDmXplef420u2RFhsTB91nRkTekH9XfJZBX9cSU5ybGeocrKO/d12VLjPMjE 2y5SIXbu0oC5UVcxXPIGnzjawZu2pkz4ou1o5M7f+p8bitsTaWU1mJd9kSwGp6/sSbUr Er2Svk1NcwZhVBuycZMLoOB4R51ns+odQVndBug2fQ1KgIJkLCfFGEU8wA6LUvSMC3ig 2BFDpdM6hGD7eeyZM8i4fpwuPrG+Ii8fh/YN8vK1AvVph82KHrfpZW5yEo9YepDHJCyF BSvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uj+pWQZk; 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 qa42-20020a17090786aa00b00734be0ce0e5si9275744ejc.311.2022.08.15.17.37.01; Mon, 15 Aug 2022 17:37:26 -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=uj+pWQZk; 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 S1347883AbiHOXVp (ORCPT + 99 others); Mon, 15 Aug 2022 19:21:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343725AbiHOXO2 (ORCPT ); Mon, 15 Aug 2022 19:14:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8591895FD; Mon, 15 Aug 2022 13:01:46 -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 9BA47B80EAD; Mon, 15 Aug 2022 20:01:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1393C433D7; Mon, 15 Aug 2022 20:01:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593704; bh=8JZ/Ppu8+/LJWNS3QNboIv0bypIL+9qabo0OOgziros=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uj+pWQZkhcqtVSxZiltBW9ExxMXH/3CRmisrtcfQs+k4FDhM54WVfHEO0MLeVeIWb bOBm3D3ML7cZWe1UKXA3x7ggwOGcESuh1GxKAow3sG57sYlSoaoj57RCy+7TpthHB2 ZohQJzBXJpVeqcOSgFDDN8O7XthXSfvZl3ylM/Ko= 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.18 0993/1095] KVM: set_msr_mce: Permit guests to ignore single-bit ECC errors Date: Mon, 15 Aug 2022 20:06:32 +0200 Message-Id: <20220815180510.188201325@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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 767a61e29f51..2316c978b598 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -3226,10 +3226,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