From: Borislav Petkov <bp@alien8.de>
To: Andy Lutomirski <luto@amacapital.net>
Cc: x86-ml <x86@kernel.org>,
jpa@kernelbug.mail.kapsi.fi, Dave Hansen <dave.hansen@intel.com>,
"H. Peter Anvin" <hpa@zytor.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86/fpu: Reset MXCSR to default in kernel_fpu_begin()
Date: Wed, 17 Jun 2020 10:33:14 +0200 [thread overview]
Message-ID: <20200617083314.GC10118@zn.tnic> (raw)
In-Reply-To: <1D569B6B-B8C3-497E-8A74-2E1A3D46299E@amacapital.net>
On Tue, Jun 16, 2020 at 02:17:16PM -0700, Andy Lutomirski wrote:
> We definitely need to sanitize MXCSR for kernel fpu if kernel fpu
> means SSE2. If kernel fpu means x87, we need to fix the fpu control
> word.
Bah, there's no need to beat around the bush - let's just do:
if (boot_cpu_has(X86_FEATURE_XMM))
ldmxcsr(MXCSR_DEFAULT);
if (boot_cpu_has(X86_FEATURE_FPU))
asm volatile ("fninit");
and be sure that kernel users get a squeaky-clean FPU.
> On x86_64, I suspect the UEFI ABI technically requires a clean x87
> control word too. If we’re willing to declare that the kernel proper
> won’t use x87, then we could shove that into the UEFI code.
Nah, we don't trust the firmware.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
next prev parent reply other threads:[~2020-06-17 8:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-16 9:53 [PATCH] x86/fpu: Reset MXCSR to default in kernel_fpu_begin() Borislav Petkov
2020-06-16 16:53 ` Andy Lutomirski
2020-06-16 18:01 ` Borislav Petkov
2020-06-16 21:17 ` Andy Lutomirski
2020-06-17 8:33 ` Borislav Petkov [this message]
2020-06-17 15:30 ` Andy Lutomirski
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=20200617083314.GC10118@zn.tnic \
--to=bp@alien8.de \
--cc=bigeasy@linutronix.de \
--cc=dave.hansen@intel.com \
--cc=hpa@zytor.com \
--cc=jpa@kernelbug.mail.kapsi.fi \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--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