>From 6067e84192b1c5aaa4675437c3d2a743d18c7c7d Mon Sep 17 00:00:00 2001 From: Juergen Gross To: xen-devel@xxxxxxxxxxxxxxxxxxxx Cc: Jan Beulich Cc: Andrew Cooper Cc: Wei Liu Cc: "Roger Pau Monné" Date: Wed, 8 Jan 2020 11:41:17 +0100 Subject: [PATCH] xen/x86: clear per cpu stub page information in cpu_smpboot_free() cpu_smpboot_free() removes the stubs for the cpu going offline, but it isn't clearing the related percpu variables. This will result in crashes when a stub page is released due to all related cpus gone offline and one of those cpus going online later. Fix that by clearing stubs.addr and stubs.mfn in order to allocate a new sub page when needed. Signed-off-by: Juergen Gross --- xen/arch/x86/smpboot.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index 7e29704080..46c0729214 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -945,6 +945,8 @@ static void cpu_smpboot_free(unsigned int cpu, bool remove) (per_cpu(stubs.addr, cpu) | ~PAGE_MASK) + 1); if ( i == STUBS_PER_PAGE ) free_domheap_page(mfn_to_page(mfn)); + per_cpu(stubs.addr, cpu) = 0; + per_cpu(stubs.mfn, cpu) = 0; } FREE_XENHEAP_PAGE(per_cpu(compat_gdt, cpu)); -- 2.16.4