[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <872cb0a2-3659-2e6c-52a8-33f1a2f0a2cd@kernel.org>
Date: Wed, 16 Jun 2021 11:12:27 -0700
From: Andy Lutomirski <luto@...nel.org>
To: Dave Hansen <dave.hansen@...el.com>,
"Chang S. Bae" <chang.seok.bae@...el.com>, bp@...e.de,
tglx@...utronix.de, mingo@...nel.org, x86@...nel.org
Cc: len.brown@...el.com, jing2.liu@...el.com, ravi.v.shankar@...el.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 14/28] x86/fpu/xstate: Prevent unauthorised use of
dynamic user state
On 6/16/21 9:27 AM, Dave Hansen wrote:
> On 5/23/21 12:32 PM, Chang S. Bae wrote:
>> @@ -571,6 +612,8 @@ static inline void switch_fpu_finish(struct fpu *new_fpu)
>>
>> set_thread_flag(TIF_NEED_FPU_LOAD);
>>
>> + xfd_switch(old_fpu, new_fpu);
>
> This seems fragile.
>
> XSAVE* will decline to write out state for feature i when XFD[i]=1 and
> will instead write out the init state. That means that, at this point,
> we switch XFD and yet leave state for feature i in place.
>
> That means this *MUST* come before any copy_fpregs_to_fpstate() occurs.
>
> Could we please add some FPU_WARN_ON() checks to ensure that no XSAVE*
> is ever performed with XINUSE=1 *and* XFD armed?
>
Wait, really? I somehow thought that XSAVE* would write out the actual
state even if XFD=1.
This seems like it's asking for some kind of bug.
Powered by blists - more mailing lists