[PATCH 0/2] mm: memfd_luo: pick up seals added after preserve at freeze
From: Long Wei
Date: Sat Nov 28 2026 - 02:27:31 EST
A seal added to a memfd after the memfd was preserved with a liveupdate
session is accepted without any error, but the seal is silently gone once
the kexec handover is over: the retrieved memfd no longer has it.
memfd_luo_preserve() snapshots the file seals, but userspace may keep
operating on the memfd until the handover, so the preserve-time snapshot
is naturally incomplete. memfd_luo_freeze() never re-read the seals and
memfd_luo_retrieve() replays the stale snapshot, so seals added in the
window between preserve() and kexec were dropped without any notice.
Patch 1 re-reads the seals at freeze time, mirroring the file position
handling: freeze is the last snapshot point before kexec and the only
place where the final value can still be sampled and, when it diverged
from the preserve-time snapshot, validated while the live update can
still be aborted.
Patch 2 adds a kexec round-trip selftest that adds F_SEAL_GROW after
preserve and asserts that the seal survives the handover.
Tested on arm64 and x86_64 with two consecutive kexec handovers each:
with the fix the seal survives and dmesg stays free of new warnings.
This series applies on the current next branch of liveupdate.git,
where the file is still named memfd_luo.c. I am aware of the
pending "mm: Rename memfd_luo to shmem_luo" series. If that series
lands first, a trivial s/memfd_luo/shmem_luo/ rebase will be needed,
which I am happy to provide.
Long Wei (2):
mm: memfd_luo: pick up seals added after preserve at freeze
selftests/liveupdate: add seal-after-preserve kexec test
mm/memfd_luo.c | 27 ++-
tools/testing/selftests/liveupdate/Makefile | 1 +
.../liveupdate/luo_seal_after_preserve.c | 170 ++++++++++++++++++
.../selftests/liveupdate/run-vmtests.sh | 1 +
4 files changed, 197 insertions(+), 2 deletions(-)
create mode 100644 tools/testing/selftests/liveupdate/luo_seal_after_preserve.c
--
2.43.0