From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oa1-f73.google.com (mail-oa1-f73.google.com [209.85.160.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 51DD9385539 for ; Thu, 4 Jun 2026 16:56:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780592170; cv=none; b=tCsyCmOiJt40gN7McvOerY+wrjlmShDgfHbx3YqYKU5OxFV3v1c/+PF4Q2bfMiM3fevxcpk2APtTo+g6/C1Qy5LfzMtemqSqrSyY3CL7bBZholyJMPkZ2zJ5tOlDuUXKQ5ZrySFPsV3nZq1ecLpYtwyXIrkudxm/IxhvvUSQl2c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780592170; c=relaxed/simple; bh=zuGm+jxkgkHLeYqh7Gpp9Ch3gQZ2CrWlMTyi/nk7w3A=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=j/cF9cbQlYT3gII+viqnLamZ56mXHZ0LFM6+jxgA77SR9pUp0kWnfNTY/FFKUjuXfwqKb2tiojOUtPAbtiEpHsPTUvynfdZg7eoI9+C4BisQKyjK921HfvbbEesLcCX4nqOP3rt411hpJnBE7zwn9h+U+ma85H/kMNcLIv4saU4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--avagin.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=rpAOD3CI; arc=none smtp.client-ip=209.85.160.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--avagin.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="rpAOD3CI" Received: by mail-oa1-f73.google.com with SMTP id 586e51a60fabf-4410658672bso1696630fac.2 for ; Thu, 04 Jun 2026 09:56:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780592168; x=1781196968; darn=lists.linux.dev; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=oSTVTd68WYWQa6bAmVGofgnqCH1CzDL35zyzdNCR4wA=; b=rpAOD3CIOEGYsJJwjnMkmATB12Z5HCht7NMkZaumGE1rm2/WCEP7h/LjmNez4yV5QA S3n2VhCrSByGaRqE/0nEjK5cp780MNhPrQfoRKK8F9c0mEvSHOaJBifeOeGEoxyZ6FC/ 8lyIbEZOy5Rm0+cnfIAkDzQk1e/ZQni3WwLwJHoCrp61u4TNK4hhAGAI8q9hxn95PJy6 nkcW0wOFO9B+7iria2DUUbEeYlByE2D6caAkznKxlgNflv+rhe+BexTI57puby5oPSJ9 H6JOn4Wy5mYWZ/HyB5LsLVCs6fgdbGMk5Z0dwc40i3c+OsjoexApvDYy63P7EbMbp0W8 EtFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780592168; x=1781196968; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oSTVTd68WYWQa6bAmVGofgnqCH1CzDL35zyzdNCR4wA=; b=HD3gXwxOsdqbbvtSAXGeDNRNwQq38+MpuA2CXIBu3CKGwFfTBb9XH67HYEd1AziUJl P0OxsmPTk2USRkBALdA8PaoU6hyeWwCKFvDKoaLkcEKTF36MNgDqJ0rE228YB8ypZEcP TBuG/F45X3EDEVo8iEAy1hRhLjJiQ7mlpa/vckE85hALmpsa/wxnGdxJFk0RDWvB48Mx JFURQuONeN6JC+iWn9dNcZNnI3LOvQXxV3v7AfHT+22aTQu9dzo32lmOV6BG3ks8MC31 sl30woADUMk82in4YeSCw8KHsrd4aBMUF8G4ftPtSUQBHgkgmfaXNu+txAL1IuCyIQgI CUig== X-Forwarded-Encrypted: i=1; AFNElJ9zmaF+GS2vwjdg9qwJqe+WTQmcOVGy9PNipslVJaV/WLbsALUYQQkfYBf5MWH7enYmDEk0@lists.linux.dev X-Gm-Message-State: AOJu0YxWqRTlCax7TKID1XqxtIsGJC22U3fG2XKiQYc+tnQvwWS5O0ib GOW3rZF1GTCFXYsLHuVwrroG3cWTTg6NdmrPBy3r5FM9qJs3YQVjtyiIx48v5sLNP6wqA+WpRiw i0Sdxrg== X-Received: from jalt16.prod.google.com ([2002:a05:6638:3490:b0:5e2:99fa:da7b]) (user=avagin job=prod-delivery.src-stubby-dispatcher) by 2002:a4a:dd05:0:b0:69d:a652:216b with SMTP id 006d021491bc7-69e480dad68mr3571037eaf.60.1780592168106; Thu, 04 Jun 2026 09:56:08 -0700 (PDT) Date: Thu, 4 Jun 2026 16:56:01 +0000 In-Reply-To: <20260604165604.1195243-1-avagin@google.com> Precedence: bulk X-Mailing-List: criu@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260604165604.1195243-1-avagin@google.com> X-Mailer: git-send-email 2.54.0.1032.g2f8565e1d1-goog Message-ID: <20260604165604.1195243-2-avagin@google.com> Subject: [PATCH 1/4] x86/fpu: Document signal frame portability From: Andrei Vagin To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "Chang S. Bae" Cc: linux-kernel@vger.kernel.org, criu@lists.linux.dev, Dave Hansen , x86@kernel.org, Andrei Vagin , "H. Peter Anvin" Content-Type: text/plain; charset="UTF-8" The x86 signal frame is designed to be self-describing, with the 'xstate_size' field in the software-reserved bytes indicating the actual size of the context. This design is required for portability, allowing a signal frame created on a system with a specific set of xstate features to be restored on a machine with a different (larger) set of features. Document this contract in the uabi headers and Documentation/. This requirement is critical for checkpoint/restore tools like CRIU, which should be able to migrate processes across machines with heterogeneous FPU capabilities. Note that portability is generally limited to CPUs from the same vendor (e.g., Intel vs. AMD) due to potential differences in xstate layouts. Signed-off-by: Andrei Vagin --- Documentation/arch/x86/xstate.rst | 14 ++++++++++++-- arch/x86/include/uapi/asm/sigcontext.h | 10 ++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Documentation/arch/x86/xstate.rst b/Documentation/arch/x86/xstate.rst index cec05ac464c1..e27e779bae44 100644 --- a/Documentation/arch/x86/xstate.rst +++ b/Documentation/arch/x86/xstate.rst @@ -170,5 +170,15 @@ are extended to control the guest permission: is going to be rejected. So, the permission has to be requested before the first VCPU creation. -Note that some VMMs may have already established a set of supported state -components. These options are not presumed to support any particular VMM. +Signal Frame Portability +------------------------ + +The signal frame is designed to be self-describing and portable. This is +especially important for checkpoint/restore tools like CRIU, which may restore +a process on a different host than where it was checkpointed. A signal frame +created on a machine with fewer CPU features can be successfully restored on a +machine with more CPU features. + +Note that signal frame portability is generally guaranteed only between CPUs +from the same vendor. Different vendors may use different offsets for the same +xstate features in the xsave area, making frames incompatible between them. diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h index d0d9b331d3a1..3ea63c29c3d7 100644 --- a/arch/x86/include/uapi/asm/sigcontext.h +++ b/arch/x86/include/uapi/asm/sigcontext.h @@ -34,6 +34,16 @@ * fpstate+extended_size-FP_XSTATE_MAGIC2_SIZE address) is set to * FP_XSTATE_MAGIC2 so that you can sanity check your size calculations.) * + * The xstate_size field indicates the actual size of the xstate context + * (including the fxregs_state and xstate_header). This size is used in + * conjunction with the fpstate pointer to locate FP_XSTATE_MAGIC2. This makes + * the signal frame self-describing and portable: a signal frame created on a + * machine with a certain set of xstate features can be restored on a machine + * with a different (larger) set of features, as long as the latter supports + * all features present in the frame. Note that this portability is generally + * limited to CPUs of the same vendor, as different vendors may use different + * xstate layouts. + * * This extended area typically grows with newer CPUs that have larger and * larger XSAVE areas. */ -- 2.54.0.1032.g2f8565e1d1-goog