Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp360866imw; Thu, 14 Jul 2022 02:45:30 -0700 (PDT) X-Google-Smtp-Source: AGRyM1voryfus4F+Bqln5AAqvkkJVIxflYyoO1QP9AYaGQzQWRoG/+s0v5kxfhe7sMLBR6UcU/7j X-Received: by 2002:a17:902:7b88:b0:16b:d9a5:7a94 with SMTP id w8-20020a1709027b8800b0016bd9a57a94mr7592639pll.173.1657791930214; Thu, 14 Jul 2022 02:45:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657791930; cv=none; d=google.com; s=arc-20160816; b=AELLPr/gO+rtEoUldMH33cf19iJ0pscKdCYehIPEitoCkSc249qWFR/IK0FD1NgCq+ b1k7dWlD+w0VW6E1ZcOZPa1GRtQYeqSDJm2lnZxHfo+XHpVto+kkhHY1xF1NQJFrKVeV TEyzqESkL6ll2p3HUwGA9gQNnFrKqE5uRgeHcO5C+kkieazzUnSoDxVcAVOc+9lLtq5i UiNpLkh5Q0KBKwfx1C10M4ltxfl171bWGKA7sv/N5fVEhebnWP7reVUDy4yta52KUD0f 4ffRpnEw0i4kCX6ZVlvsMKDS3IICb/7CPv1hwuzh9r+7PVwOZxnKoaXl+OCMjrCVl7Nz sO7w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+8vUSQrDAvTlo9lTqBRicNMYXJXENHDUMVIYZB5FKsI=; b=aXpmxkqDJMKdKkWZoyQaZ1G60CbQ6tAIYey/Q3vaj7cidTwfli586a16m5NrjJNDl2 400Snj9eGCEOlK2MGi3yD0WbLTuBSLuo/87J0+rGpeoO7dpyc7CF5eKmBgxtkjrMN946 W/PZFCFmKgp3erA46Lv0Jqi42ZMTSMBLCpv9MWjuwc9cR8v2ozzfcodnHlTutzIdvWyd WMxqPSZGjChhbdg6V1LInQ9AaiIWHOSycLE8aQ75QgDPcKdeR+5pwFheyjFq+LEEhNd4 ss6piojl5djfGuo7kY3BBs0ZtF1g5kZHnSVquqcjIwbCHaF//+v3m95V3YxYrKf/INad 68mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HjG1oSPd; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v9-20020a17090a898900b001f0463eeea2si5126103pjn.144.2022.07.14.02.45.17; Thu, 14 Jul 2022 02:45:30 -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=@redhat.com header.s=mimecast20190719 header.b=HjG1oSPd; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237809AbiGNJNx (ORCPT + 99 others); Thu, 14 Jul 2022 05:13:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237755AbiGNJNp (ORCPT ); Thu, 14 Jul 2022 05:13:45 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5EE0D6580 for ; Thu, 14 Jul 2022 02:13:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657790019; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+8vUSQrDAvTlo9lTqBRicNMYXJXENHDUMVIYZB5FKsI=; b=HjG1oSPd45xx73TyWr3bPv59XhT8gIU19GTasJMnRAz3DG9yYsTZaeOaoDeD4jPlg/eRm4 zVAvE22qPqSXUTqyP1wU1NiHf9+s9wcsrjGLzYOJjOKBo0jFrSg1dEE+BIu0kT030hJ/Mx FXBm/hKSGIXFTHxkMdNDqjzH24vo3KU= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-274-VZ07V3djOd2B9fUTgrdGsg-1; Thu, 14 Jul 2022 05:13:35 -0400 X-MC-Unique: VZ07V3djOd2B9fUTgrdGsg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6E02929AA3B7; Thu, 14 Jul 2022 09:13:35 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.40.194.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5A6872166B26; Thu, 14 Jul 2022 09:13:33 +0000 (UTC) From: Vitaly Kuznetsov To: kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson Cc: Anirudh Rayabharam , Wanpeng Li , Jim Mattson , Maxim Levitsky , linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 02/25] x86/hyperv: Fix 'struct hv_enlightened_vmcs' definition Date: Thu, 14 Jul 2022 11:13:04 +0200 Message-Id: <20220714091327.1085353-3-vkuznets@redhat.com> In-Reply-To: <20220714091327.1085353-1-vkuznets@redhat.com> References: <20220714091327.1085353-1-vkuznets@redhat.com> MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 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 --- 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]; -- 2.35.3