From: Ankur Arora Date: Mon, 5 Feb 2018 03:35:07 +0000 (-0500) Subject: x86/entry: RESTORE_IBRS needs to be done under kernel CR3 X-Git-Tag: v4.1.12-124.31.3~1206 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=a74acdc246f3cf9d6583b23c6f1f25b3a8c8b512;p=users%2Fjedix%2Flinux-maple.git x86/entry: RESTORE_IBRS needs to be done under kernel CR3 RESTORE_IBRS_CLOBBER executes after we have already switched to the USER_CR3. This blows up because RESTORE_IBRS_CLOBBER looks at a kernel variable (use_ibrs). Orabug: 27501734 Signed-off-by: Ankur Arora Reviewed-by: Konrad Rzeszutek Wilk (cherry picked from commit a2b15d7844fc60bc3ebb5f1703cd2fe39256db35) --- diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index fef48172a35c..f55668e7c2cd 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S @@ -1526,6 +1526,9 @@ ENTRY(paranoid_exit) DISABLE_INTERRUPTS(CLBR_NONE) TRACE_IRQS_OFF_DEBUG TRACE_IRQS_IRETQ_DEBUG + + RESTORE_IBRS_CLOBBER save_reg=%r13d + #ifdef CONFIG_PAGE_TABLE_ISOLATION /* No ALTERNATIVE for X86_FEATURE_PTI: paranoid_entry sets %ebx */ testl $2, %ebx /* SWITCH_USER_CR3 needed? */ @@ -1535,7 +1538,6 @@ paranoid_exit_no_switch: #endif testl $1, %ebx /* swapgs needed? */ jnz paranoid_exit_no_swapgs - RESTORE_IBRS_CLOBBER save_reg=%r13d SWAPGS_UNSAFE_STACK paranoid_exit_no_swapgs: RESTORE_EXTRA_REGS