Re: [PATCH 8/9] x86/fpu: correctly check for kthreads
From: Sebastian Andrzej Siewior
Date: Wed Aug 14 2019 - 10:55:49 EST
On 2019-08-14 14:39:10 [+0100], Mark Rutland wrote:
> I think this was missed in commit.
> > 8d3289f2fa1e0 ("x86/fpu: Don't use current->mm to check for a kthread")
>
> Yup, though if it's a bug it's been a bug since commit:
>
> 0cecca9d03c964ab ("x86/fpu: Eager switch PKRU state")
>
> ... which I guess the fixes tag would have to mention.
>
> >
> > A kthread with use_mm() would load here non-existing FPU state.
> >
> > Acked-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
>
> Given the above, should I add the fixes tag (for 0cecca9d03c964ab)?
Buh. Either that or hch's commit (8d3289f2fa1e0 ("x86/fpu: Don't use
current->mm to check for a kthread").
That will trigger a stable backport (for 5.2) asking what to do about
is_kthread() so please leave a hint to use the PF_ flag like hch did.
Now that I think about it, even if we end up in kthread with use_mm()
then its FPU state is non-existent which means get_xsave_addr() returns
NULL. This is okay / expected but it triggers the WARN_ONCE().
> Thanks,
> Mark.
Sebastian