[PATCH v4 08/19] kho: block: Add the feature header to blocks
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Tue Nov 10 22:16:39 PST 2026
> Subsystems using the KHO Serialization Blocks framework currently rely
> on whole-structure compatibility strings to validate serialized block
> sets across kexec. Any modification to the block structure layout
> constitutes a breaking change and breaks compatibility between adjacent
> kernels.
>
> Precede struct kho_block_header_ser with struct kho_ser_hdr using
> DECLARE_KHO_SER. Each block in a block set starts with struct
> kho_ser_hdr followed by struct kho_block_header_ser. Serialized entries
> start immediately after the header payload at offset fhdr->size.
> Block capacity is computed as (KHO_BLOCK_SIZE - fhdr->size) /
> bs->entry_size. Subsystems can append future block-level metadata under
> new feature indices without altering existing offsets.
>
> On restore, the location of the first entry and the block capacity no
> longer depend on the caller. They are derived from the header size and
> entry size the source kernel serialized with, even if the target kernel
> structures have a different size. Fields that the source kernel did not
> serialize are absent: a subsystem must not access them unless the
> corresponding feature is present in the incoming header, as doing so
> reads memory outside the serialized data.
>
> During restoration, blocks whose header does not fit the block are
> rejected, and the chain walk stops at such a block. Validate each block
> header and reject unknown required features.
>
> 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/20261110050202.529473-1-tarunsahu@google.com?part=8
More information about the kexec
mailing list