From patchwork Sat Oct 22 07:26:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7741 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1110659wrr; Sat, 22 Oct 2022 01:53:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM72O+fAM3FCJU0IpBCrsGOj5ioL5wCNwCVpMPof2Qt4t7+CVJBhvJyIBYcVyfj5lw6eOyaH X-Received: by 2002:a05:6402:168c:b0:458:5b8b:afd2 with SMTP id a12-20020a056402168c00b004585b8bafd2mr21081878edv.357.1666428818759; Sat, 22 Oct 2022 01:53:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428818; cv=none; d=google.com; s=arc-20160816; b=aIknRP4N4bd+1xxbDgAGCSBChzqVGbzt1wexFHagGGdxGueGEDjo/Q3oWty8eTn76l wzaefl4gp4M7R5oaRPZAB8ioaDfBcVeBY+qrQ6lY5mmLhYapyQEe9e+63wIX6JQFgcEj l4a+JihED1LXfJa+g9HOwOdYDfK6mnF34JzfL+l+KuGi0xmxXv0IKiAjRBMyoAZHkkkZ noK4Fjfh/GVc0pWYwBC6e7F/kCNe2xaNg1/7gcerVGnoHCZ1zGkSMtaDal2xjpfLwsA8 nBUailpqVZ5yxvrA0QogLlLj4NFNp4y+T+WYB8zBPiYSjoWbcHvTNRVkbxw7hQMTynWt GRfw== 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=AObmOoEsEG8ooV1SksqtnktlMtVdDdYi/Ge89mSC/1GU9OVHwMSbM1qOADeCBMNizO OCQL6xxvrP8E7Sq0F+QAE6PMJceJvK+n+fah5zHlayeB22lQQ2+jeNznrYJ7VtPm6gyH YCXmsO8/Ot2K7v7K/D+l5w+E0ntg4BBjthAruSR+FeIzsNK7FK1DngWJGYHY8UfveEOt AYk8QVRFBeMSNrlxGIHBEPFhW2CHtMx9FkSLIJcjqe+Adr+thewCZQn/Qd0zisJkZPvY 5QxtP7YSBDZq9JCNbNnyZPSV4PYA64bwfFN/asPPDfk5vnLheCYU1wgfWNNyzdsFJvhw R0+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1v3Ygibu; 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 d13-20020a056402400d00b0044ea553d7cdsi7293210eda.105.2022.10.22.01.53.15; Sat, 22 Oct 2022 01:53:38 -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=1v3Ygibu; 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 S231903AbiJVIwX (ORCPT + 99 others); Sat, 22 Oct 2022 04:52:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234313AbiJVIvb (ORCPT ); Sat, 22 Oct 2022 04:51:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 775722F0DCC; Sat, 22 Oct 2022 01:11:48 -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 ams.source.kernel.org (Postfix) with ESMTPS id 8290EB82E12; Sat, 22 Oct 2022 07:57:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9AD2C433D7; Sat, 22 Oct 2022 07:57:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425432; bh=P6mrvCB9xhdjNaQd5esO9PzJUs/Txx/H4cT1nbvnes4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1v3YgibuygT9wGSAlSIbMJNZzrOFAXudvdbP0PzHWCG/DJrdHKs8iqqGSH5c6u2Ds Mh6dM/CacbTlSjzWqB4rMjmwxlXKdeUU6zsVguoZ6hgb8SuiIGbBFJbQAZiE16aVqX xMXfSVXjPHhxdXCAGPKvFcUoYyKX3rWa2uGGVdbw= 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.19 500/717] x86/hyperv: Fix struct hv_enlightened_vmcs definition Date: Sat, 22 Oct 2022 09:26:19 +0200 Message-Id: <20221022072520.372130740@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377264954485000?= X-GMAIL-MSGID: =?utf-8?q?1747377264954485000?= 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];