liveupdate: list all file handler versions in vmlinux section
Pratyush Yadav
maintainerRFC PATCH 1/1 liveupdate: list all file handler versions in vmlinux section
As live update evolves, there will be a need to update the serialization formats for the different file types. This could be for adding new features, for supporting a change in behaviour, or to fix bugs.
If the current kernel does not understand the same set of versions as the next kernel, live update will inevitably fail. The next kernel will be unable to understand the handed over data and will be unable to restore memory, devices, IOMMU page tables, etc.
List the set of versions the kernel understands in a section in vmlinux. This can then be used by userspace tooling to make sure the set of file descriptors it uses have the same version between both kernels. If there is a mismatch, the tooling can catch this early and abort live update before it is too late.
The versions are listed in a section called ".liveupdate_versions". The section has a header that contains a magic number and the version of the data format. The list of version strings directly follow this header. Only the version strings are listed, and it is up to userspace to map them to file descriptor types.
The format of the section has the same ABI rules as the rest of LUO ABI.
Introduce a LIVEUPDATE_FILE_HANDLER macro that makes it easy to define a file handler while also adding its version string to the right section.
---
Notes:
I also wrote a small tool [0] to parse this section and list all the versions it contains to demonstrate how it can be used.
This topic will also be discussed at an upcoming session at the Linux Plumbers Conference 2025 [1].
[0] https://github.com/prati0100/luo_section_parser
[1] https://lpc.events/event/19/contributions/2049/
include/asm-generic/vmlinux.lds.h | 12 +++++++++++ include/linux/kho/abi/luo.h | 34 +++++++++++++++++++++++++++++++ include/linux/liveupdate.h | 23 +++++++++++++++++++++ kernel/liveupdate/luo_core.c | 14 +++++++++++++ mm/memfd_luo.c | 6 ++---- 5 files changed, 85 insertions(+), 4 deletions(-)
include/asm-generic/vmlinux.lds.h +12 -0
@@ -342,6 +342,17 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELLER_CLANG)#define THERMAL_TABLE (name)#endif +#ifdef CONFIG_LIVEUPDATE +#define LIVEUPDATE_VERSIONS \ + . = ALIGN(8); \ + .liveupdate_versions : AT(ADDR(.liveupdate_versions) - LOAD_OFFSET) { \ + KEEP(*(.liveupdate_sec_hdr)) \ + KEEP(*(.liveupdate_versions)) \ + } +#else +#define LIVEUPDATE_VERSIONS +#endif +#define KERNEL_DTB () \ STRUCT_ALIGN(); \ __dtb_start = .; \
@@ -544,6 +555,7 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELLER_CLANG)RO_EXCEPTION_TABLE \ NOTES \BTF \ +LIVEUPDATE_VERSIONS \ \ . = ALIGN((align)); \ __end_rodata = .;
include/linux/kho/abi/luo.h +34 -0
@@ -244,4 +244,38 @@ struct luo_flb_ser {#define LIVEUPDATE_TEST_FLB_COMPATIBLE (i) "liveupdate-test-flb-v" #i#endif +#define LIVEUPDATE_VER_HDR_MAGIC 0x4c565550/* 'LVUP' */ +#define LIVEUPDATE_VER_HDR_VER 1 + +/** +* struct liveupdate_ver_hdr - Header of vmlinux section with version lists +* @magic: Magic number. +* @version: Version of the header format. +* +* This struct is the header for the vmlinux section ".liveupdate_versions". The +* section contains the list of file handler versions that the kernel can +* support. +*/ +struct liveupdate_ver_hdr { +u32 magic; +u32 version; +}; + +/** +* struct liveupdate_ver_table - Table of file handler versions that the kernel +* can support. +* +* @hdr: Table header. +* @versions: List of versions the kernel supports. The strings ate +* NUL-terminated, but to keep the format simpler always take up +* LIVEUPDATE_HNDL_COMPAT_LENGTH bytes. +* +* The list of versions immediately follows the header. The number of versions +* are determined by section length. +*/ +struct liveupdate_ver_table { +struct liveupdate_ver_hdr hdr; +char versions[][LIVEUPDATE_HNDL_COMPAT_LENGTH ]; +}; +#endif /* _LINUX_KHO_ABI_LUO_H */
include/linux/liveupdate.h +23 -0
@@ -212,6 +212,29 @@ struct liveupdate_flb {struct luo_flb_private __private private; }; +#define LIVEUPDATE_SEC_VERSION (_name, _ver) \ + static const char __ ## _name ## _vers[LIVEUPDATE_HNDL_COMPAT_LENGTH] \ + __used __section(".liveupdate_versions") \ + __aligned(1) = _ver + +/** +* LIVEUPDATE_FILE_HANDLER - Define a live update file handler. +* @_name: The name for the variable. +* @_compatible: The compatible string for the file handler. +* @ops: The file handler operations. +* +* Defines a struct liveupdate_file_handler called _name. It also makes sure the +* compatible of the handler gets added to the liveupdate versions section. All +* file handler must be defined using this macro. +*/ +#define LIVEUPDATE_FILE_HANDLER (_name, _compatible, _ops) \ + static struct liveupdate_file_handler _name = {\ + .compatible = _compatible, \ + .ops = _ops, \ + }; \ + \ + LIVEUPDATE_SEC_VERSION(_name, _compatible) +#ifdef CONFIG_LIVEUPDATE /* Return true if live update orchestrator is enabled */
kernel/liveupdate/luo_core.c +14 -0
@@ -62,6 +62,20 @@#include "kexec_handover_internal.h" #include "luo_internal.h" +/* +* This is the header for the ".liveupdate_versions" section in vmlinux. See +* struct liveupdate_ver_table for more info. The linker makes sure that the +* this header precedes the compatibles added by LIVEUPDATE_FILE_HANDLER(). +*/ +static const struct liveupdate_ver_hdr ver_hdr + __used __section(".liveupdate_sec_hdr") __aligned(8) = { + .magic = LIVEUPDATE_VER_HDR_MAGIC, + .version =LIVEUPDATE_VER_HDR_VER , +}; + +/* Also list the LUO core version. */ +LIVEUPDATE_SEC_VERSION (luo_ver,LUO_FDT_COMPATIBLE ); + static struct { bool enabled; void *fdt_out;
mm/memfd_luo.c +2 -4
@@ -495,10 +495,8 @@ static const struct liveupdate_file_ops memfd_luo_file_ops = { .owner = THIS_MODULE, }; -static struct liveupdate_file_handler memfd_luo_handler = { - .ops = &memfd_luo_file_ops, - .compatible =MEMFD_LUO_FH_COMPATIBLE , -}; +LIVEUPDATE_FILE_HANDLER (memfd_luo_handler,MEMFD_LUO_FH_COMPATIBLE , + &memfd_luo_file_ops);static int __init memfd_luo_init (void ) {
Signature · 1 line
2.43.0
Alexander Graf
reviewerHi Pratyush,
Quoted 21 lines · Pratyush Yadav
As live update evolves, there will be a need to update the serialization formats for the different file types. This could be for adding new features, for supporting a change in behaviour, or to fix bugs.
If the current kernel does not understand the same set of versions as the next kernel, live update will inevitably fail. The next kernel will be unable to understand the handed over data and will be unable to restore memory, devices, IOMMU page tables, etc.
List the set of versions the kernel understands in a section in vmlinux. This can then be used by userspace tooling to make sure the set of file descriptors it uses have the same version between both kernels. If there is a mismatch, the tooling can catch this early and abort live update before it is too late.
The versions are listed in a section called ".liveupdate_versions". The section has a header that contains a magic number and the version of the data format. The list of version strings directly follow this header. Only the version strings are listed, and it is up to userspace to map them to file descriptor types.
Quoted 6 lines
The format of the section has the same ABI rules as the rest of LUO ABI.
Introduce a
LIVEUPDATE_FILE_HANDLERmacro that makes it easy to define a file handler while also adding its version string to the right section.Signed-off-by Pratyush Yadav <[email protected]>
To support multi-version preservation and resume, how about you add a "profile" hint to the handlers? Then you can tag the handlers with "current" and a "previous". You then expose one section table with supported versions per profile. And that means you can from user space select the local profile to serialize and match that against the target profile of the target system.
It also allows you to support more "profiles", such as elaborate downstream version combinations, that upstream will not have to care about.
Alex
Amazon Web Services Development Center Germany GmbH Tamara-Danz-Str. 13
10243 Berlin
Geschaeftsfuehrung: Christof Hellmis, Andreas Stieger Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B
Sitz: Berlin
Ust-ID: DE 365 538 597
Pratyush Yadav
maintainerQuoted 31 lines · Alexander Graf
Hi Pratyush,
Quoted 21 lines · Pratyush Yadav
As live update evolves, there will be a need to update the serialization formats for the different file types. This could be for adding new features, for supporting a change in behaviour, or to fix bugs.
If the current kernel does not understand the same set of versions as the next kernel, live update will inevitably fail. The next kernel will be unable to understand the handed over data and will be unable to restore memory, devices, IOMMU page tables, etc.
List the set of versions the kernel understands in a section in vmlinux. This can then be used by userspace tooling to make sure the set of file descriptors it uses have the same version between both kernels. If there is a mismatch, the tooling can catch this early and abort live update before it is too late.
The versions are listed in a section called ".liveupdate_versions". The section has a header that contains a magic number and the version of the data format. The list of version strings directly follow this header. Only the version strings are listed, and it is up to userspace to map them to file descriptor types.
Quoted 6 lines
The format of the section has the same ABI rules as the rest of LUO ABI.
Introduce a
LIVEUPDATE_FILE_HANDLERmacro that makes it easy to define a file handler while also adding its version string to the right section.Signed-off-by Pratyush Yadav <[email protected]>
Quoted 8 lines
To support multi-version preservation and resume, how about you add a "profile" hint to the handlers? Then you can tag the handlers with "current" and a "previous". You then expose one section table with supported versions per profile. And that means you can from user space select the local profile to serialize and match that against the target profile of the target system.
It also allows you to support more "profiles", such as elaborate downstream version combinations, that upstream will not have to care about.
So in essence you want to tie the versions into a "version set"? If you want to use a new version even for one component, you would create a new version set.
Interesting idea, but I am curious. Do you see a reason for grouping versions together in this fashion? Why not let each version be changed independently?
Signature · 2 lines
Regards, Pratyush Yadav
Quoted 42 lines · Pratyush Yadav
Quoted 31 lines · Alexander Graf
Hi Pratyush,
Quoted 21 lines · Pratyush Yadav
As live update evolves, there will be a need to update the serialization formats for the different file types. This could be for adding new features, for supporting a change in behaviour, or to fix bugs.
If the current kernel does not understand the same set of versions as the next kernel, live update will inevitably fail. The next kernel will be unable to understand the handed over data and will be unable to restore memory, devices, IOMMU page tables, etc.
List the set of versions the kernel understands in a section in vmlinux. This can then be used by userspace tooling to make sure the set of file descriptors it uses have the same version between both kernels. If there is a mismatch, the tooling can catch this early and abort live update before it is too late.
The versions are listed in a section called ".liveupdate_versions". The section has a header that contains a magic number and the version of the data format. The list of version strings directly follow this header. Only the version strings are listed, and it is up to userspace to map them to file descriptor types.
Quoted 6 lines
The format of the section has the same ABI rules as the rest of LUO ABI.
Introduce a
LIVEUPDATE_FILE_HANDLERmacro that makes it easy to define a file handler while also adding its version string to the right section.Signed-off-by Pratyush Yadav <[email protected]>Quoted 8 lines
To support multi-version preservation and resume, how about you add a "profile" hint to the handlers? Then you can tag the handlers with "current" and a "previous". You then expose one section table with supported versions per profile. And that means you can from user space select the local profile to serialize and match that against the target profile of the target system.
It also allows you to support more "profiles", such as elaborate downstream version combinations, that upstream will not have to care about.
Quoted 7 lines
So in essence you want to tie the versions into a "version set"? If you want to use a new version even for one component, you would create a new version set.
Interesting idea, but I am curious. Do you see a reason for grouping versions together in this fashion? Why not let each version be changed independently?
I don't quite get the point either..
I think the ELF annotations are intended to give information to the userspace, but ultimately I think we should just rely on the userspace to implement anything complicated about compatibility policy.
We also have the issue that not all versions *at runtime* are going to be supportable. Older versions may be information loosing and cannot be emitted based on the current system configuration.
So to really make this work you have to dynamically query the current kernel, and cross that with the elf data from the next and try to cobble together a working set.
IMHO most likely real users are going to want to latch onto fixed "profiles" and globally bump the profile cluster wide along with activating VMMs to consume new features enabled by the newer versions.
There may be an early churn when we bump versions because we are messing things up, but the long term steady state will probably be new version = required if new features were used by the VMM
Thus the version used for serializing and the features active in the VMMs should be linked together by the operator.
Jason
Quoted 73 lines · On Thu, Dec 11, 2025 at 01:26:22PM +0900 Pratyush Yadav wrote:
As live update evolves, there will be a need to update the serialization formats for the different file types. This could be for adding new features, for supporting a change in behaviour, or to fix bugs.
If the current kernel does not understand the same set of versions as the next kernel, live update will inevitably fail. The next kernel will be unable to understand the handed over data and will be unable to restore memory, devices, IOMMU page tables, etc.
List the set of versions the kernel understands in a section in vmlinux. This can then be used by userspace tooling to make sure the set of file descriptors it uses have the same version between both kernels. If there is a mismatch, the tooling can catch this early and abort live update before it is too late.
The versions are listed in a section called ".liveupdate_versions". The section has a header that contains a magic number and the version of the data format. The list of version strings directly follow this header. Only the version strings are listed, and it is up to userspace to map them to file descriptor types.
The format of the section has the same ABI rules as the rest of LUO ABI.
Introduce a
LIVEUPDATE_FILE_HANDLERmacro that makes it easy to define a file handler while also adding its version string to the right section.Signed-off-by Pratyush Yadav <[email protected]>---
include/asm-generic/vmlinux.lds.h +12
-0@@ -342,6 +342,17 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELLER_CLANG)#define THERMAL_TABLE (name)#endif +#ifdef CONFIG_LIVEUPDATE +#define LIVEUPDATE_VERSIONS \ + . = ALIGN(8); \ + .liveupdate_versions : AT(ADDR(.liveupdate_versions) - LOAD_OFFSET) { \ + KEEP(*(.liveupdate_sec_hdr)) \ + KEEP(*(.liveupdate_versions)) \ + } +#else +#define LIVEUPDATE_VERSIONS +#endif +#define KERNEL_DTB () \ STRUCT_ALIGN(); \ __dtb_start = .; \@@ -544,6 +555,7 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELLER_CLANG)RO_EXCEPTION_TABLE \ NOTES \BTF \ +LIVEUPDATE_VERSIONS \ \ . = ALIGN((align)); \ __end_rodata = .;include/linux/kho/abi/luo.h +6
-0@@ -244,4 +244,38 @@ struct luo_flb_ser {#define LIVEUPDATE_TEST_FLB_COMPATIBLE (i) "liveupdate-test-flb-v" #i#endif +#define LIVEUPDATE_VER_HDR_MAGIC 0x4c565550/* 'LVUP' */ +#define LIVEUPDATE_VER_HDR_VER 1 + +/** +* struct liveupdate_ver_hdr - Header of vmlinux section with version lists +* @magic: Magic number.
include/linux/kho/abi/luo.h struct luo_flb_ser { · line 262
Quoted 10 lines
include/linux/kho/abi/luo.h +10
-0+* @version: Version of the header format. +* +* This struct is the header for the vmlinux section ".liveupdate_versions". The +* section contains the list of file handler versions that the kernel can +* support. +*/ +struct liveupdate_ver_hdr { +u32 magic; +u32 version; +};
I believe we are going to have two main classes of LUO objects that are going to participate in Liveupdates, when it comes to their criticality
- Core/Mandatory components. Theese components are necessary for the kexec to be succesfull. Think components like IOMMU page tables, as you have mentioned.
- Acceleration/Optional Components. As we strive to minimise the blackout time, we will trying to persist more and more state across kexec, that are currently being initialised from scratch during boot. Thing of certain optimisation like PCI onboarding (at least parts of it) and the PCI Config Space Cache. If theese components are incompatible between versions, we might still want to proceed, with the LU, at the cost of increased blackout time.
I believe it will be quite usefull to be able to have the ability to differentiate between the two.
Quoted 21 lines
include/linux/kho/abi/luo.h +18
-0+ +/** +* struct liveupdate_ver_table - Table of file handler versions that the kernel +* can support. +* +* @hdr: Table header. +* @versions: List of versions the kernel supports. The strings ate +* NUL-terminated, but to keep the format simpler always take up +* LIVEUPDATE_HNDL_COMPAT_LENGTH bytes. +* +* The list of versions immediately follows the header. The number of versions +* are determined by section length. +*/ +struct liveupdate_ver_table { +struct liveupdate_ver_hdr hdr; +char versions[][LIVEUPDATE_HNDL_COMPAT_LENGTH ]; +}; +Signature · 1 line
2.43.0
Kind Regards,
Evangelos
Amazon Web Services Development Center Germany GmbH Tamara-Danz-Str. 13
10243 Berlin
Geschaeftsfuehrung: Christof Hellmis, Andreas Stieger Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B
Sitz: Berlin
Ust-ID: DE 365 538 597
Pratyush Yadav
maintainerQuoted 100 lines · Evangelos Petrongonas
Quoted 73 lines · On Thu, Dec 11, 2025 at 01:26:22PM +0900 Pratyush Yadav wrote:
As live update evolves, there will be a need to update the serialization formats for the different file types. This could be for adding new features, for supporting a change in behaviour, or to fix bugs.
If the current kernel does not understand the same set of versions as the next kernel, live update will inevitably fail. The next kernel will be unable to understand the handed over data and will be unable to restore memory, devices, IOMMU page tables, etc.
List the set of versions the kernel understands in a section in vmlinux. This can then be used by userspace tooling to make sure the set of file descriptors it uses have the same version between both kernels. If there is a mismatch, the tooling can catch this early and abort live update before it is too late.
The versions are listed in a section called ".liveupdate_versions". The section has a header that contains a magic number and the version of the data format. The list of version strings directly follow this header. Only the version strings are listed, and it is up to userspace to map them to file descriptor types.
The format of the section has the same ABI rules as the rest of LUO ABI.
Introduce a
LIVEUPDATE_FILE_HANDLERmacro that makes it easy to define a file handler while also adding its version string to the right section.Signed-off-by Pratyush Yadav <[email protected]>---
include/asm-generic/vmlinux.lds.h +12
-0@@ -342,6 +342,17 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELLER_CLANG)#define THERMAL_TABLE (name)#endif +#ifdef CONFIG_LIVEUPDATE +#define LIVEUPDATE_VERSIONS \ + . = ALIGN(8); \ + .liveupdate_versions : AT(ADDR(.liveupdate_versions) - LOAD_OFFSET) { \ + KEEP(*(.liveupdate_sec_hdr)) \ + KEEP(*(.liveupdate_versions)) \ + } +#else +#define LIVEUPDATE_VERSIONS +#endif +#define KERNEL_DTB () \ STRUCT_ALIGN(); \ __dtb_start = .; \@@ -544,6 +555,7 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELLER_CLANG)RO_EXCEPTION_TABLE \ NOTES \BTF \ +LIVEUPDATE_VERSIONS \ \ . = ALIGN((align)); \ __end_rodata = .;include/linux/kho/abi/luo.h +6
-0@@ -244,4 +244,38 @@ struct luo_flb_ser {#define LIVEUPDATE_TEST_FLB_COMPATIBLE (i) "liveupdate-test-flb-v" #i#endif +#define LIVEUPDATE_VER_HDR_MAGIC 0x4c565550/* 'LVUP' */ +#define LIVEUPDATE_VER_HDR_VER 1 + +/** +* struct liveupdate_ver_hdr - Header of vmlinux section with version lists +* @magic: Magic number. include/linux/kho/abi/luo.h struct luo_flb_ser { · line 262
Quoted 10 lines
include/linux/kho/abi/luo.h +10
-0+* @version: Version of the header format. +* +* This struct is the header for the vmlinux section ".liveupdate_versions". The +* section contains the list of file handler versions that the kernel can +* support. +*/ +struct liveupdate_ver_hdr { +u32 magic; +u32 version; +};I believe we are going to have two main classes of LUO objects that are going to participate in Liveupdates, when it comes to their criticality
- Core/Mandatory components. Theese components are necessary for the kexec to be succesfull. Think components like IOMMU page tables, as you have mentioned.
- Acceleration/Optional Components. As we strive to minimise the blackout time, we will trying to persist more and more state across kexec, that are currently being initialised from scratch during boot. Thing of certain optimisation like PCI onboarding (at least parts of it) and the PCI Config Space Cache. If theese components are incompatible between versions, we might still want to proceed, with the LU, at the cost of increased blackout time.
Quoted 2 lines
I believe it will be quite usefull to be able to have the ability to differentiate between the two.
I agree that it would be useful. But I've been thinking about this for a bit. I think it will be hard for the kernel to judge what is a mandatory component and what is an optional one. There might be some setups where you would deem some PCI devices as mandatory and some as optional. I don't think we should even try to encode that kind of policy in the kernel.
So I think we need a UAPI for userspace to tell us what is mandatory. That is more UAPI exposure. Dunno if now is the right time to take that, before we know more how this works out in practice...
[...]
Signature · 2 lines
Regards, Pratyush Yadav