Skip to content

Commit 9813c5f

Browse files
khueygregkh
authored andcommitted
x86/fpu: Add a pkru argument to copy_uabi_from_kernel_to_xstate().
commit 1c813ce upstream ptrace (through PTRACE_SETREGSET with NT_X86_XSTATE) ultimately calls copy_uabi_from_kernel_to_xstate(). In preparation for eventually handling PKRU in copy_uabi_to_xstate, pass in a pointer to the PKRU location. Signed-off-by: Kyle Huey <me@kylehuey.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Link: https://lore.kernel.org/all/20221115230932.7126-3-khuey%40kylehuey.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent fea26e8 commit 9813c5f

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

arch/x86/include/asm/fpu/xstate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ extern void __init update_regset_xstate_info(unsigned int size,
136136

137137
void *get_xsave_addr(struct xregs_state *xsave, int xfeature_nr);
138138
int xfeature_size(int xfeature_nr);
139-
int copy_uabi_from_kernel_to_xstate(struct xregs_state *xsave, const void *kbuf);
139+
int copy_uabi_from_kernel_to_xstate(struct xregs_state *xsave, const void *kbuf, u32 *pkru);
140140
int copy_sigframe_from_user_to_xstate(struct task_struct *tsk, const void __user *ubuf);
141141

142142
void xsaves(struct xregs_state *xsave, u64 mask);

arch/x86/kernel/fpu/regset.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ int xstateregs_set(struct task_struct *target, const struct user_regset *regset,
163163
}
164164

165165
fpu_force_restore(fpu);
166-
ret = copy_uabi_from_kernel_to_xstate(&fpu->state.xsave, kbuf ?: tmpbuf);
166+
ret = copy_uabi_from_kernel_to_xstate(&fpu->state.xsave, kbuf ?: tmpbuf, &target->thread.pkru);
167167

168168
out:
169169
vfree(tmpbuf);

arch/x86/kernel/fpu/xstate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,7 @@ static int copy_uabi_to_xstate(struct xregs_state *xsave, const void *kbuf,
11591159
* format and copy to the target thread. This is called from
11601160
* xstateregs_set().
11611161
*/
1162-
int copy_uabi_from_kernel_to_xstate(struct xregs_state *xsave, const void *kbuf)
1162+
int copy_uabi_from_kernel_to_xstate(struct xregs_state *xsave, const void *kbuf, u32 *pkru)
11631163
{
11641164
return copy_uabi_to_xstate(xsave, kbuf, NULL);
11651165
}

0 commit comments

Comments
 (0)