[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YNL3VXx9QiizOo0T@zn.tnic>
Date: Wed, 23 Jun 2021 10:56:53 +0200
From: Borislav Petkov <bp@...e.de>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: LKML <linux-kernel@...r.kernel.org>,
Andy Lutomirski <luto@...nel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Fenghua Yu <fenghua.yu@...el.com>,
Tony Luck <tony.luck@...el.com>,
Yu-cheng Yu <yu-cheng.yu@...el.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Kan Liang <kan.liang@...ux.intel.com>
Subject: Re: [patch V3 66/66] x86/fpu/signal: Let xrstor handle the features
to init
On Fri, Jun 18, 2021 at 04:19:29PM +0200, Thomas Gleixner wrote:
> There is no reason to do an extra XRSTOR from initfp_state for feature bits
> which have been cleared by user space in the FX magic xfeatures storage.
>
> Just clear them in the task's XSTATE header and do a full restore which
> will put these cleared features into init state.
>
> There is no real difference in performance because the current code already
> does a full restore when the xfeatures bits are preserved as the signal
> frame setup has stored them, which is the full UABI feature set.
>
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> ---
> arch/x86/kernel/fpu/signal.c | 92 +++++++++++++++----------------------------
> 1 file changed, 33 insertions(+), 59 deletions(-)
...
> @@ -390,54 +362,56 @@ static int __fpu_restore_sig(void __user
> set_thread_flag(TIF_NEED_FPU_LOAD);
> }
> __fpu_invalidate_fpregs_state(fpu);
> + __cpu_invalidate_fpregs_state();
> fpregs_unlock();
>
> if (use_xsave() && !fx_only) {
> - u64 init_bv = xfeatures_mask_uabi() & ~user_xfeatures;
> -
> - ret = copy_sigframe_from_user_to_xstate(&fpu->state.xsave, buf_fx);
> + ret = copy_sigframe_from_user_to_xstate(&fpu->state.xsave,
> + buf_fx);
Why? Just let it stick out.
Regardless,
Reviewed-by: Borislav Petkov <bp@...e.de>
--
Regards/Gruss,
Boris.
SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 36809, AG Nürnberg
Powered by blists - more mailing lists