[RFC PATCH v3 3/4] mm: memfd_luo: Add the feature header
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Mon Oct 26 10:53:54 PDT 2026
> Precede struct memfd_luo_ser with the 8-byte struct luo_ser_hdr for
> memfd preservation. The source kernel writes the state through struct
> memfd_luo_ser_wrap, declared with DECLARE_LUO_SER_WRAP():
>
> DECLARE_LUO_SER_WRAP(memfd_luo_ser, 64, MEMFD_LUO_FEAT_MAX);
>
> This consists of hdr + memfd_luo_ser (payload).
>
> The existing struct memfd_luo_ser fields (pos, size, seals, flags,
> nr_folios, folios, and MEMFD_LUO_ALL_SEALS) form MEMFD_LUO_FEAT_CORE
> (index 0 of enum memfd_luo_feature). The source kernel marks it as
> LUO_FEAT_REQUIRED when preserving state, and the target kernel marks it
> as supported (true) in its memfd_luo_supported_feats table passed to
> luo_ser_hdr_validate(). Future changes append any new fields to the end
> of struct memfd_luo_ser under a new feature index so existing field
> offsets never shift.
>
> memfd_luo_retrieve() and memfd_luo_finish() validate the incoming header
> against memfd_luo_supported_feats with luo_ser_hdr_validate() before
> accessing any payload field; finish warns and skips discarding the folios
> when the header is invalid.
>
> Prepending the header shifts every field of the serialized memfd state,
> so bump MEMFD_LUO_FH_COMPATIBLE from memfd-v2 to memfd-v3.
>
> Signed-off-by: Logan Odell <loganodell at google.com>
> Signed-off-by: Tarun Sahu <tarunsahu at google.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261026174217.603114-1-tarunsahu@google.com?part=3
More information about the kexec
mailing list