From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Cc: Waiman Long <longman@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
"H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, linux-kernel@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Mark Gross <mgross@linux.intel.com>,
Tony Luck <tony.luck@intel.com>
Subject: Re: [PATCH] x86/speculation: Fix incorrect MDS/TAA mitigation status
Date: Thu, 14 Nov 2019 14:35:17 -0600 [thread overview]
Message-ID: <20191114203517.su2roiygk4htkpc3@treble> (raw)
In-Reply-To: <20191114201258.GA18745@guptapadev.amr>
On Thu, Nov 14, 2019 at 12:12:58PM -0800, Pawan Gupta wrote:
> On Wed, Nov 13, 2019 at 02:33:50PM -0500, Waiman Long wrote:
> > For MDS vulnerable processors with TSX support, enabling either MDS
> > or TAA mitigations will enable the use of VERW to flush internal
> > processor buffers at the right code path. IOW, they are either both
> > mitigated or both not mitigated. However, if the command line options
> > are inconsistent, the vulnerabilites sysfs files may not report the
> > mitigation status correctly.
> >
> > For example, with only the "mds=off" option:
> >
> > vulnerabilities/mds:Vulnerable; SMT vulnerable
> > vulnerabilities/tsx_async_abort:Mitigation: Clear CPU buffers; SMT vulnerable
> >
> > The mds vulnerabilities file has wrong status in this case.
> >
> > Change taa_select_mitigation() to sync up the two mitigation status
> > and have them turned off if both "mds=off" and "tsx_async_abort=off"
> > are present.
> >
> > Signed-off-by: Waiman Long <longman@redhat.com>
> > ---
> > arch/x86/kernel/cpu/bugs.c | 17 +++++++++++++++--
> > 1 file changed, 15 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
> > index 4c7b0fa15a19..418d41c1fd0d 100644
> > --- a/arch/x86/kernel/cpu/bugs.c
> > +++ b/arch/x86/kernel/cpu/bugs.c
> > @@ -304,8 +304,12 @@ static void __init taa_select_mitigation(void)
> > return;
> > }
> >
> > - /* TAA mitigation is turned off on the cmdline (tsx_async_abort=off) */
> > - if (taa_mitigation == TAA_MITIGATION_OFF)
> > + /*
> > + * TAA mitigation via VERW is turned off if both
> > + * tsx_async_abort=off and mds=off are specified.
> > + */
> > + if (taa_mitigation == TAA_MITIGATION_OFF &&
> > + mds_mitigation == MDS_MITIGATION_OFF)
> > goto out;
> >
> > if (boot_cpu_has(X86_FEATURE_MD_CLEAR))
> > @@ -339,6 +343,15 @@ static void __init taa_select_mitigation(void)
> > if (taa_nosmt || cpu_mitigations_auto_nosmt())
> > cpu_smt_disable(false);
> >
> > + /*
> > + * Update MDS mitigation, if necessary, as the mds_user_clear is
> > + * now enabled for TAA mitigation.
> > + */
> > + if (mds_mitigation == MDS_MITIGATION_OFF &&
> > + boot_cpu_has_bug(X86_BUG_MDS)) {
> > + mds_mitigation = MDS_MITIGATION_FULL;
> > + mds_select_mitigation();
>
> This will cause a confusing print in dmesg from previous and this call
> to mds_select_mitigation().
>
> "MDS: Vulnerable"
> "MDS: Mitigation: Clear CPU buffers"
>
> Maybe delay MDS mitigation print till TAA is evaluated.
Since they're so intertwined it might make sense to just combine the two
mitigations into a single function.
--
Josh
next prev parent reply other threads:[~2019-11-14 20:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-13 19:33 Waiman Long
2019-11-14 17:45 ` Borislav Petkov
2019-11-14 17:53 ` Waiman Long
2019-11-14 18:48 ` Thomas Gleixner
2019-11-14 19:11 ` Waiman Long
2019-11-14 20:12 ` Pawan Gupta
2019-11-14 20:35 ` Josh Poimboeuf [this message]
2019-11-14 21:48 ` Waiman Long
2019-11-14 21:58 ` Waiman Long
2019-11-14 22:09 ` Borislav Petkov
2019-11-15 14:40 ` Waiman Long
2019-11-14 23:03 ` 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=20191114203517.su2roiygk4htkpc3@treble \
--to=jpoimboe@redhat.com \
--cc=bp@alien8.de \
--cc=gregkh@linuxfoundation.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mgross@linux.intel.com \
--cc=mingo@redhat.com \
--cc=pawan.kumar.gupta@linux.intel.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®