* [PATCH for-4.8] x86/cpu: Reposition stack alignment check
@ 2016-11-25 19:04 Andrew Cooper
2016-11-27 15:03 ` Wei Liu
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Andrew Cooper @ 2016-11-25 19:04 UTC (permalink / raw)
To: Xen-devel; +Cc: Andrew Cooper, Wei Liu, Jan Beulich
As identified during review, using BUG_ON() before `lidt` will result in a
triple fault, even on APs.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wei.liu2@citrix.com>
---
xen/arch/x86/cpu/common.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 06ee401..16cf001 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -643,11 +643,6 @@ 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;
@@ -672,6 +667,15 @@ void load_system_tables(void)
asm volatile ("lidt %0" : : "m" (idtr) );
asm volatile ("ltr %w0" : : "rm" (TSS_ENTRY << 3) );
asm volatile ("lldt %w0" : : "rm" (0) );
+
+ /*
+ * Bottom-of-stack must be 16-byte aligned!
+ *
+ * Defer checks until exception support is sufficiently set up.
+ */
+ 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));
}
/*
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH for-4.8] x86/cpu: Reposition stack alignment check
2016-11-25 19:04 [PATCH for-4.8] x86/cpu: Reposition stack alignment check Andrew Cooper
@ 2016-11-27 15:03 ` Wei Liu
2016-11-28 8:13 ` Jan Beulich
2016-11-28 8:18 ` Jan Beulich
2 siblings, 0 replies; 4+ messages in thread
From: Wei Liu @ 2016-11-27 15:03 UTC (permalink / raw)
To: Andrew Cooper; +Cc: Wei Liu, Jan Beulich, Xen-devel
On Fri, Nov 25, 2016 at 07:04:51PM +0000, Andrew Cooper wrote:
> As identified during review, using BUG_ON() before `lidt` will result in a
> triple fault, even on APs.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> CC: Jan Beulich <JBeulich@suse.com>
> CC: Wei Liu <wei.liu2@citrix.com>
On the basis that this is a critical bug fix:
Release-acked-by: Wei Liu <wei.liu2@citrix.com>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH for-4.8] x86/cpu: Reposition stack alignment check
2016-11-25 19:04 [PATCH for-4.8] x86/cpu: Reposition stack alignment check Andrew Cooper
2016-11-27 15:03 ` Wei Liu
@ 2016-11-28 8:13 ` Jan Beulich
2016-11-28 8:18 ` Jan Beulich
2 siblings, 0 replies; 4+ messages in thread
From: Jan Beulich @ 2016-11-28 8:13 UTC (permalink / raw)
To: Andrew Cooper; +Cc: Wei Liu, Xen-devel
>>> On 25.11.16 at 20:04, <andrew.cooper3@citrix.com> wrote:
> As identified during review, using BUG_ON() before `lidt` will result in a
> triple fault, even on APs.
Oh, I did commit v1 instead of v2, sorry.
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH for-4.8] x86/cpu: Reposition stack alignment check
2016-11-25 19:04 [PATCH for-4.8] x86/cpu: Reposition stack alignment check Andrew Cooper
2016-11-27 15:03 ` Wei Liu
2016-11-28 8:13 ` Jan Beulich
@ 2016-11-28 8:18 ` Jan Beulich
2 siblings, 0 replies; 4+ messages in thread
From: Jan Beulich @ 2016-11-28 8:18 UTC (permalink / raw)
To: Andrew Cooper; +Cc: Wei Liu, Xen-devel
>>> On 25.11.16 at 20:04, <andrew.cooper3@citrix.com> wrote:
> @@ -672,6 +667,15 @@ void load_system_tables(void)
> asm volatile ("lidt %0" : : "m" (idtr) );
> asm volatile ("ltr %w0" : : "rm" (TSS_ENTRY << 3) );
> asm volatile ("lldt %w0" : : "rm" (0) );
> +
> + /*
> + * Bottom-of-stack must be 16-byte aligned!
> + *
> + * Defer checks until exception support is sufficiently set up.
> + */
I've applied this right away, correcting the indentation issue here.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-11-28 8:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-25 19:04 [PATCH for-4.8] x86/cpu: Reposition stack alignment check Andrew Cooper
2016-11-27 15:03 ` Wei Liu
2016-11-28 8:13 ` Jan Beulich
2016-11-28 8:18 ` Jan Beulich
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.