[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DC5975C2-6517-4D20-9DC9-574C5439C426@gmail.com>
Date: Fri, 30 Nov 2018 22:21:35 -0800
From: Nadav Amit <nadav.amit@...il.com>
To: Vitaly Kuznetsov <vkuznets@...hat.com>
Cc: kvm list <kvm@...r.kernel.org>,
Paolo Bonzini <pbonzini@...hat.com>,
Radim Krčmář <rkrcmar@...hat.com>,
LKML <linux-kernel@...r.kernel.org>,
Roman Kagan <rkagan@...tuozzo.com>,
"K. Y. Srinivasan" <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>, x86@...nel.org,
"Michael Kelley (EOSG)" <Michael.H.Kelley@...rosoft.com>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH v2] x86/hyper-v: Mark TLFS structures packed
> On Nov 30, 2018, at 4:54 AM, Vitaly Kuznetsov <vkuznets@...hat.com> wrote:
>
> The TLFS structures are used for hypervisor-guest communication and must
> exactly meet the specification.
>
> Compilers can add alignment padding to structures or reorder struct members
> for randomization and optimization, which would break the hypervisor ABI.
>
> Mark the structures as packed to prevent this.
Seems good to me (I made sure you remembered to set __packed for the nested
structs ;-) )
If needed:
Acked-by: Nadav Amit <nadav.amit@...il.com>
Having said that, something else is sort of strange in the TLFS definitions,
I think (I really know little about this whole protocol). Look at the
following definitions from hyperv-tlfs.h:
> struct hv_vpset {
> u64 format;
> u64 valid_bank_mask;
> u64 bank_contents[];
> };
>
> struct hv_tlb_flush_ex {
> u64 address_space;
> u64 flags;
> struct hv_vpset hv_vp_set;
> u64 gva_list[];
> };
It seems you have two flexible array members at the end of hv_tlb_flush_ex.
This causes bank_contents[x] and gva_list[x] to overlap. So unless they have
the same meaning, this asks for trouble IMHO.
Powered by blists - more mailing lists