Commit 1cc34413 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Borislav Petkov

x86/fpu: Rename xstate copy functions which are related to UABI

Rename them to reflect that these functions deal with user space format
XSAVE buffers.

      copy_kernel_to_xstate() -> copy_uabi_from_kernel_to_xstate()
      copy_user_to_xstate()   -> copy_sigframe_from_user_to_xstate()

Again a clear statement that these functions deal with user space ABI.
Suggested-by: default avatarAndy Lutomirski <luto@kernel.org>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Reviewed-by: default avatarBorislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20210623121454.318485015@linutronix.de
parent 6fdc908c
...@@ -102,8 +102,8 @@ extern void __init update_regset_xstate_info(unsigned int size, ...@@ -102,8 +102,8 @@ extern void __init update_regset_xstate_info(unsigned int size,
void *get_xsave_addr(struct xregs_state *xsave, int xfeature_nr); void *get_xsave_addr(struct xregs_state *xsave, int xfeature_nr);
int xfeature_size(int xfeature_nr); int xfeature_size(int xfeature_nr);
int copy_kernel_to_xstate(struct xregs_state *xsave, const void *kbuf); int copy_uabi_from_kernel_to_xstate(struct xregs_state *xsave, const void *kbuf);
int copy_user_to_xstate(struct xregs_state *xsave, const void __user *ubuf); int copy_sigframe_from_user_to_xstate(struct xregs_state *xsave, const void __user *ubuf);
void copy_dynamic_supervisor_to_kernel(struct xregs_state *xstate, u64 mask); void copy_dynamic_supervisor_to_kernel(struct xregs_state *xstate, u64 mask);
void copy_kernel_to_dynamic_supervisor(struct xregs_state *xstate, u64 mask); void copy_kernel_to_dynamic_supervisor(struct xregs_state *xstate, u64 mask);
......
...@@ -166,7 +166,7 @@ int xstateregs_set(struct task_struct *target, const struct user_regset *regset, ...@@ -166,7 +166,7 @@ int xstateregs_set(struct task_struct *target, const struct user_regset *regset,
} }
fpu_force_restore(fpu); fpu_force_restore(fpu);
ret = copy_kernel_to_xstate(&fpu->state.xsave, kbuf ?: tmpbuf); ret = copy_uabi_from_kernel_to_xstate(&fpu->state.xsave, kbuf ?: tmpbuf);
out: out:
vfree(tmpbuf); vfree(tmpbuf);
......
...@@ -422,7 +422,7 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size) ...@@ -422,7 +422,7 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size)
if (use_xsave() && !fx_only) { if (use_xsave() && !fx_only) {
u64 init_bv = xfeatures_mask_user() & ~user_xfeatures; u64 init_bv = xfeatures_mask_user() & ~user_xfeatures;
ret = copy_user_to_xstate(&fpu->state.xsave, buf_fx); ret = copy_sigframe_from_user_to_xstate(&fpu->state.xsave, buf_fx);
if (ret) if (ret)
goto out; goto out;
......
...@@ -1099,7 +1099,7 @@ static inline bool mxcsr_valid(struct xstate_header *hdr, const u32 *mxcsr) ...@@ -1099,7 +1099,7 @@ static inline bool mxcsr_valid(struct xstate_header *hdr, const u32 *mxcsr)
* Convert from a ptrace standard-format kernel buffer to kernel XSAVE[S] format * Convert from a ptrace standard-format kernel buffer to kernel XSAVE[S] format
* and copy to the target thread. This is called from xstateregs_set(). * and copy to the target thread. This is called from xstateregs_set().
*/ */
int copy_kernel_to_xstate(struct xregs_state *xsave, const void *kbuf) int copy_uabi_from_kernel_to_xstate(struct xregs_state *xsave, const void *kbuf)
{ {
unsigned int offset, size; unsigned int offset, size;
int i; int i;
...@@ -1154,7 +1154,8 @@ int copy_kernel_to_xstate(struct xregs_state *xsave, const void *kbuf) ...@@ -1154,7 +1154,8 @@ int copy_kernel_to_xstate(struct xregs_state *xsave, const void *kbuf)
* XSAVE[S] format and copy to the target thread. This is called from the * XSAVE[S] format and copy to the target thread. This is called from the
* sigreturn() and rt_sigreturn() system calls. * sigreturn() and rt_sigreturn() system calls.
*/ */
int copy_user_to_xstate(struct xregs_state *xsave, const void __user *ubuf) int copy_sigframe_from_user_to_xstate(struct xregs_state *xsave,
const void __user *ubuf)
{ {
unsigned int offset, size; unsigned int offset, size;
int i; int i;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment