[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <89bcab262d6dad4c08c4a21e522796fea2320db3.camel@intel.com>
Date: Fri, 28 Feb 2020 07:53:38 -0800
From: Yu-cheng Yu <yu-cheng.yu@...el.com>
To: Borislav Petkov <bp@...en8.de>
Cc: linux-kernel@...r.kernel.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>,
Tony Luck <tony.luck@...el.com>,
Andy Lutomirski <luto@...nel.org>,
Rik van Riel <riel@...riel.com>,
"Ravi V. Shankar" <ravi.v.shankar@...el.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Fenghua Yu <fenghua.yu@...el.com>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH v2 8/8] x86/fpu/xstate: Restore supervisor xstates for
__fpu__restore_sig()
On Fri, 2020-02-28 at 13:17 +0100, Borislav Petkov wrote:
> On Thu, Feb 27, 2020 at 02:52:12PM -0800, Yu-cheng Yu wrote:
> > > So the code sets TIF_NEED_FPU_LOAD unconditionally, why are you changing
> > > this?
> > >
> > > Why don't you simply do:
> > >
> > > set_thread_flag(TIF_NEED_FPU_LOAD);
> > > fpregs_lock();
> > > if (xfeatures_mask_supervisor())
> > > copy_xregs_to_kernel(&fpu->state.xsave);
> > > fpregs_unlock();
> >
> > If TIF_NEED_FPU_LOAD is set, then xstates are already in the xsave buffer.
> > We can skip saving them again.
>
> Ok, then pls use test_and_set_thread_flag().
>
> Also, in talking to Sebastian about this on IRC, he raised a valid
> concern: if we are going to save supervisor states here, then
> copy_xregs_to_kernel() should better save *only* supervisor states
> because we're not interested in the user states - they're going to be
> overwritten with the states from the stack.
Yes, saving only supervisor states is optimal, but doing XSAVES with a
partial RFBM changes xcomp_bv.
Yu-cheng
Powered by blists - more mailing lists