linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Hansen <dave.hansen@intel.com>
To: Borislav Petkov <bp@alien8.de>
Cc: Matthias Welwarsky <matthias.welwarsky@sysgo.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	linux-kernel@vger.kernel.org, x86-ml <x86@kernel.org>
Subject: Re: x86, possible bug in __memmove() alternatives patching
Date: Tue, 29 Mar 2022 15:34:46 -0700	[thread overview]
Message-ID: <1ec9dd62-7299-1662-3907-bf73ea56fa7d@intel.com> (raw)
In-Reply-To: <Yj7Oi9g/B54xAcmF@zn.tnic>

On 3/26/22 01:27, Borislav Petkov wrote:
> So, more to the point, it is about this chunk:
> 
>         /*
>          * If fast string is not enabled in IA32_MISC_ENABLE for any reason,
>          * clear the fast string and enhanced fast string CPU capabilities.
>          */
>         if (c->x86 > 6 || (c->x86 == 6 && c->x86_model >= 0xd)) {
>                 rdmsrl(MSR_IA32_MISC_ENABLE, misc_enable);
>                 if (!(misc_enable & MSR_IA32_MISC_ENABLE_FAST_STRING)) {
>                         pr_info("Disabled fast string operations\n");
>                         setup_clear_cpu_cap(X86_FEATURE_REP_GOOD);
>                         setup_clear_cpu_cap(X86_FEATURE_ERMS);
>                 }
>         }
> 
> we already check whether fast strings was disabled, regardless of HV or
> not. Question is, should we clear X86_FEATURE_FSRM there too. I wanna
> say yes.

I don't think it would hurt to clear it.

> Or is it that, *if* MSR_IA32_MISC_ENABLE_FAST_STRING is clear, the FSRM
> CPUID bit was not set either so nothing to clear...

I don't think there's really any direct connection between the CPUID bit
and MSR_IA32_MISC_ENABLE_FAST_STRING.  The CPUID bit definitely doesn't
appear to be cleared by the CPU if MSR_IA32_MISC_ENABLE_FAST_STRING is
clear.

  reply	other threads:[~2022-03-29 22:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-25  8:51 x86, possible bug in __memmove() alternatives patching Matthias Welwarsky
2022-03-25 22:07 ` Borislav Petkov
2022-03-26  4:45   ` Dave Hansen
2022-03-26  8:27     ` Borislav Petkov
2022-03-29 22:34       ` Dave Hansen [this message]
2022-03-26 11:39     ` Matthias Welwarsky
2022-03-29 22:33       ` Dave Hansen
2022-03-30 13:56         ` Matthias Welwarsky
2022-03-30 14:44           ` Dave Hansen
2022-03-30 14:54           ` Borislav Petkov

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=1ec9dd62-7299-1662-3907-bf73ea56fa7d@intel.com \
    --to=dave.hansen@intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthias.welwarsky@sysgo.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;
as well as URLs for NNTP newsgroup(s).