Re: [PATCH v3 02/21] x86/fpu/xstate: Modify state copy helpers to handle both static and dynamic buffers

From: Borislav Petkov
Date: Fri Jan 15 2021 - 07:53:55 EST


On Wed, Dec 23, 2020 at 07:56:58AM -0800, Chang S. Bae wrote:
> In preparation for dynamic xstate buffer expansion, update the xstate
> copy function parameters to equally handle static in-line buffer, as well
> as dynamically allocated xstate buffer.

This is repeated from the previous patch. I'm sure you can think of text
which fits here.

>
> No functional change.
>
> Signed-off-by: Chang S. Bae <chang.seok.bae@xxxxxxxxx>
> Reviewed-by: Len Brown <len.brown@xxxxxxxxx>
> Cc: x86@xxxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> ---
> Changes from v2:
> * Updated the changelog with task->fpu removed. (Boris Petkov)
> ---
> arch/x86/include/asm/fpu/xstate.h | 8 ++++----
> arch/x86/kernel/fpu/regset.c | 6 +++---
> arch/x86/kernel/fpu/signal.c | 16 +++++++---------
> arch/x86/kernel/fpu/xstate.c | 19 +++++++++++++++----
> 4 files changed, 29 insertions(+), 20 deletions(-)
>
> diff --git a/arch/x86/include/asm/fpu/xstate.h b/arch/x86/include/asm/fpu/xstate.h
> index 47a92232d595..e0f1b22f53ce 100644
> --- a/arch/x86/include/asm/fpu/xstate.h
> +++ b/arch/x86/include/asm/fpu/xstate.h
> @@ -105,10 +105,10 @@ const void *get_xsave_field_ptr(int xfeature_nr);
> int using_compacted_format(void);
> int xfeature_size(int xfeature_nr);
> struct membuf;
> -void copy_xstate_to_kernel(struct membuf to, struct xregs_state *xsave);
> -int copy_kernel_to_xstate(struct xregs_state *xsave, const void *kbuf);
> -int copy_user_to_xstate(struct xregs_state *xsave, const void __user *ubuf);
> -void copy_supervisor_to_kernel(struct xregs_state *xsave);
> +void copy_xstate_to_kernel(struct membuf to, struct fpu *fpu);
> +int copy_kernel_to_xstate(struct fpu *fpu, const void *kbuf);
> +int copy_user_to_xstate(struct fpu *fpu, const void __user *ubuf);
> +void copy_supervisor_to_kernel(struct fpu *fpu);

Hmm, so those functions have "xstate" in the name because they took and
@xstate parameter. I guess not such a big deal you changing them, just
pointing out what the naming logic was.

--
Regards/Gruss,
Boris.

SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 36809, AG Nürnberg