MEMFD PRESERVATION VIA LUO(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– Memfd Preservation via LUO πŸ’–

okay so welcome to Memfd Preservation via LUO(9), bestie β€” this is the Kernel API Manual page and it's all about keeping your memfd vibes alive across a kexec. Let's get into it πŸ’…βœ¨


✨ Overview ✨

Memory file descriptors (memfd) can be preserved over a kexec using the Live Update Orchestrator (LUO) file preservation. This allows userspace to transfer its memory contents to the next kernel after a kexec. 🫢πŸ”₯

The preservation is not intended to be transparent. Only select properties of the file are preserved. All others are reset to default. The preserved properties are described below. πŸ‘‘

NOTE: The LUO API is not stabilized yet, so the preserved properties of a memfd are also not stable and are subject to backwards incompatible changes. πŸ’€πŸ˜­
NOTE: Currently a memfd backed by Hugetlb is not supported. Memfds created with MFD_HUGETLB will be rejected. 🚫

πŸ‘‘ Preserved Properties πŸ‘‘

The following properties of the memfd are preserved across kexec:

  • File Contents β€” all data stored in the file is preserved. πŸ’–
  • File Size β€” the size of the file is preserved. Holes in the file are filled by allocating pages for them during preservation. πŸ•³οΈβž‘οΈπŸ“„
  • File Position β€” the current file position is preserved, allowing applications to continue reading/writing from their last position. πŸ“βœ¨
  • File Status Flags β€” memfds are always opened with O_RDWR and O_LARGEFILE. This property is maintained. πŸ”’
  • Seals β€” file seals set on the memfd are preserved and re-applied on restore. Only seals known to this LUO version (see MEMFD_LUO_ALL_SEALS) may be present; preservation fails with -EOPNOTSUPP otherwise. πŸ”

πŸ™ˆ Non-Preserved Properties πŸ™ˆ

All properties which are not preserved must be assumed to be reset to default. This section describes some of those properties which may be more of note. 😭

  • FD_CLOEXEC flag β€” a memfd can be created with the MFD_CLOEXEC flag that sets the FD_CLOEXEC on the file. This flag is not preserved and must be set again after restore via fcntl. 🫠

πŸ”Ž SEE ALSO πŸ”Ž

  • Kernel file: ./mm/memfd_luo.c 🌈

okay bestie that's the whole page, periodt πŸ’– β€” source/version ./mm, dated October 2026, and the manual is Memfd Preservation via LUO(9). slay πŸ«ΆπŸŽ€

πŸ“¦ where this page comes from