[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] x86: re-add stack alignment check
On 14/11/16 13:25, Jan Beulich wrote: > Commit 279840d5ea ("x86/boot: install trap handlers much earlier on > boot"), perhaps not really intentionally, removed this check. Add it No - that was deliberate. The check isn't useful (see below). > back, > - preventing it to trigger before any output is set up, "preventing it from triggering ..." > - accompanying it with a (weaker, due to its open coding of what > get_stack_bottom() does) build time check. > > Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> > --- > While not strictly needed for 4.8, I thought I'd still submit it as a > possible candidate. > > --- a/xen/arch/x86/cpu/common.c > +++ b/xen/arch/x86/cpu/common.c > @@ -643,6 +643,11 @@ void load_system_tables(void) > .limit = (IDT_ENTRIES * sizeof(idt_entry_t)) - 1, > }; > > + /* Bottom-of-stack must be 16-byte aligned! */ > + BUILD_BUG_ON((sizeof(struct cpu_info) - > + offsetof(struct cpu_info, guest_cpu_user_regs.es)) & 0xf); > + BUG_ON(system_state != SYS_STATE_early_boot && (stack_bottom & 0xf)); This will still triple fault the system if it triggers on an AP. Exceptions aren't hooked up yet. The reason I dropped the check was that there was no way it was going to fail on the BSP (because of the alignment of cpu0_stack) or APs (because of the alloc_xenheap_pages(STACK_ORDER, memflags) allocation). The BUILD_BUG_ON() is useful to retain, but I would suggest making get_stack_bottom() a static inline and putting the BUILD_BUG_ON() there. ~Andrew > + > /* Main stack for interrupts/exceptions. */ > tss->rsp0 = stack_bottom; > tss->bitmap = IOBMP_INVALID_OFFSET; > > > _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |