]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
x86/IBRS: Make sure we restore MSR_IA32_SPEC_CTRL to a valid value
authorBoris Ostrovsky <boris.ostrovsky@oracle.com>
Wed, 10 Jan 2018 00:08:45 +0000 (19:08 -0500)
committerKirtikar Kashyap <kirtikar.kashyap@oracle.com>
Fri, 12 Jan 2018 18:34:44 +0000 (10:34 -0800)
It is possible to (re-)enable IBRS between invocations of
ENABLE_IBRS_SAVE_AND_CLOBBER and RESTORE_IBRS_CLOBBER. If that happens,
the latter will be trying to write MSR_IA32_SPEC_CTRL with an
uninitialized value, possibly triggering a #GPF.

To avoid this let's make sure that we always save a valid value into
the save register. If IBRS is disabled that safe value will be
SPEC_CTRL_FEATURE_ENABLE_IBRS.

Orabug: 27378102

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
v2: Instead of setting to zero we set it to SPEC_CTRL_FEATURE_ENABLE_IBRS

Signed-off-by: Brian Maly <brian.maly@oracle.com>
Signed-off-by: Kirtikar Kashyap <kirtikar.kashyap@oracle.com>
arch/x86/include/asm/spec_ctrl.h

index 6cce513f3fb27b651e5a4c0372da8c4c1e1d8134..e62ea4685a1c20cba0a23f23d34fffaed59571d0 100644 (file)
        wrmsr
        jmp 22f
 12:
+       movl $SPEC_CTRL_FEATURE_ENABLE_IBRS, \save_reg
        lfence
 22:
 .endm