From: Thomas Gleixner <tglx@linutronix.de>
To: speck@linutronix.de
Subject: [patch V2 08/10] MDS basics+ 8
Date: Wed, 20 Feb 2019 16:08:01 +0100 [thread overview]
Message-ID: <20190220151400.682732169@linutronix.de> (raw)
In-Reply-To: 20190220150753.665964899@linutronix.de
In virtualized environments it can happen that the host has the microcode
update which utilizes the VERW instruction to clear CPU buffers, but the
hypervisor is not yet updated to expose the X86_FEATURE_MD_CLEAR CPUID bit
to guests.
Introduce an internal mitigation mode 'HOPE' which enables the invocation
of the CPU buffer clearing even if X86_FEATURE_MD_CLEAR is not set. If the
system has no updated microcode this results in a pointless execution of
the VERW instruction wasting a few CPU cycles. If the microcode is updated,
but not exposed to a guest then the CPU buffers will be cleared.
Hope dies last....
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
Documentation/x86/mds.rst | 5 +++++
arch/x86/include/asm/processor.h | 1 +
arch/x86/kernel/cpu/bugs.c | 14 ++++++++------
3 files changed, 14 insertions(+), 6 deletions(-)
--- a/Documentation/x86/mds.rst
+++ b/Documentation/x86/mds.rst
@@ -65,6 +65,11 @@ The mitigation is invoked on kernel/user
(idle) transitions. Depending on the mitigation mode and the system state
the invocation can be enforced or conditional.
+As a special quirk to address virtualization scenarios where the host has
+the microcode updated, but the hypervisor does not (yet) expose the
+MD_CLEAR CPUID bit to guests, the kernel issues the VERW instruction in the
+hope that it might work. The state is reflected accordingly.
+
According to current knowledge additional mitigations inside the kernel
itself are not required because the necessary gadgets to expose the leaked
data cannot be controlled in a way which allows exploitation from malicious
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -995,6 +995,7 @@ enum mds_mitigations {
MDS_MITIGATION_OFF,
MDS_MITIGATION_AUTO,
MDS_MITIGATION_FULL,
+ MDS_MITIGATION_HOPE,
};
#endif /* _ASM_X86_PROCESSOR_H */
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -221,7 +221,8 @@ static enum mds_mitigations mds_mitigati
static const char * const mds_strings[] = {
[MDS_MITIGATION_OFF] = "Vulnerable",
- [MDS_MITIGATION_FULL] = "Mitigation: Clear CPU buffers"
+ [MDS_MITIGATION_FULL] = "Mitigation: Clear CPU buffers",
+ [MDS_MITIGATION_HOPE] = "Vulnerable: Clear CPU buffers attempted, no microcode",
};
static void mds_select_mitigation(void)
@@ -236,12 +237,12 @@ static void mds_select_mitigation(void)
break;
case MDS_MITIGATION_AUTO:
case MDS_MITIGATION_FULL:
- if (boot_cpu_has(X86_FEATURE_MD_CLEAR)) {
+ case MDS_MITIGATION_HOPE:
+ if (boot_cpu_has(X86_FEATURE_MD_CLEAR))
mds_mitigation = MDS_MITIGATION_FULL;
- static_branch_enable(&mds_user_clear_always);
- } else {
- mds_mitigation = MDS_MITIGATION_OFF;
- }
+ else
+ mds_mitigation = MDS_MITIGATION_HOPE;
+ static_branch_enable(&mds_user_clear_always);
break;
}
pr_info("%s\n", mds_strings[mds_mitigation]);
@@ -704,6 +705,7 @@ void arch_smt_update(void)
case MDS_MITIGATION_OFF:
break;
case MDS_MITIGATION_FULL:
+ case MDS_MITIGATION_HOPE:
update_mds_branch_idle();
break;
/* Keep GCC happy */
next prev parent reply other threads:[~2019-02-20 15:19 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-20 15:07 [patch V2 00/10] MDS basics+ 0 Thomas Gleixner
2019-02-20 15:07 ` [patch V2 01/10] MDS basics+ 1 Thomas Gleixner
2019-02-20 16:27 ` [MODERATED] " Borislav Petkov
2019-02-20 16:46 ` Greg KH
2019-02-20 15:07 ` [patch V2 02/10] MDS basics+ 2 Thomas Gleixner
2019-02-20 16:47 ` [MODERATED] " Borislav Petkov
2019-02-20 16:48 ` Greg KH
2019-02-20 15:07 ` [patch V2 03/10] MDS basics+ 3 Thomas Gleixner
2019-02-20 16:54 ` [MODERATED] " mark gross
2019-02-20 16:57 ` Thomas Gleixner
2019-02-20 18:08 ` [MODERATED] " mark gross
2019-02-20 21:40 ` Thomas Gleixner
2019-02-20 17:14 ` [MODERATED] " Borislav Petkov
2019-02-20 21:31 ` Thomas Gleixner
2019-02-21 2:12 ` [MODERATED] " Andrew Cooper
2019-02-21 9:27 ` Peter Zijlstra
2019-02-21 9:33 ` [MODERATED] " Borislav Petkov
2019-02-21 10:04 ` Thomas Gleixner
2019-02-21 10:18 ` [MODERATED] Re: " Borislav Petkov
2019-02-20 15:07 ` [patch V2 04/10] MDS basics+ 4 Thomas Gleixner
2019-02-20 16:52 ` [MODERATED] " Greg KH
2019-02-20 17:10 ` mark gross
2019-02-21 19:26 ` [MODERATED] Encrypted Message Tim Chen
2019-02-21 20:32 ` Thomas Gleixner
2019-02-21 21:07 ` [MODERATED] " Jiri Kosina
2019-02-20 18:43 ` [MODERATED] Re: [patch V2 04/10] MDS basics+ 4 Borislav Petkov
2019-02-20 19:26 ` Jiri Kosina
2019-02-20 21:42 ` Thomas Gleixner
2019-02-20 15:07 ` [patch V2 05/10] MDS basics+ 5 Thomas Gleixner
2019-02-20 20:05 ` [MODERATED] " Borislav Petkov
2019-02-21 2:24 ` Andrew Cooper
2019-02-21 10:36 ` Thomas Gleixner
2019-02-21 11:22 ` Thomas Gleixner
2019-02-21 11:51 ` [MODERATED] Attack Surface [Was [patch V2 05/10] MDS basics+ 5] Andrew Cooper
2019-02-21 18:41 ` Thomas Gleixner
2019-02-20 15:07 ` [patch V2 06/10] MDS basics+ 6 Thomas Gleixner
2019-02-21 10:18 ` [MODERATED] " Borislav Petkov
2019-02-20 15:08 ` [patch V2 07/10] MDS basics+ 7 Thomas Gleixner
2019-02-21 12:47 ` [MODERATED] " Borislav Petkov
2019-02-21 13:48 ` Thomas Gleixner
2019-02-20 15:08 ` Thomas Gleixner [this message]
2019-02-21 14:04 ` [MODERATED] Re: [patch V2 08/10] MDS basics+ 8 Borislav Petkov
2019-02-21 14:11 ` Thomas Gleixner
2019-02-20 15:08 ` [patch V2 09/10] MDS basics+ 9 Thomas Gleixner
2019-02-20 16:21 ` [MODERATED] " Peter Zijlstra
2019-02-20 22:32 ` Thomas Gleixner
2019-02-20 22:50 ` [MODERATED] " Jiri Kosina
2019-02-20 23:22 ` Thomas Gleixner
2019-02-21 11:04 ` [MODERATED] " Peter Zijlstra
2019-02-21 11:50 ` Peter Zijlstra
2019-02-21 14:18 ` Borislav Petkov
2019-02-21 18:00 ` Kees Cook
2019-02-21 19:46 ` Thomas Gleixner
2019-02-21 20:56 ` Thomas Gleixner
2019-02-20 15:08 ` [patch V2 10/10] MDS basics+ 10 Thomas Gleixner
2019-02-22 16:05 ` [MODERATED] Re: [patch V2 00/10] MDS basics+ 0 mark gross
2019-02-22 17:12 ` Thomas Gleixner
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=20190220151400.682732169@linutronix.de \
--to=tglx@linutronix.de \
--cc=speck@linutronix.de \
/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.