From patchwork Mon Oct 24 11:31:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8883 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433450wru; Mon, 24 Oct 2022 05:49:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6jTzj5wBMNw1y8XFw8/jOddhqXSC77Qzk4rqcW5cgWlYSeOBNJjmzOCeDIvgBWZa9lWTtp X-Received: by 2002:a17:907:724d:b0:78d:acf4:4c57 with SMTP id ds13-20020a170907724d00b0078dacf44c57mr27469770ejc.516.1666615773022; Mon, 24 Oct 2022 05:49:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615773; cv=none; d=google.com; s=arc-20160816; b=jtK2pEA+mBxNTZ8w1KIrXVnaVZcUkJtijr8hzS/oyI5h4UB6SaP72S2FbZhXExwgZC sjLLCWKJH+SxCL32wMSOGBf+kufeqHcZv48IGC+ADATMZKo5ZKbrAIdS+GVwhbRtI79n v7gyVilp62tuaXLoGlZXPXXmbgBXE3kJQQ8Az3+FgTf6T8qVQ92i1s/ebLtcCjgUbTS9 ZGRLE5cjhn5+xJjM3/4sD+NNXcsyY0qEIp4v94mqcIsgLZdICH+eOwCXMpvXaPsIhmo3 Rn1I95xls/aR6sdAazs/ys3YhzxyYGnzV/q8x43ehAiWioU/nd9xAJ+6RK8QjpMxuq3I /qQw== 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=8rRmmPRy5vnqeKjgu2GVAIu0qw/osPYHd20kUWrPW04=; b=pw2FWwbNz4saoouaaJbQGaMekLkwpcYk21Ip8Ii0UKXrXNWQvC+yFbbAr3ezf7Vgwr jV/R+V9LH31pCNMncgpCbH9cWTyvj6QTuFMNY15hNaEVFuFj72Ia17CyAND14rE30qdx WicwHW2m4RaBaYOB2qMT+Jg8JirRlI8IMD5C6DPcrEj+RZvSiSqUt2WJVHIZ5eEXH9Jn nlsCZDoCWvMkyjNvez18E18oruO5+1jskO8XFD2TNodCHRf7V7GLxZx1WZ7wX4fQ1nxL zEUZTMrIIo2lP/cd/k0dxTaQelkZhUHxQPDgp10cunzvQv5+3EmxzqykdRnT4bqykSyw Xlgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vtL4AwDL; 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 ec33-20020a0564020d6100b004615a57e292si7636946edb.426.2022.10.24.05.49.08; Mon, 24 Oct 2022 05:49:33 -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=vtL4AwDL; 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 S233897AbiJXMhn (ORCPT + 99 others); Mon, 24 Oct 2022 08:37:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233885AbiJXMbc (ORCPT ); Mon, 24 Oct 2022 08:31:32 -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 6D5071B7B9; Mon, 24 Oct 2022 05:04:41 -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 ED2F8B811BD; Mon, 24 Oct 2022 12:01:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 472C3C433D6; Mon, 24 Oct 2022 12:01:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612901; bh=U9hmnfSWoenhvdy2bUmTLhdEgICpln2VqpEzU8ILty0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vtL4AwDLcrrSCDC8i2a+6MAdWPBoqAFuGWzC0l795KKzV0E7W6pYfacwq0xJwlm4j cnWyA3kpkkhq98w4fWqLBxJ4pYyw/pwjFH3PFVhrXUrFcb9oCsP3EcaVZJkpr2eYos Cnx2atOoWelDJq01/qhtIgQWJtUahWOTktCv0zDo= 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 4.19 163/229] x86/hyperv: Fix struct hv_enlightened_vmcs definition Date: Mon, 24 Oct 2022 13:31:22 +0200 Message-Id: <20221024113004.332368675@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@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?1747573300565158693?= X-GMAIL-MSGID: =?utf-8?q?1747573300565158693?= 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 00e01d215f74..e1bd23641fc6 100644 --- a/arch/x86/include/asm/hyperv-tlfs.h +++ b/arch/x86/include/asm/hyperv-tlfs.h @@ -682,7 +682,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; @@ -690,7 +690,7 @@ struct hv_enlightened_vmcs { u32 reserved:30; } hv_enlightenments_control; u32 hv_vp_id; - + u32 padding32_2; u64 hv_vm_id; u64 partition_assist_page; u64 padding64_4[4];