From patchwork Mon Oct 24 11:31:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9550 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp511953wru; Mon, 24 Oct 2022 08:26:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7S3sz7kD8vOAQbk2k8QedAcEvXZLWXDMYCLzB5z15EfXCCAXnbhDGiJ5mHv1XCobxmDXxz X-Received: by 2002:a17:907:74a:b0:77e:9455:b4e3 with SMTP id xc10-20020a170907074a00b0077e9455b4e3mr28610551ejb.471.1666625215241; Mon, 24 Oct 2022 08:26:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666625215; cv=none; d=google.com; s=arc-20160816; b=nBNO7OrJEyuxPqysdHTYdrlLL40GzERSlRUFhOmMUAhXQKymWbthP8edYaX9qVIRd9 Z8rzQ5l5qLjriDG9y3I6fNCWsOdPsVAnguR4k69MsS7TFdhyir4xmd/33gkbbYsKkkdD gq49hyXdOLdFWGAlI7QnZzyHl7uN1JytgNvMlLWcO5s9dpW2u74XT4s63Lx7FOQDejDJ zTqk9t/2wclI0AuQk88xTqbGW2jxKP5aZD0zUAfnkdbS6281HsABHDsDmeXUmnoDm977 Uo0NJ5h5h8uyEgWof8Sb3DAfDYN1atN8OstCJ1+9AL7+9NLwJQTkFgkT11rg3TiFUjoy QO0A== 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=Vh2d0fLFK5z2MPK/kZPI5zMIHWsEU2tgbjvqn1AoJXA=; b=cDw7cghpCQ5HiywGSHNv3SBpIo7LKPg6MAY3hje0yAR6jYkvR8C2NZOGg+mqbct9wn zTtQANu8E7mxUsx5N5DQutelyoJfqE82kcmhwQqUNmk+hjKd+7n5lckbA8aHKNlYGOcP PusDxbMm17jVa5njtLtDdpkoxp8UzYrgAQVug6xlEG5f6kZbjHov/KrpHQjcjX81qZfm zEc6kPMxUivT2geT4ZLwbIavuu7ayA+aXUWfZDFDHfeDXTMISOC5IAayhHORf66mkfPq BqLA3si4+G4qsTJUQao922amyD+nv+2PFNOj2aC0uPfVtCvFjHRu5WlLOxGrwjF1m9Pl fsdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="gFl6nXr/"; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs12-20020a1709072d0c00b00781cde43588si90146ejc.58.2022.10.24.08.26.31; Mon, 24 Oct 2022 08:26:55 -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="gFl6nXr/"; 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 S232964AbiJXO6Q (ORCPT + 99 others); Mon, 24 Oct 2022 10:58:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233920AbiJXO5y (ORCPT ); Mon, 24 Oct 2022 10:57:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 850455143A; Mon, 24 Oct 2022 06:35:11 -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 dfw.source.kernel.org (Postfix) with ESMTPS id D80E7612A0; Mon, 24 Oct 2022 12:27:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EADE9C433C1; Mon, 24 Oct 2022 12:27:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614455; bh=6S8wkVtGZt0abelM+HE995JPE3aIj7ImAwxa7yJSGBE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gFl6nXr/Mk7NW7ND0cOyVqqN2sGDZjHK4Uv83Z+Ig6WQQau0wGD8GIIxO4JT55kPs yOblhYfGS1ZR2nq+3qJj0zfuQbg+WeP3Vahja4IB3LoECeXZbRxHwi0MiIJ03ICz91 UKi6UJwnIKd6goxaOqLK+AtoDKBOo+7LtT5KXG30= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Levitsky , Michael Kelley , Vitaly Kuznetsov , Sean Christopherson , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.10 268/390] x86/hyperv: Fix struct hv_enlightened_vmcs definition Date: Mon, 24 Oct 2022 13:31:05 +0200 Message-Id: <20221024113034.330762947@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747583201687152805?= X-GMAIL-MSGID: =?utf-8?q?1747583201687152805?= From: Vitaly Kuznetsov [ Upstream commit ea9da788a61e47e7ab9cbad397453e51cd82ac0d ] Section 1.9 of TLFS v6.0b says: "All structures are padded in such a way that fields are aligned naturally (that is, an 8-byte field is aligned to an offset of 8 bytes and so on)". 'struct enlightened_vmcs' has a glitch: ... struct { u32 nested_flush_hypercall:1; /* 836: 0 4 */ u32 msr_bitmap:1; /* 836: 1 4 */ u32 reserved:30; /* 836: 2 4 */ } hv_enlightenments_control; /* 836 4 */ u32 hv_vp_id; /* 840 4 */ u64 hv_vm_id; /* 844 8 */ u64 partition_assist_page; /* 852 8 */ ... And the observed values in 'partition_assist_page' make no sense at all. Fix the layout by padding the structure properly. Fixes: 68d1eb72ee99 ("x86/hyper-v: define struct hv_enlightened_vmcs and clean field bits") Reviewed-by: Maxim Levitsky Reviewed-by: Michael Kelley Signed-off-by: Vitaly Kuznetsov Signed-off-by: Sean Christopherson Link: https://lore.kernel.org/r/20220830133737.1539624-2-vkuznets@redhat.com Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin --- arch/x86/include/asm/hyperv-tlfs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h index 0ed20e8bba9e..ae7192b75136 100644 --- a/arch/x86/include/asm/hyperv-tlfs.h +++ b/arch/x86/include/asm/hyperv-tlfs.h @@ -474,7 +474,7 @@ struct hv_enlightened_vmcs { u64 guest_rip; u32 hv_clean_fields; - u32 hv_padding_32; + u32 padding32_1; u32 hv_synthetic_controls; struct { u32 nested_flush_hypercall:1; @@ -482,7 +482,7 @@ struct hv_enlightened_vmcs { u32 reserved:30; } __packed hv_enlightenments_control; u32 hv_vp_id; - + u32 padding32_2; u64 hv_vm_id; u64 partition_assist_page; u64 padding64_4[4];