Messages in this thread | | | Date | Wed, 28 Sep 2022 21:06:17 +0000 | From | Sean Christopherson <> | Subject | Re: [PATCH v2 4/4] x86/fpu: Correct the legacy state offset and size information |
| |
On Thu, Sep 22, 2022, Chang S. Bae wrote: > MXCSR is architecturally part of the SSE state. But, the kernel code > presumes it as part of the FP component. Adjust the offset and size for > these legacy states. > > Notably, each legacy component area is not contiguous, unlike extended > components. Add a warning message when these offset and size are > referenced. > > Fixes: ac73b27aea4e ("x86/fpu/xstate: Fix xstate_offsets, xstate_sizes for non-extended xstates") > Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com> > Cc: x86@kernel.org > Cc: linux-kernel@vger.kernel.org > --- > arch/x86/kernel/fpu/xstate.c | 21 +++++++++++++++------ > 1 file changed, 15 insertions(+), 6 deletions(-) > > diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c > index a3f7045d1f8e..ac2ec5d6e7e4 100644 > --- a/arch/x86/kernel/fpu/xstate.c > +++ b/arch/x86/kernel/fpu/xstate.c > @@ -143,8 +143,13 @@ static unsigned int xfeature_get_offset(u64 xcomp_bv, int xfeature) > * offsets. > */ > if (!cpu_feature_enabled(X86_FEATURE_XCOMPACTED) || > - xfeature <= XFEATURE_SSE) > + xfeature <= XFEATURE_SSE) { > + if (xfeature <= XFEATURE_SSE) > + pr_warn("The legacy state (%d) is discontiguously located.\n", > + xfeature);
pr_warn() here isn't warranted. copy_uabi_to_xstate() calls this with non-extended features, which is perfectly fine since it manually handles MXCSR. And that helper is directly reachable by userspace, i.e. userspace can spam the pr_warn().
| |