From patchwork Mon Oct 24 11:31:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9513 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp481932wru; Mon, 24 Oct 2022 07:24:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM76TZc+Yxcme4zLyU8v4BlM1QPnRRcbNkuCeAWUR6Mbv6tKX/LaF9pyuHtg0Q8uadBmBiXh X-Received: by 2002:a05:6402:294a:b0:461:b661:d903 with SMTP id ed10-20020a056402294a00b00461b661d903mr6392341edb.407.1666621442856; Mon, 24 Oct 2022 07:24:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621442; cv=none; d=google.com; s=arc-20160816; b=HoceabVEwQ/aREhX4H7ISruFT0GmDl/VbRq1DwTMRwUGtPyn6bBXPS+j8nwGfd5rCA ATBUnn5mWzDm8QmlbJq4pmXfmKCPV9LBFdc7QjAlggCTzhNm1M2R4U/W29JbxAKY78qf KB+QYThnT4Lz26ItLA5N6n9csgwNElPqcBf9iRCbfc4dPJZwZCyKpA4iubzGWpG3Akxq nIiCGYI0JyTjB8NTJq2nv1yiCLt1tT+9lvpm5tucu81zu66WV7uY2FPvC6RIW5x+1HZU 9b4kgJv6BeexV4o5jS/HHsDzspKEyBW3fgI+JN87fPqlwV/LOksnba5COuOu4W9W/Fvg K1Cw== 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=pIW9RJtYE0gAx7/0rNDNMzcHJQ4CpPLFzEJC12OSt1g=; b=dD+SPzryVOGy4NRFmDCUxiGuXPjo4TxYgbtCtp44xFYxFrYZxBJifoUEXfRe+xp7iO d6OzFsroFu0nFSk8jB5TKfYxQVI5ZoaIji/8iE79nxbEQ2ruhfRKg+0JMNl76zS+n6LK SwRwZQZ/4Ie4A87YjgWKiWVg3tDyVMyx84o2npr5HLl/mHcI+bSb2kn8aSKiLROFqanW bkUnVkvI42vpcWWCACrvbCnvY/c/kwcjkKDTWLAue124PIobPGHIfz/tMk9Git0oTQGS /txsHQIqUMvno/uZYS+iq6BkfKAPLkBcTKnvskteQskSVcfTGfxh/2halQxQanGmaNaq 7RxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YWqtFfOi; 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 ka3-20020a170907990300b0078db376206esi21761355ejc.783.2022.10.24.07.23.38; Mon, 24 Oct 2022 07:24:02 -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=YWqtFfOi; 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 S235883AbiJXOWX (ORCPT + 99 others); Mon, 24 Oct 2022 10:22:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235284AbiJXOS6 (ORCPT ); Mon, 24 Oct 2022 10:18:58 -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 4CA529591; Mon, 24 Oct 2022 05:56:37 -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 9A354612BE; Mon, 24 Oct 2022 12:12:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF9D2C433D6; Mon, 24 Oct 2022 12:12:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613537; bh=jiBE9ldZ95s6Eq+IwVdkpKMHD+c7DRPI0PUQXSs9z2A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YWqtFfOiHxgC6MXJunjMBSFbJRYE+ZD4aRy6wetm4/VahkNYepenAZk52u/dFLAT1 reUY/On5lKN60qPFk5K2jAXqV9V4yKJko0DbiNNgK4OUTCdx1rBGtu9VULTJWdMKLG NVHrZfU1O/Z4QycJABrG6OYhhq/x3BpAdgHfDUpo= 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.4 174/255] x86/hyperv: Fix struct hv_enlightened_vmcs definition Date: Mon, 24 Oct 2022 13:31:24 +0200 Message-Id: <20221024113008.599077327@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@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?1747579245881530399?= X-GMAIL-MSGID: =?utf-8?q?1747579245881530399?= 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 7741e211f7f5..333e61e6dbe7 100644 --- a/arch/x86/include/asm/hyperv-tlfs.h +++ b/arch/x86/include/asm/hyperv-tlfs.h @@ -721,7 +721,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; @@ -729,7 +729,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];