noibrs [X86]
Don't use indirect branch restricted speculation (IBRS)
feature when running in secure environment,
- to avoid performance overhead.
+ to avoid performance overhead. Disabling this will fallback
+ on using lfence.
noibpb [X86]
Don't use indirect branch prediction barrier (IBPB)
feature when running in secure environment,
to avoid performance overhead.
+ nolfence [X86]
+ Don't use lfence on every system call/interrupt/exception
+ if noibrs has been specified. This is used to avoid
+ performance overhead.
+
nosmap [X86]
Disable SMAP (Supervisor Mode Access Prevention)
even if it is supported by processor.
#define SPEC_CTRL_IBRS_INUSE (1<<0) /* OS enables IBRS usage */
#define SPEC_CTRL_IBRS_SUPPORTED (1<<1) /* System supports IBRS */
#define SPEC_CTRL_IBRS_ADMIN_DISABLED (1<<2) /* Admin disables IBRS */
-
+#define SPEC_CTRL_LFENCE_OFF (1<<3) /* No lfence */
#ifdef __ASSEMBLY__
.extern use_ibrs
__ASM_ENABLE_IBRS
jmp 20f
7:
+ testl $SPEC_CTRL_LFENCE_OFF, use_ibrs
+ jnz 20f
lfence
20:
.endm
__ASM_ENABLE_IBRS_CLOBBER
jmp 21f
11:
+ testl $SPEC_CTRL_LFENCE_OFF, use_ibrs
+ jnz 21f
lfence
21:
.endm
jmp 22f
12:
movl $SPEC_CTRL_FEATURE_ENABLE_IBRS, \save_reg
+ testl $SPEC_CTRL_LFENCE_OFF, use_ibrs
+ jnz 22f
lfence
22:
.endm
wrmsr
jmp 23f
13:
+ testl $SPEC_CTRL_LFENCE_OFF, use_ibrs
+ jnz 23f
lfence
23:
.endm
set_ibrs_inuse();
}
+static inline void set_lfence_disabled(void)
+{
+ use_ibrs |= SPEC_CTRL_LFENCE_OFF;
+}
+
/* indicate usage of IBPB to control execution speculation */
extern int use_ibpb;
extern u32 sysctl_ibpb_enabled;