Skip to content

Commit

Permalink
x86/fpu/xstate: Clear xstate header in copy_xstate_to_uabi_buf() again
Browse files Browse the repository at this point in the history
The change which made copy_xstate_to_uabi_buf() usable for
[x]fpregs_get() removed the zeroing of the header which means the
header, which is copied to user space later, contains except for the
xfeatures member, random stack content.

Add the memset() back to zero it before usage.

Fixes: eb6f517 ("x86/fpu: Make copy_xstate_to_kernel() usable for [x]fpregs_get()")
Reported-by: kernel test robot <oliver.sang@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/875yy3wb8h.ffs@nanos.tec.linutronix.de
  • Loading branch information
Thomas Gleixner authored and Borislav Petkov committed Jun 24, 2021
1 parent 6f9866a commit 93c2cdc
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions arch/x86/kernel/fpu/xstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,7 @@ void copy_xstate_to_uabi_buf(struct membuf to, struct task_struct *tsk,
unsigned int zerofrom;
int i;

memset(&header, 0, sizeof(header));
header.xfeatures = xsave->header.xfeatures;

/* Mask out the feature bits depending on copy mode */
Expand Down

0 comments on commit 93c2cdc

Please sign in to comment.