From: Jan Beulich Date: Wed, 16 Dec 2020 15:41:46 +0000 (+0100) Subject: x86: clobber registers in switch_stack_and_jump() when !LIVEPATCH X-Git-Tag: archive/raspbian/4.16.0+51-g0941d6cb-1+rpi1~2^2~42^2~1271 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=033a80677087b322789d2748e83b764545f76c6b;p=xen.git x86: clobber registers in switch_stack_and_jump() when !LIVEPATCH In order to have the same effect on registers as a call to check_for_livepatch_work() may have, clobber all call-clobbered registers in debug builds. Signed-off-by: Jan Beulich Reviewed-by: Wei Liu --- diff --git a/xen/include/asm-x86/current.h b/xen/include/asm-x86/current.h index 4d8822f78c..231994a245 100644 --- a/xen/include/asm-x86/current.h +++ b/xen/include/asm-x86/current.h @@ -120,6 +120,14 @@ unsigned long get_stack_dump_bottom (unsigned long sp); #ifdef CONFIG_LIVEPATCH # define CHECK_FOR_LIVEPATCH_WORK "call check_for_livepatch_work;" +#elif defined(CONFIG_DEBUG) +/* Mimic the clobbering effect a call has on registers. */ +# define CHECK_FOR_LIVEPATCH_WORK \ + "mov $0x1234567890abcdef, %%rax\n\t" \ + "mov %%rax, %%rcx; mov %%rax, %%rdx\n\t" \ + "mov %%rax, %%rsi; mov %%rax, %%rdi\n\t" \ + "mov %%rax, %%r8; mov %%rax, %%r9\n\t" \ + "mov %%rax, %%r10; mov %%rax, %%r11\n\t" #else # define CHECK_FOR_LIVEPATCH_WORK "" #endif