From: Tarun Sahu <tarunsahu@google.com>
To: Andrew Morton <akpm@linux-foundation.org>,
joro@8bytes.org, Mike Rapoport <rppt@kernel.org>,
Pratyush Yadav <pratyush@kernel.org>,
maz@kernel.org, arnd@arndb.de,
David Matlack <dmatlack@google.com>,
jgg@nvidia.com, robin.murphy@arm.com, loganodell@google.com,
oupton@kernel.org, kevin.tian@intel.com, alex@shazbot.org,
dwmw2@infradead.org, pbonzini@redhat.com, seanjc@google.com,
will@kernel.org, Pasha Tatashin <pasha.tatashin@soleen.com>,
Alexander Graf <graf@amazon.com>,
Bjorn Helgaas <bhelgaas@google.com>,
baolu.lu@linux.intel.com
Cc: linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org,
sagis@google.com, linux-mm@kvack.org, kvmarm@lists.linux.dev,
iommu@lists.linux.dev, linux-pci@vger.kernel.org,
kexec@lists.infradead.org, skhawaja@google.com,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Tarun Sahu <tarunsahu@google.com>
Subject: [RFC PATCH v2 0/4] liveupdate: Feature header ABI and named handler
Date: Wed, 21 Oct 2026 15:25:23 +0000 [thread overview]
Message-ID: <20261021152527.375070-1-tarunsahu@google.com> (raw)
Live Update Orchestrator (LUO) and its file handlers currently validate
handed-over KHO state using monolithic compatibility strings ("luo-v5",
"memfd-v2"). Any change to a serialized structure, even an optional
additive field, requires bumping the compatibility string, breaking live
update between adjacent kernel versions across both forward updates and
rollbacks. This series introduces the feature flags per serialized
struct to communicate between the kernel about their active and required
features. Having feature flags increase the compatibility matching
granularity.
This series also renames the file-handler and FLB compatible identifier to
name, extends LIVEUPDATE_SESSION_PRESERVE_FD so userspace can
optionally select which registered file handler preserves a file
descriptor by name, and replaces monolithic version strings in serialized
payloads with a fixed-size 2-bit pair feature header
(struct luo_feature_hdr). So in future, If a change to a subsystem
preservation can not be handled with feature flags, we can attach a new
handler to support the preservation.
This change is motivated by the LPC discussion.
Named File Handler Selection
============================
With fine-grained compatibility tracked via feature headers, the
handler and FLB compatible field is renamed to name. When a subsystem
needs a genuinely incompatible new handler alongside an existing one for
the same file type, struct liveupdate_session_preserve_fd now includes
char handler[LIVEUPDATE_HNDL_NAME_LENGTH] after token (keeping
min_size at 16 bytes for backward compatibility):
- Empty handler (or 16-byte struct): selects the first registered
handler whose .can_preserve() accepts the fd, keeping default callers
on the original rollback-safe handler.
- Non-empty handler: selects the registered handler with that exact
name and verifies .can_preserve() accepts the fd.
2-Bit Pair Feature Header (struct luo_feature_hdr)
==================================================
Each serialized ABI structure (struct luo_ser, struct memfd_luo_ser)
starts with a fixed 128-byte struct luo_feature_hdr containing:
- size: byte size of the enclosing serialized structure from the source
kernel.
- flags[15]: 15 chained 64-bit feature flags entries. Each entry
encodes up to 31 features as 2-bit pair (req, active) states
(enum luo_feat_state: LUO_FEAT_DISABLED = 0b00,
LUO_FEAT_OPTIONAL = 0b01, LUO_FEAT_REQUIRED = 0b11) plus
LUO_FEAT_EXT_MASK (bits[63:62] = 0b11) chaining to the next entry
(up to 465 features total). Because the header is fixed at 128 bytes,
payload field offsets never shift when extended flags entries are used.
Each subsystem defines its feature states as a static const u8 array
indexed by its feature enum, which luo_feature_hdr_init() packs into
the payload feature header. During deserialization,
luo_feature_hdr_validate() checks the header from the source kernel
against the feature array in the target kernel according to the
per-feature (req, active) truth table:
Source Target Action
(1,0) (x,x) Reject -EINVAL: invalid source kernel (req without active)
(x,x) (1,0) Reject -EINVAL + WARN_ON_ONCE: invalid target kernel
(0,0) (0,0) Accept: feature absent
(0,0) (0,1) Accept: feature absent
(0,0) (1,1) Reject -EOPNOTSUPP: target kernel requires the feature
(0,1) (0,0) Accept: ignore payload data
(1,1) (0,0) Reject -EOPNOTSUPP: source kernel requires the feature
(x,1) (x,1) Accept: use payload data
Structure Evolution
===================
The relative order and offsets of fields in serialized structures must
remain unchanged as features are added or retired. New fields are always
appended at the end of the structure under a new feature flag, and
retired fields are kept in place so that the offsets of subsequent
fields never shift. If the type or format of a field needs to change,
the existing field and feature are kept intact (and retired when no
longer needed) and a new feature flag with a new appended field of the
new type is added.
In the target kernel, fields of a LUO_FEAT_REQUIRED feature are
guaranteed to be present once luo_feature_hdr_validate() succeeds,
whereas fields of a LUO_FEAT_OPTIONAL feature should be accessed only
after verifying that the feature is active in the source kernel header:
if (luo_feature_is_active(&ser->features, FEAT_X))
val = ser->x_field;
Changes since RFC v1 [1]:
- Renamed file-handler and FLB compatible to name and added optional
handler selection by name in LIVEUPDATE_SESSION_PRESERVE_FD.
- Replaced the 3-mask (supp, req, active) + variable-length FDT and
feature-section design with a fixed 128-byte struct luo_feature_hdr
embedding size and 15 chained 64-bit 2-bit pair (req, active)
flags entries directly in struct luo_ser and struct memfd_luo_ser.
- Replaced compile-time bitmask macros with a static const u8 feature
array per subsystem packed by luo_feature_hdr_init() and validated
in a single pass by luo_feature_hdr_validate().
[1] https://lore.kernel.org/all/20260903023452.721732-1-loganodell@google.com/
Tarun Sahu (4):
liveupdate: Rename handler compatible to name
liveupdate: Select file handler by name in the preserve ioctl
liveupdate: Replace compatibility string with a 2-bit pair feature
header
mm: memfd_luo: Add the 2-bit pair feature header
drivers/pci/liveupdate.c | 10 +-
include/linux/kho/abi/luo.h | 367 +++++++++++++++++++++++++++----
include/linux/kho/abi/memfd.h | 39 +++-
include/linux/kho/abi/pci.h | 2 +-
include/linux/liveupdate.h | 18 +-
include/uapi/linux/liveupdate.h | 15 +-
kernel/liveupdate/luo_core.c | 27 ++-
kernel/liveupdate/luo_file.c | 64 ++++--
kernel/liveupdate/luo_flb.c | 16 +-
kernel/liveupdate/luo_internal.h | 3 +-
kernel/liveupdate/luo_session.c | 7 +-
lib/tests/liveupdate.c | 22 +-
mm/memfd_luo.c | 16 +-
13 files changed, 481 insertions(+), 125 deletions(-)
--
2.56.0.212.g129ede20d9-goog
next reply other threads:[~2026-10-21 15:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-21 15:25 Tarun Sahu [this message]
2026-10-21 15:25 ` [RFC PATCH v2 1/4] liveupdate: Rename handler compatible to name Tarun Sahu
2026-10-21 15:25 ` [RFC PATCH v2 2/4] liveupdate: Select file handler by name in the preserve ioctl Tarun Sahu
2026-10-21 15:25 ` [RFC PATCH v2 3/4] liveupdate: Replace compatibility string with a 2-bit pair feature header Tarun Sahu
2026-10-21 15:25 ` [RFC PATCH v2 4/4] mm: memfd_luo: Add the " Tarun Sahu
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=20261021152527.375070-1-tarunsahu@google.com \
--to=tarunsahu@google.com \
--cc=akpm@linux-foundation.org \
--cc=alex@shazbot.org \
--cc=arnd@arndb.de \
--cc=baolu.lu@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=dmatlack@google.com \
--cc=dwmw2@infradead.org \
--cc=graf@amazon.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@nvidia.com \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=kexec@lists.infradead.org \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-pci@vger.kernel.org \
--cc=loganodell@google.com \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=pasha.tatashin@soleen.com \
--cc=pbonzini@redhat.com \
--cc=pratyush@kernel.org \
--cc=robin.murphy@arm.com \
--cc=rppt@kernel.org \
--cc=sagis@google.com \
--cc=seanjc@google.com \
--cc=skhawaja@google.com \
--cc=will@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®