linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@kernel.org>
To: Dave Hansen <dave.hansen@intel.com>
Cc: Andy Lutomirski <luto@kernel.org>, Borislav Petkov <bp@alien8.de>,
	X86 ML <x86@kernel.org>,
	jpa@kernelbug.mail.kapsi.fi, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] x86/fpu: Reset MXCSR to default in kernel_fpu_begin()
Date: Mon, 22 Jun 2020 11:40:38 -0700	[thread overview]
Message-ID: <CALCETrUT1_WVjMbPZhUcX9sjFvLBZKCc2fxeJJsD940k1Ajyrw@mail.gmail.com> (raw)
In-Reply-To: <ef327682-7e9f-5652-1664-3e201ac38f60@intel.com>

On Mon, Jun 22, 2020 at 11:38 AM Dave Hansen <dave.hansen@intel.com> wrote:
>
> On 6/22/20 11:33 AM, Andy Lutomirski wrote:
> > Suppose you do:
> >
> > double x = 1.0;
> >
> > kernel_fpu_begin();
> >
> > x += 2.0;
> >
> > We want to make sure that GCC puts things in the right order.  I
> > suppose that even a memory clobber is insufficient here, though.
>
> Even with CONFIG_PREEMPT disabled, we still have:
>
>         #define preempt_disable()                       barrier()
>
> I don't see us supporting preemptible kernel_fpu regions any time soon,
> so shouldn't this be sufficient now and for a long time?

That's on the wrong end of the function.  It'sL

preempt_disable();
LDMXCSR;
<-- some kind of barrier here might be nice

--Andy

  reply	other threads:[~2020-06-22 18:40 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-19 17:41 [PATCH 0/2] x86/FPU: FPU sanitization for in-kernel use Borislav Petkov
2020-06-19 17:41 ` [PATCH 1/2] x86/fpu: Reset MXCSR to default in kernel_fpu_begin() Borislav Petkov
2020-06-19 18:01   ` Andy Lutomirski
2020-06-22 17:09     ` Borislav Petkov
2020-06-22 18:33       ` Andy Lutomirski
2020-06-22 18:36         ` Petteri Aimonen
2020-06-22 18:38         ` Dave Hansen
2020-06-22 18:40           ` Andy Lutomirski [this message]
2020-06-22 18:59             ` Borislav Petkov
2020-06-19 17:41 ` [PATCH 2/2] selftests/fpu: Add an FPU selftest Borislav Petkov
2020-06-19 18:00   ` Andy Lutomirski
2020-06-22 17:12     ` Borislav Petkov
2020-06-22 18:26       ` Andy Lutomirski
2020-06-22 19:01         ` Borislav Petkov
     [not found]           ` <B4D00859-000A-4F8C-8CFB-45B9BBCCA16D@amacapital.net>
2020-06-23 10:28             ` Borislav Petkov
2020-06-23 18:22               ` Andy Lutomirski
2020-06-23 18:47                 ` Borislav Petkov
2020-06-23 19:07                   ` Nick Desaulniers
2020-06-23 19:13                     ` Borislav Petkov
2020-06-23 20:58                       ` Nick Desaulniers
2020-06-23 21:32                         ` Borislav Petkov
2020-06-20 19:55   ` kernel test robot
2020-06-22 17:04     ` Borislav Petkov
2020-06-22 18:15       ` Nick Desaulniers

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=CALCETrUT1_WVjMbPZhUcX9sjFvLBZKCc2fxeJJsD940k1Ajyrw@mail.gmail.com \
    --to=luto@kernel.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@intel.com \
    --cc=jpa@kernelbug.mail.kapsi.fi \
    --cc=linux-kernel@vger.kernel.org \
    --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).