From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oa1-f74.google.com (mail-oa1-f74.google.com [209.85.160.74]) (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 605533BB137 for ; Thu, 4 Jun 2026 16:56:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780592170; cv=none; b=oyYSqqznQDTKvdllET13nIBpRbEBpUClFPAq22GXjHr5BNCoV2XsKERgSsfkixS2NYgVyhSxnS4EgTlL3BYNAVCbcrzmWCARExL1pnWoesevZD71r0sOEbjFC8OCR46CYboopu/ZjqOyAQc4/2g7lrkimcBmIRTMCiI+nrTE7+4= 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=lWmNtRPP; arc=none smtp.client-ip=209.85.160.74 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="lWmNtRPP" Received: by mail-oa1-f74.google.com with SMTP id 586e51a60fabf-43b7d6f0d56so1673588fac.1 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=vger.kernel.org; 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=lWmNtRPPDkAv/u9oXiSkGTAu965S+TCwJawXvzAN64aityXnIdfGcJBru+kAEMI94n eG3D5jaoWlJt9zq5qOFZKcWe9WLI+Xg/VmWLjtLYJOA/YiBac4Ecv0DQ6IqA1PLeAR0a 5jR+JXAjgJYfMxPejpaa/THZiz4ieezyL5NulZFUOwcuTqzU2L8KGe/Jui8uIl1icu72 LuJc99eUoD1567vFZQthp/I/l1cuoyxf8ct5jIY7q07dABNQhApVMw/XaMLocyXBmzNn tzS4ebmvE4wV7tEBcEyotK701vBBETrzPeNa8x56gu+D4ph3kout8yAypjXgkPsqL6DM Svzg== 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=Ayeg2giC3hxT4JPJzYJbqvn+w/NaBQJkoVT4sivQlYxk1ujmDilRj9epuzSuddqT7f kp0JqlXGvrIfSLq25iZA4pgqokEJVkID4DPwptmR8weigRuvmKZlSfDrbkXW4Wz6mFch rypQ0/jOWXzE75qounAxbxT69CkygGc/mwrYq/c5ES9KOKUG29TJuDU7hA2eKD/plGGu 6CAEV0//zYrsgOjoaqXIAZ0kWQ5/e7VQOhgEUq4SvU8ePxyLqdxzD4I3C5csjQMxEP0M vX7dydzX3AKZvqWVf9SfgEhSFilaen5OxIS3+1/jIrs1MLSdzrnVzmqtFqmsTDVVjoK8 D1NQ== X-Gm-Message-State: AOJu0Yzfg9MaL4vLdJD59m803GJ3Wqlba88eeLzBgWkmRLR8S4H2LjJ4 IgRmfPQ4ocMc+gEvKh2Pxke00CDOz09H5riKZqbUe+WXif90U6S8eFXoBAId+TfTYUppKTeIZad MF5uRrg== 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: linux-kernel@vger.kernel.org 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