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

[Xen-changelog] [xen master] x86: re-add stack alignment check



commit bffd3752b7c5554a551e86ff9f08e30f484f3537
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Fri Nov 25 14:30:58 2016 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Nov 25 14:30:58 2016 +0100

    x86: re-add stack alignment check
    
    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@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Release-acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 xen/arch/x86/cpu/common.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 3475198..06ee401 100644
--- 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));
+
        /* Main stack for interrupts/exceptions. */
        tss->rsp0 = stack_bottom;
        tss->bitmap = IOBMP_INVALID_OFFSET;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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