Re: [patch V2 45/52] x86/fpu: Dont restore PKRU in fpregs_restore_userspace()

From: Thomas Gleixner
Date: Wed Jun 16 2021 - 04:56:36 EST


On Tue, Jun 15 2021 at 17:52, Yu-cheng Yu wrote:
> On 6/14/2021 8:44 AM, Thomas Gleixner wrote:
>> + * If PKRU is enabled, then the PKRU value is already
>> + * correct because it was either set in switch_to() or in
>> + * flush_thread(). So it is excluded because it might be
>> + * not up to date in current->thread.fpu.xsave state.
>> + */
>> + __restore_fpregs_from_fpstate(&fpu->state,
>> + xfeatures_mask_restore_user());
>
> This needs to be xfeatures_mask_restore_user() |
> xfeatures_mask_supervisor().

Indeed. Good catch!

Thanks,

tglx