Re: [PATCH v3 09/10] x86/fpu/xstate: Preserve supervisor states for slow path of __fpu__restore_sig()

From: Borislav Petkov
Date: Sun May 10 2020 - 04:46:45 EST


On Sat, Mar 28, 2020 at 09:43:06AM -0700, Yu-cheng Yu wrote:
> The signal return code is responsible for taking an XSAVE buffer present
> in user memory and loading it into the hardware registers. This
> operation only affects user XSAVE state and never affects supervisor state.
>
> The fast path through this code simply points XRSTOR directly at the
> user buffer. However, due to page faults, this XRSTOR can fail. If it
^^^^^^^^^^^^^^^^^^

"However, since user memory is not guaranteed to be always mapped, ... "

> fails, the signal return code falls back to a slow path which can
> tolerate page faults.
>
> That slow path copies the xfeatures one by one out of the user buffer
> into the task's fpu state area. However, by being in a context where it
> can handle page faults, the code can also schedule. That exposes us to
^^
Pls use passive voice in your commit message: no "we" or "I", etc, and
describe your changes in imperative mood.

Fix this in all your commit messages pls.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette