Re: [syzbot] WARNING in ex_handler_fprestore
From: Thomas Gleixner
Date: Thu May 27 2021 - 15:17:08 EST
On Thu, May 27 2021 at 11:59, Yu-cheng Yu wrote:
> On 5/27/2021 9:49 AM, Thomas Gleixner wrote:
>> On Thu, May 27 2021 at 00:03, Thomas Gleixner wrote:
>>> I decoded it fully by now and will send out coherent info (and hopefully
>>> a patch) tomorrow with brain awake. Time for bed here...
>>
>> Not yet there with a patch, but I have a trivial C reproducer. See
>> below.
>>
>> The failure mode is:
>>
>> signal to task
>> sigaction_handler()
>> wreckage xsave.header.reserved[0]
>> sig_return()
>> restore_fpu_from_sigframe()
>> try: XRSTOR from user -> #GP
>> copy_from_user(fpstate, task->fpu.state.xsave);
>> validate(task->fpu.state.xsave) -> fail
>> fpu__clear_user_states()
>> reinits FPU hardware but task state is still wreckaged
>
> In fpu__clear_user_states(), maybe can we clear xstate_header.reserved[]
> as well?
Just because my reproducer wreckages xstate_header.reserved, you think
it's sufficient to maybe clear that field? May I recommend to study the
XSAVE documentation?
> Or do we want to check the user buffer first before copy it?
Before your patch the code was correct. So maybe study the SDM, the code
and the commit and carefully read this email plus the following ones
before you come up with more helpful suggestions.
<SNIP>
80 lines of useless quotes
</SNIP>
See: https://people.kernel.org/tglx/notes-about-netiquette
Thanks,
tglx