lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 22 Nov 2019 13:22:37 -0800
From:   Yu-cheng Yu <yu-cheng.yu@...el.com>
To:     Borislav Petkov <bp@...en8.de>
Cc:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "x86@...nel.org" <x86@...nel.org>,
        "H. Peter Anvin" <hpa@...or.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        "Luck, Tony" <tony.luck@...el.com>,
        Andy Lutomirski <luto@...nel.org>,
        Rik van Riel <riel@...riel.com>,
        "Shankar, Ravi V" <ravi.v.shankar@...el.com>,
        Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
        "Yu, Fenghua" <fenghua.yu@...el.com>,
        Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH 1/6] x86/fpu/xstate: Fix small issues before adding
 supervisor xstates

On Wed, 2019-10-09 at 08:58 -0700, Borislav Petkov wrote:
> On Wed, Sep 25, 2019 at 08:10:17AM -0700, Yu-cheng Yu wrote:
> > In response to earlier comments, fix small issues before introducing XSAVES
> > supervisor states:
> > - Add spaces around '*'.
> > - Fix comments of xfeature_is_supervisor().
> > - Replace ((u64)1 << 63) with XCOMP_BV_COMPACTED_FORMAT.
> > 
> > No functional changes from this patch.
> > 
> > Signed-off-by: Yu-cheng Yu <yu-cheng.yu@...el.com>
> > Reviewed-by: Dave Hansen <dave.hansen@...ux.intel.com>
> > Reviewed-by: Tony Luck <tony.luck@...el.com>
> > ---
> >  arch/x86/kernel/fpu/xstate.c | 15 ++++++---------
> >  1 file changed, 6 insertions(+), 9 deletions(-)
> > 
> > diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c
> > index e5cb67d67c03..b793fc2156b9 100644
> > --- a/arch/x86/kernel/fpu/xstate.c
> > +++ b/arch/x86/kernel/fpu/xstate.c
> > @@ -60,7 +60,7 @@ u64 xfeatures_mask __read_mostly;
> > 
> >  static unsigned int xstate_offsets[XFEATURE_MAX] = { [ 0 ... XFEATURE_MAX - 1] = -1};
> >  static unsigned int xstate_sizes[XFEATURE_MAX]   = { [ 0 ... XFEATURE_MAX - 1] = -1};
> > -static unsigned int xstate_comp_offsets[sizeof(xfeatures_mask)*8];
> > +static unsigned int xstate_comp_offsets[sizeof(xfeatures_mask) * 8];
> > 
> >  /*
> >   * The XSAVE area of kernel can be in standard or compacted format;
> > @@ -110,12 +110,8 @@ EXPORT_SYMBOL_GPL(cpu_has_xfeatures);
> >  static int xfeature_is_supervisor(int xfeature_nr)
> >  {
> >       /*
> > -      * We currently do not support supervisor states, but if
> > -      * we did, we could find out like this.
> > -      *
> > -      * SDM says: If state component 'i' is a user state component,
> > -      * ECX[0] return 0; if state component i is a supervisor
> > -      * state component, ECX[0] returns 1.
> > +      * Extended State Enumeration Sub-leaves (EAX = 0DH, ECX = n, n > 1)
> > +      * returns ECX[0] set to (1) for a supervisor state.
> 
> "... and cleared (0) for a user state."
> 
> I believe it is is clearer this way.
> 
> >        */
> >       u32 eax, ebx, ecx, edx;
> > 
> 
> Since you're touching this function: make it return bool as it is used
> in boolean context only and have it return simply:
> 
>         return ecx & 1;

This implicitly converts a u32 to a bool.  By looking at it, I think it should
be OK, but wonder if anything overlooked?  I would be happy to make this a
separate patch.

Yu-cheng

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ