Skip to content

Commit b29773d

Browse files
khueygregkh
authored andcommitted
x86/fpu: Add a pkru argument to copy_uabi_to_xstate()
commit 2c87767 upstream In preparation for adding PKRU handling code into copy_uabi_to_xstate(), add an argument that copy_uabi_from_kernel_to_xstate() can use to pass the canonical location of the PKRU value. For copy_sigframe_from_user_to_xstate() the kernel will actually restore the PKRU value from the fpstate, but pass in the thread_struct's pkru location anyways for consistency. 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-4-khuey%40kylehuey.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9813c5f commit b29773d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/x86/kernel/fpu/xstate.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,7 +1092,7 @@ static int copy_from_buffer(void *dst, unsigned int offset, unsigned int size,
10921092

10931093

10941094
static int copy_uabi_to_xstate(struct xregs_state *xsave, const void *kbuf,
1095-
const void __user *ubuf)
1095+
const void __user *ubuf, u32 *pkru)
10961096
{
10971097
unsigned int offset, size;
10981098
struct xstate_header hdr;
@@ -1161,7 +1161,7 @@ static int copy_uabi_to_xstate(struct xregs_state *xsave, const void *kbuf,
11611161
*/
11621162
int copy_uabi_from_kernel_to_xstate(struct xregs_state *xsave, const void *kbuf, u32 *pkru)
11631163
{
1164-
return copy_uabi_to_xstate(xsave, kbuf, NULL);
1164+
return copy_uabi_to_xstate(xsave, kbuf, NULL, pkru);
11651165
}
11661166

11671167
/*
@@ -1172,7 +1172,7 @@ int copy_uabi_from_kernel_to_xstate(struct xregs_state *xsave, const void *kbuf,
11721172
int copy_sigframe_from_user_to_xstate(struct task_struct *tsk,
11731173
const void __user *ubuf)
11741174
{
1175-
return copy_uabi_to_xstate(&tsk->thread.fpu.state.xsave, NULL, ubuf);
1175+
return copy_uabi_to_xstate(&tsk->thread.fpu.state.xsave, NULL, ubuf, &tsk->thread.pkru);
11761176
}
11771177

11781178
static bool validate_xsaves_xrstors(u64 mask)

0 commit comments

Comments
 (0)