[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v5 01/13] x86: reduce general stack alignment to 8



>>> On 29.11.18 at 18:44, <wei.liu2@xxxxxxxxxx> wrote:
> On Thu, Nov 08, 2018 at 09:05:45AM -0700, Jan Beulich wrote:
>> --- a/xen/arch/x86/efi/Makefile
>> +++ b/xen/arch/x86/efi/Makefile
>> @@ -5,7 +5,11 @@ CFLAGS += -fshort-wchar
>>  
>>  boot.init.o: buildid.o
>>  
>> +EFIOBJ := boot.init.o compat.o runtime.o
>> +
>> +$(EFIOBJ): CFLAGS-stack-boundary := -mpreferred-stack-boundary=4
> 
> From gcc's manual on -mincoming-stack-boundary:
> 
> "Thus calling a function compiled with a higher preferred stack boundary
> from a function compiled with a lower preferred stack boundary most
> likely misaligns the stack." 
> 
> I notice runtime.o now has stack alignment of 2^4 while the rest of xen
> has 2^3.
> 
> There is at least one example (efi_get_time) that could misalign the
> stack. Is that okay?

It would not be okay if the runtime call machinery wouldn't force
32-byte alignment of the stack. See the declaration of struct
efi_rs_state, an instance of which gets put on the stack of every
function making runtime calls. Also note how this is no different
from prior to this change, as explained by the comment in that
structure declaration, except that instead of always running on
a reliably mis-aligned stack we will now run on a mixture (hence
the code [and stack] size savings mentioned in the description).

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.