Message ID | 20210622222459.9C76B034@viggo.jf.intel.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | x86/pkeys: remove PKRU from kernel XSAVE buffer | expand |
diff -puN arch/x86/kernel/fpu/signal.c~fpu-sig-stash-pkru arch/x86/kernel/fpu/signal.c --- a/arch/x86/kernel/fpu/signal.c~fpu-sig-stash-pkru 2021-06-22 14:49:07.899051760 -0700 +++ b/arch/x86/kernel/fpu/signal.c 2021-06-22 14:49:07.903051760 -0700 @@ -233,6 +233,13 @@ static int restore_hwregs_from_user(void if (!ret && unlikely(init_bv)) os_xrstor(&init_fpstate.xsave, init_bv); + + /* + * PKRU may have been modified by XRSTOR, + * save the possibly updated value: + */ + current->thread.pkru = read_pkru(); + return ret; } else if (use_fxsr()) { return fxrstor_from_user_sigframe(buf);