x86/fpu: Rename copy_user_to_xregs() and copy_xregs_to_user()
authorThomas Gleixner <tglx@linutronix.de>
Wed, 23 Jun 2021 12:01:53 +0000 (14:01 +0200)
committerBorislav Petkov <bp@suse.de>
Wed, 23 Jun 2021 16:01:56 +0000 (18:01 +0200)
The function names for xsave[s]/xrstor[s] operations are horribly named and
a permanent source of confusion.

Rename:
copy_xregs_to_user() to xsave_to_user_sigframe()
copy_user_to_xregs() to xrstor_from_user_sigframe()

so it's entirely clear what this is about. This is also a clear indicator
of the potentially different storage format because this is user ABI and
cannot use compacted format.

No functional change.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20210623121453.924266705@linutronix.de
arch/x86/include/asm/fpu/internal.h
arch/x86/kernel/fpu/signal.c

index dae1545..a2ab744 100644 (file)
@@ -326,7 +326,7 @@ static inline void os_xrstor(struct xregs_state *xstate, u64 mask)
  * backward compatibility for old applications which don't understand
  * compacted format of xsave area.
  */
-static inline int copy_xregs_to_user(struct xregs_state __user *buf)
+static inline int xsave_to_user_sigframe(struct xregs_state __user *buf)
 {
        u64 mask = xfeatures_mask_user();
        u32 lmask = mask;
@@ -351,7 +351,7 @@ static inline int copy_xregs_to_user(struct xregs_state __user *buf)
 /*
  * Restore xstate from user space xsave area.
  */
-static inline int copy_user_to_xregs(struct xregs_state __user *buf, u64 mask)
+static inline int xrstor_from_user_sigframe(struct xregs_state __user *buf, u64 mask)
 {
        struct xregs_state *xstate = ((__force struct xregs_state *)buf);
        u32 lmask = mask;
index 33675b3..4fe632f 100644 (file)
@@ -129,7 +129,7 @@ static inline int copy_fpregs_to_sigframe(struct xregs_state __user *buf)
        int err;
 
        if (use_xsave())
-               err = copy_xregs_to_user(buf);
+               err = xsave_to_user_sigframe(buf);
        else if (use_fxsr())
                err = copy_fxregs_to_user((struct fxregs_state __user *) buf);
        else
@@ -266,7 +266,7 @@ static int copy_user_to_fpregs_zeroing(void __user *buf, u64 xbv, int fx_only)
                } else {
                        init_bv = xfeatures_mask_user() & ~xbv;
 
-                       r = copy_user_to_xregs(buf, xbv);
+                       r = xrstor_from_user_sigframe(buf, xbv);
                        if (!r && unlikely(init_bv))
                                os_xrstor(&init_fpstate.xsave, init_bv);
                        return r;