changeset: 24171:fe80909663c1 user: Keir Fraser date: Tue Nov 22 13:00:21 2011 +0000 files: xen/common/wait.c description: x86,waitqueue: Allocate whole page for shadow stack. Signed-off-by: Keir Fraser --- xen/common/wait.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) Index: xen-4.1.2-testing/xen/common/wait.c =================================================================== --- xen-4.1.2-testing.orig/xen/common/wait.c +++ xen-4.1.2-testing/xen/common/wait.c @@ -33,7 +33,7 @@ struct waitqueue_vcpu { * hypervisor context before sleeping (descheduling), setjmp/longjmp-style. */ void *esp; - char stack[3000]; + char *stack; #endif }; @@ -45,6 +45,15 @@ int init_waitqueue_vcpu(struct vcpu *v) if ( wqv == NULL ) return -ENOMEM; +#ifdef CONFIG_X86 + wqv->stack = alloc_xenheap_page(); + if ( wqv->stack == NULL ) + { + xfree(wqv); + return -ENOMEM; + } +#endif + memset(wqv, 0, sizeof(*wqv)); INIT_LIST_HEAD(&wqv->list); wqv->vcpu = v; @@ -63,6 +72,9 @@ void destroy_waitqueue_vcpu(struct vcpu return; BUG_ON(!list_empty(&wqv->list)); +#ifdef CONFIG_X86 + free_xenheap_page(wqv->stack); +#endif xfree(wqv); v->waitqueue_vcpu = NULL; @@ -115,7 +127,7 @@ static void __prepare_to_wait(struct wai : "=S" (wqv->esp) : "c" (cpu_info), "D" (wqv->stack) : "memory" ); - BUG_ON((cpu_info - (char *)wqv->esp) > sizeof(wqv->stack)); + BUG_ON((cpu_info - (char *)wqv->esp) > PAGE_SIZE); } static void __finish_wait(struct waitqueue_vcpu *wqv)