]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
x86: re-add stack alignment check
authorJan Beulich <jbeulich@suse.com>
Fri, 25 Nov 2016 13:30:58 +0000 (14:30 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 25 Nov 2016 13:30:58 +0000 (14:30 +0100)
Commit 279840d5ea ("x86/boot: install trap handlers much earlier on
boot"), perhaps not really intentionally, removed this check. Add it
back,
- preventing it from triggering before any output is set up,
- 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@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-acked-by: Wei Liu <wei.liu2@citrix.com>
xen/arch/x86/cpu/common.c

index 3475198845a3dfdc13ed2afacb0365acb3c3cb1e..06ee401ff10e76051dbd904bef2429c9fa398fcf 100644 (file)
@@ -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));
+
        /* Main stack for interrupts/exceptions. */
        tss->rsp0 = stack_bottom;
        tss->bitmap = IOBMP_INVALID_OFFSET;