Skip to content

x86/fpu/xstate: Follow up on the init_fpstate fallout again

Chang S. Bae linux-kselftest lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2x86/fpu/xstate: Prevent false-positive warning in __copy_xstate_uabi_buf()arch/x86/kernel/fpu/xstate.c+14 -160 replies
2/2selftests/x86/amx: Add a ptrace testtools/testing/selftests/x86/amx.c+105 -30 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by.

PatchMingwei Zhang
1/2T-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] x86/fpu/xstate: Follow up on the init_fpstate fallout again

Dear maintainers,

This series is following up on the last fix [2]. I thought I could forget about it with that. But, I was wrong because now this was realized as an incomplete solution -- my bad. Here is some context for this series:

The last fix [3] has resolved the case when copying the initialized dynamic state from init_fpstate to the user buffer in __copy_xstate_to_uabi_buf(). (This was intended to resolve the fallout of the init_fpstate fix [1].)

But, when copying the *non-initialized* dynamic state from the task xstate, the code [4] unconditionally retrieves the address in init_fpstate which is needless. Consequently, this triggers a false-positive warning as shown in [5] which meaninglessly confuses users.

With these repetitive surgeries, a more solid and comprehensive solution is more helpful I thought. Considerably removing init_fpstate from this loop is not impossible here because dynamic states have an all-zeros init state. Then, zeroing the user buffer instead of retrieving init_fpstate resolves the issue and simplifies the code.

These issues were discovered from the KVM execution with launching a guest and running the KVM self-test as __copy_xstate_to_uabi_buf() was called. But, the negligibly missing ptrace test could have disclosed them too. So that case is included here.

Thanks,
Chang

[1] https://lore.kernel.org/lkml/[email protected]/
[2] https://lore.kernel.org/lkml/[email protected]/
[3] https://lore.kernel.org/lkml/[email protected]/
[4] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/x86/kernel/fpu/xstate.c#n1156
[5] https://lore.kernel.org/kvm/[email protected]/

Chang S. Bae (2):
x86/fpu/xstate: Prevent false-positive warning in

    __copy_xstate_uabi_buf()

selftests/x86/amx: Add a ptrace test

 arch/x86/kernel/fpu/xstate.c      |  30 ++++-----
 tools/testing/selftests/x86/amx.c | 108 +++++++++++++++++++++++++++++-
 2 files changed, 119 insertions(+), 19 deletions(-)

base-commit: 7fa08de735e41001a70c8ca869b2b159d74c2339

Signature · 1 line
2.17.1