[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87va4ewug9.fsf@vitty.brq.redhat.com>
Date: Fri, 30 Nov 2018 14:44:54 +0100
From: Vitaly Kuznetsov <vkuznets@...hat.com>
To: Roman Kagan <rkagan@...tuozzo.com>
Cc: "kvm\@vger.kernel.org" <kvm@...r.kernel.org>,
Paolo Bonzini <pbonzini@...hat.com>,
Radim Krčmář <rkrcmar@...hat.com>,
"linux-kernel\@vger.kernel.org" <linux-kernel@...r.kernel.org>,
"K. Y. Srinivasan" <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
"x86\@kernel.org" <x86@...nel.org>,
"Michael Kelley \(EOSG\)" <Michael.H.Kelley@...rosoft.com>,
Nadav Amit <nadav.amit@...il.com>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH] x86/hyper-v: define structures from TLFS as packed
Roman Kagan <rkagan@...tuozzo.com> writes:
> On Fri, Nov 30, 2018 at 01:15:11PM +0100, Vitaly Kuznetsov wrote:
>> Without 'packed' compiler is free to add optimization paddings and re-order
>> structure fields for randomization/optimization. And structures from
>> hyperv-tlfs.h are used for hypervisor-guest communication, we need to
>> ultimately forbid such practices.
>
> Note that __packed also reduces the structure alignment to 1, which is
> not necessarily what you want.
>
> E.g. some of these structures are passed by pointer to the hypercall,
> which requires its arguments to be 8byte-aligned.
Hm,
I thought we always take precautions for Hyper-V hypercall arguments, in
particular
PV IPI/TLB flush use pre-allocated hyperv_pcpu_input_arg,
hv_post_message() uses pre-allocated message page, other call sites use
fast hypercalls where we use registers.
I also checked this patch before sending out, WS2016 guest boots without
issues. Any particular places you're worried about?
> I'm also not sure
> that passing unaligned argument to [rw]msr is ok, need to
> double-check.
My understanding is that rdmsr/wrmsr instuctions are registers-only.
We can, of course, just add __aligned(8) to some structures but I'd like
to find the reason first.
--
Vitaly
Powered by blists - more mailing lists