From: Nadav Amit <nadav.amit@gmail.com>
To: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: "kvm list" <kvm@vger.kernel.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
LKML <linux-kernel@vger.kernel.org>,
"Roman Kagan" <rkagan@virtuozzo.com>,
"K. Y. Srinivasan" <kys@microsoft.com>,
"Haiyang Zhang" <haiyangz@microsoft.com>,
"Stephen Hemminger" <sthemmin@microsoft.com>,
x86@kernel.org,
"Michael Kelley (EOSG)" <Michael.H.Kelley@microsoft.com>,
"Thomas Gleixner" <tglx@linutronix.de>
Subject: Re: [PATCH v2] x86/hyper-v: Mark TLFS structures packed
Date: Fri, 30 Nov 2018 22:21:35 -0800 [thread overview]
Message-ID: <DC5975C2-6517-4D20-9DC9-574C5439C426@gmail.com> (raw)
In-Reply-To: <20181130125422.21494-1-vkuznets@redhat.com>
> On Nov 30, 2018, at 4:54 AM, Vitaly Kuznetsov <vkuznets@redhat.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@gmail.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.
next prev parent reply other threads:[~2018-12-01 6:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-30 12:54 Vitaly Kuznetsov
2018-12-01 6:21 ` Nadav Amit [this message]
2018-12-02 23:35 ` Vitaly Kuznetsov
2018-12-03 7:15 ` Roman Kagan
2018-12-03 1:41 ` Michael Kelley
2018-12-03 13:45 ` Vitaly Kuznetsov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DC5975C2-6517-4D20-9DC9-574C5439C426@gmail.com \
--to=nadav.amit@gmail.com \
--cc=Michael.H.Kelley@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=kvm@vger.kernel.org \
--cc=kys@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkagan@virtuozzo.com \
--cc=rkrcmar@redhat.com \
--cc=sthemmin@microsoft.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®