From: Borislav Petkov <bp@alien8.de>
To: Paul Menzel <pmenzel@molgen.mpg.de>
Cc: Thomas Lendacky <Thomas.Lendacky@amd.com>,
Thomas Gleixner <tglx@linutronix.de>,
Jiri Kosina <jikos@kernel.org>, "x86@kernel.org" <x86@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Tim Chen <tim.c.chen@linux.intel.com>
Subject: Re: General protection fault in `switch_mm_irqs_off()`
Date: Wed, 9 Jan 2019 22:11:04 +0100 [thread overview]
Message-ID: <20190109211104.GG15665@zn.tnic> (raw)
In-Reply-To: <9bca3e26-1dfc-6e86-cf28-90cadd983ff4@molgen.mpg.de>
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.
next prev parent reply other threads:[~2019-01-09 21:11 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-03 21:45 General protection fault in `switch_mm_irqs_off()` Paul Menzel
2019-01-04 12:41 ` Paul Menzel
2019-01-04 15:47 ` Borislav Petkov
2019-01-04 17:32 ` Lendacky, Thomas
2019-01-04 16:42 ` Jiri Kosina
[not found] ` <cb7ba667-562b-1e4c-f16e-7c11804bc98a@molgen.mpg.de>
2019-01-09 13:16 ` Thomas Gleixner
2019-01-09 13:35 ` Paul Menzel
2019-01-09 14:29 ` Lendacky, Thomas
2019-01-09 14:34 ` Paul Menzel
2019-01-09 16:15 ` Lendacky, Thomas
2019-01-09 16:34 ` Paul Menzel
2019-01-09 21:11 ` Borislav Petkov [this message]
[not found] ` <9bbcbaa7-b164-fcef-0588-7c5f25aa2440@molgen.mpg.de>
2019-01-10 15:53 ` Lendacky, Thomas
2019-01-10 16:02 ` Borislav Petkov
2019-01-10 16:00 ` Borislav Petkov
2019-01-10 16:49 ` Paul Menzel
2019-01-10 18:34 ` Lendacky, Thomas
2019-01-14 17:00 ` Lendacky, Thomas
2019-01-14 17:09 ` Paul Menzel
2019-01-14 17:37 ` Lendacky, Thomas
2019-10-02 15:52 ` Paul Menzel
2019-01-09 13:19 ` Paul Menzel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190109211104.GG15665@zn.tnic \
--to=bp@alien8.de \
--cc=Thomas.Lendacky@amd.com \
--cc=jikos@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmenzel@molgen.mpg.de \
--cc=tglx@linutronix.de \
--cc=tim.c.chen@linux.intel.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.