lkml.org 
[lkml]   [2020]   [Jun]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 1/2] x86/fpu: Reset MXCSR to default in kernel_fpu_begin()
    On Fri, Jun 19, 2020 at 11:01:44AM -0700, Andy Lutomirski wrote:
    > On Fri, Jun 19, 2020 at 10:41 AM Borislav Petkov <bp@alien8.de> wrote:
    > >
    > > From: Petteri Aimonen <jpa@git.mail.kapsi.fi>
    > >
    > > Previously, kernel floating point code would run with the MXCSR control
    > > register value last set by userland code by the thread that was active
    > > on the CPU core just before kernel call. This could affect calculation
    > > results if rounding mode was changed, or a crash if a FPU/SIMD exception
    > > was unmasked.
    > >
    > > Restore MXCSR to the kernel's default value.
    > >
    > > [ bp: Carve out from a bigger patch by Petteri, add feature check, add
    > > FNINIT call too (amluto). ]
    >
    > Acked-by: Andy Lutomirski <luto@kernel.org>
    >
    > but:
    >
    > shouldn't kernel_fpu_begin() end with a barrier()?

    the "fninit" thing is already asm volatile or do you want the explicit
    memory clobber of barrier?

    If so, why?

    The LDMXCSR and FNINIT have effect only on hardware state...

    --
    Regards/Gruss,
    Boris.

    https://people.kernel.org/tglx/notes-about-netiquette

    \
     
     \ /
      Last update: 2020-06-22 19:09    [W:3.272 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site