mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrei Vagin <avagin@google.com>
To: Borislav Petkov <bp@alien8.de>,
	"Chang S. Bae" <chang.seok.bae@intel.com>
Cc: linux-kernel@vger.kernel.org, criu@lists.linux.dev,
	 Thomas Gleixner <tglx@kernel.org>,
	Ingo Molnar <mingo@redhat.com>,
	 Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org,  Andrei Vagin <avagin@google.com>,
	Alexander Mikhalitsyn <alexander@mihalicyn.com>,
	 "H. Peter Anvin" <hpa@zytor.com>
Subject: [PATCH 0/2] x86/fpu: Allow restoring signal frames with larger xstate_size
Date: Tue, 29 Sep 2026 23:26:19 +0000	[thread overview]
Message-ID: <20260929232621.3745312-1-avagin@google.com> (raw)

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 <alexander@mihalicyn.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: "Chang S. Bae" <chang.seok.bae@intel.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Thomas Gleixner <tglx@kernel.org>

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(-)

-- 
2.55.0.1082.g2b9226bbc0-goog


             reply	other threads:[~2026-09-29 23:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29 23:26 Andrei Vagin [this message]
2026-09-29 23:26 ` [PATCH 1/2] " Andrei Vagin
2026-09-29 23:26 ` [PATCH 2/2] selftests/x86: Check restoring FPU state " Andrei Vagin
2026-09-29 23:57 ` [PATCH 0/2] x86/fpu: Allow restoring signal frames " Borislav Petkov
2026-09-30  0:02   ` Andrei Vagin
2026-09-30  2:51     ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260929232621.3745312-1-avagin@google.com \
    --to=avagin@google.com \
    --cc=alexander@mihalicyn.com \
    --cc=bp@alien8.de \
    --cc=chang.seok.bae@intel.com \
    --cc=criu@lists.linux.dev \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®