]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
x86/entry: RESTORE_IBRS needs to be done under kernel CR3
authorAnkur Arora <ankur.a.arora@oracle.com>
Mon, 5 Feb 2018 03:35:07 +0000 (22:35 -0500)
committerJack Vogel <jack.vogel@oracle.com>
Wed, 7 Feb 2018 17:42:29 +0000 (09:42 -0800)
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 <ankur.a.arora@oracle.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
(cherry picked from commit a2b15d7844fc60bc3ebb5f1703cd2fe39256db35)

arch/x86/kernel/entry_64.S

index fef48172a35c17796e304cfdea1a0218fb5f63d6..f55668e7c2cd49f7422ee5f72c57ca0aff534799 100644 (file)
@@ -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