x86/fpu: Don't store PKRU in xstate in fpu_reset_fpstate()
authorThomas Gleixner <tglx@linutronix.de>
Wed, 23 Jun 2021 12:02:22 +0000 (14:02 +0200)
committerBorislav Petkov <bp@suse.de>
Wed, 23 Jun 2021 17:55:16 +0000 (19:55 +0200)
commit0e8c54f6b2c8b1037cef9276e451522ee90ed969
tree7c4460026cf1f124a922172f03ced464c785da57
parent954436989cc550dd91aab98363240c9c0a4b7e23
x86/fpu: Don't store PKRU in xstate in fpu_reset_fpstate()

PKRU for a task is stored in task->thread.pkru when the task is scheduled
out. For 'current' the authoritative source of PKRU is the hardware.

fpu_reset_fpstate() has two callers:

  1) fpu__clear_user_states() for !FPU systems. For those PKRU is irrelevant

  2) fpu_flush_thread() which is invoked from flush_thread(). flush_thread()
     resets the hardware to the kernel restrictive default value.

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/20210623121456.802850233@linutronix.de
arch/x86/kernel/fpu/core.c