Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp703967iog; Wed, 29 Jun 2022 08:33:42 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ufaHdYqSmbEi06PgrM7CUZA4Bq3SIKfP11TslasDA4JrBUsZ//0cgQfDQef6MXMan4qPVg X-Received: by 2002:a17:90a:8d02:b0:1ec:a006:ea13 with SMTP id c2-20020a17090a8d0200b001eca006ea13mr6176384pjo.229.1656516822483; Wed, 29 Jun 2022 08:33:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656516822; cv=none; d=google.com; s=arc-20160816; b=KXnTbow1te9nY9uEV4aNJu0R4V8p9cNGIA/uT4BRgQvtG5U+rPd/53mDSV1ONf8EOv 5UAxvKzZ4m8N3UBl+dkmVVkm6GDyR/S5YD7syGNpcCOM6cHmR52ffTlmMaTSlq9kXTVH F/eswLyP9b7Qtq0RlCf8U8N0fDg5ENhJDuK60DtF8IcQB4TZw7pMMJF+LHNWlXZpQkaG 1gnbZD43QZgzWGwVyRQ6Jyreysphnu9r+2xdsoU7u01GQ6zKQIlpG9mPBmcNGCW2RIpy BV3GI/DcV3vAIzd1egGNUMFGGa9FrbWXGy4Otii4A01sdwWANMx0su68X8Iem35WMex2 tf3A== 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=eJrsDtC3QgstFN3+L5xWVypuug+Ohin/2K3IGk054RCiIdprZjBr+RDz8BKx30ax4J rmsbd0z4I6b8nQuSGYM14XBGGhzHP4K63y89v4Jm/HgBG6U0k3a1xolCiaxWaiIOHoT3 rfSqpDy+G4BKm+yPcMeO0piXpo+ufltZeBR8JNSRNuhvPNfNggFu4NF8J3svubgfOSsf Hnn1QpWtvmTIa0J6OGJXmWjgYh2t2SmQr2FOotC1TmDtwRsTTZAcHtQrDIu0P+jaghqe Z8QAuYtvvaDhO1Ylc8En3Y1NUW45kezL1FPjlog7t515AB+F0P85+HgU5LsueYIp5imZ JoYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fvsffqnG; 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 y2-20020a170902cac200b0016a29155e0dsi18807422pld.205.2022.06.29.08.33.28; Wed, 29 Jun 2022 08:33:42 -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=fvsffqnG; 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 S233669AbiF2PGk (ORCPT + 99 others); Wed, 29 Jun 2022 11:06:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233060AbiF2PGh (ORCPT ); Wed, 29 Jun 2022 11:06:37 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 323D313CD3 for ; Wed, 29 Jun 2022 08:06:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656515196; 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=fvsffqnGyFFY/KvTBwd7UHrQVqIb1cKfk9nluM0Qd16UJ7QZ3cy37MmlGxry4urDFK+nct pIVPdVYyMAGbjHXPKJMWM7VlKl37ElQwPEqSix9+JO6mi4TncVQkGjGIUfwgMJV8zSSoQJ ckDksRpT7jbQaGYjgXL7AogqBV+OTPg= 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-453-KCz-GTS8O36Di8AOCVlnDA-1; Wed, 29 Jun 2022 11:06:33 -0400 X-MC-Unique: KCz-GTS8O36Di8AOCVlnDA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8D8173806648; Wed, 29 Jun 2022 15:06:32 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.40.192.126]) by smtp.corp.redhat.com (Postfix) with ESMTP id 91BE340EC002; Wed, 29 Jun 2022 15:06:30 +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 v2 02/28] x86/hyperv: Fix 'struct hv_enlightened_vmcs' definition Date: Wed, 29 Jun 2022 17:05:59 +0200 Message-Id: <20220629150625.238286-3-vkuznets@redhat.com> In-Reply-To: <20220629150625.238286-1-vkuznets@redhat.com> References: <20220629150625.238286-1-vkuznets@redhat.com> MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,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 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