From patchwork Wed Oct 19 08:31:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4894 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225523wrs; Wed, 19 Oct 2022 02:43:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM75fC447bAPZSBthGrDWmrkqZubCb4Ovq8XkpOOmkNik2/nWFvbz0c3/3bCfSmKhOSSTbNe X-Received: by 2002:a05:6402:191:b0:45c:83e8:d74a with SMTP id r17-20020a056402019100b0045c83e8d74amr6306063edv.329.1666172601021; Wed, 19 Oct 2022 02:43:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172601; cv=none; d=google.com; s=arc-20160816; b=bm876WCNUV/dd6YrGGBAGvJhknZbdwgTd76u6vrnpDpWSujic+5EPJaHfuF9DVS+gN QKwjQx5hQApLvxitLS6/Y32HKDIqYENHN/LHLPZjij9wWXsypMs89xmBCQgla+S5Krts tn8MeJvqbroQCzjrOLv/YMg9vZ4r7UmEuIqHIxQEEQxOrqHDUFNN7SlnK1+3dFWboFco EUXyENGvvGg96FoJZCHHuuXclNlOuZbBbf4S77OpdHdKufZIlw+18amemOY8EWuU5p8x XKSlrJMvOv4WU3ny2o4I5izWXiB0uNRdUZTHrnYmgDqcf0+n02mryr2g44/fwkKgQ5s+ 85Ww== 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=joEPKpTa+uxNk9vVTRrWEAoMQ3DGHGrnvbhFNDD5Bro=; b=o5SK+de9M5ekxCExf10EvcOp6MwNmGDCniEdUpYQaHNACQvoBi50gj2Ch7Yr7kGcyb dVHQ7T29KEd1scKi9x+8gC7z2/4twdn/kHlxn4sHpJnBV2xA5pATJl0zvClI5WIYCHX2 l/618WgG3Ok3fH3hQXgRNHQdgPvegMVP6zXu00ZnuTO/hH7aR9TNsmkrp134nLIHPS7Q 7UPi2z6BRpdCR3G7zIv80kCEMMUKy3Ear0u9Sv79vuyk3uqtphE47H0OblEPLTLkAr8P N7V0HdDkDXf1dxbBr81T85ay09VJvK8x8Oy3qXT5F6E9HxTvqRwzBPmKKEFXwLZBmtkJ AVMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wMrd4LaI; 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 t5-20020a056402524500b00459fb0c1d9esi12973985edd.549.2022.10.19.02.42.55; Wed, 19 Oct 2022 02:43:21 -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=wMrd4LaI; 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 S233964AbiJSJeO (ORCPT + 99 others); Wed, 19 Oct 2022 05:34:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233774AbiJSJ3Y (ORCPT ); Wed, 19 Oct 2022 05:29:24 -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 D0299C3564; Wed, 19 Oct 2022 02:13:00 -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 537A3617EC; Wed, 19 Oct 2022 09:05:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67734C433D6; Wed, 19 Oct 2022 09:05:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170332; bh=P6mrvCB9xhdjNaQd5esO9PzJUs/Txx/H4cT1nbvnes4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wMrd4LaIv0Xy4LTwPLTDFIXoxWa01ARrGNMUxvk5z26RUSHiuewy4rtkAxI5eTO5G oTqvjCOCORaYqrZ9GpZSqzf1hSmnRamoTjvaHOa4SsgtwjhIF5EdZdtzZySYAoZa3+ EOcn2JEf+0KD6/wFxPp5KVLuS5HJ2doJ3PIMfrY4= 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 6.0 616/862] x86/hyperv: Fix struct hv_enlightened_vmcs definition Date: Wed, 19 Oct 2022 10:31:43 +0200 Message-Id: <20221019083317.154179867@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747108601279519190?= X-GMAIL-MSGID: =?utf-8?q?1747108601279519190?= 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 0a9407dc0859..6f0acc45e67a 100644 --- a/arch/x86/include/asm/hyperv-tlfs.h +++ b/arch/x86/include/asm/hyperv-tlfs.h @@ -546,7 +546,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; @@ -554,7 +554,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];