Skip to content

x86/fpu: Allow restoring signal frames with larger xstate_size

Andrei Vagin criu lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2x86/fpu: Allow restoring signal frames with larger xstate_sizeDocumentation/arch/x86/xstate.rst arch/x86/kernel/fpu/signal.c+33 -80 replies
2/2selftests/x86: Check restoring FPU state with larger xstate_sizetools/testing/selftests/x86/sigframe_fpu_portability.c+110 -80 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] x86/fpu: Allow restoring signal frames with larger xstate_size

When a process is checkpointed on one machine and restored on another (e.g., via CRIU during container/process migration), any signal frame on its stack carries the xstate layout of the source CPU.

Commit fd14edd82077 ("x86/fpu: Pre-fault only required size of xstate buffer") enabled restoring signal frames created on CPUs with a smaller xstate_size than the destination host's default. However, check_xstate_in_sigframe() still enforces that a signal frame's xstate_size must not exceed the current task's fpstate->user_size.

This restriction prevents migrating a process from a CPU with more enabled xstate features to a CPU with fewer features, even when the process has not actively used any of the unsupported features. Because the actual set of active features is recorded in the XSAVE header (XSTATE_BV) and validated during restoration, a larger xstate_size is safe to restore as long as all active features are present in the intersection of frame and task features and the buffer is large enough for them.

Cc Alexander Mikhalitsyn <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc "Chang S. Bae" <[email protected]>
Cc Dave Hansen <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Thomas Gleixner <[email protected]>

Andrei Vagin (2):
x86/fpu: Allow restoring signal frames with larger xstate_size selftests/x86: Check restoring FPU state with larger xstate_size

 Documentation/arch/x86/xstate.rst                  |  10 +-
 arch/x86/kernel/fpu/signal.c                       |  31 +++++-
 .../selftests/x86/sigframe_fpu_portability.c       | 118 +++++++++++++++++++--
 3 files changed, 143 insertions(+), 16 deletions(-)
Signature · 1 line
2.55.0.1082.g2b9226bbc0-goog