Messages in this thread Patch in this message | | | Date | Wed, 9 Jan 2019 22:11:04 +0100 | From | Borislav Petkov <> | Subject | Re: General protection fault in `switch_mm_irqs_off()` |
| |
On Wed, Jan 09, 2019 at 05:34:11PM +0100, Paul Menzel wrote: > Is there a way to trace the value of `boot_cpu_data` from > `arch/x86/include/asm/cpufeature.h` with some Linux Kernel magic? > > #define boot_cpu_has(bit) cpu_has(&boot_cpu_data, bit) > > Or is rebuilding with print statements the only solution?
Yes. Just apply this and catch output. It is a wild guess anyway as this whole deal looks really strange but at least it should not #GP the machine.
--- diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h index dad12b767ba0..ec4688779900 100644 --- a/arch/x86/include/asm/nospec-branch.h +++ b/arch/x86/include/asm/nospec-branch.h @@ -284,6 +284,9 @@ static inline void indirect_branch_prediction_barrier(void) { u64 val = PRED_CMD_IBPB; + if (WARN_ON(boot_cpu_has(X86_FEATURE_USE_IBPB))) + return; + alternative_msr_write(MSR_IA32_PRED_CMD, val, X86_FEATURE_USE_IBPB); } diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 1de0f4170178..4ed4cc99a2c0 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -371,6 +371,8 @@ spectre_v2_user_select_mitigation(enum spectre_v2_mitigation_cmd v2_cmd) if (boot_cpu_has(X86_FEATURE_IBPB)) { setup_force_cpu_cap(X86_FEATURE_USE_IBPB); + pr_err("%s: set X86_FEATURE_USE_IBPB\n", __func__); + switch (cmd) { case SPECTRE_V2_USER_CMD_FORCE: case SPECTRE_V2_USER_CMD_PRCTL_IBPB: -- Regards/Gruss, Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.
| |