mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Long Wei <longwei27@huawei.com>
To: <rppt@kernel.org>, <pasha.tatashin@soleen.com>, <pratyush@kernel.org>
Cc: <shuah@kernel.org>, <akpm@linux-foundation.org>,
	<linux-mm@kvack.org>, <kexec@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <linux-kselftest@vger.kernel.org>,
	<hewenliang4@huawei.com>, Long Wei <longwei27@huawei.com>
Subject: [PATCH 0/2] mm: memfd_luo: pick up seals added after preserve at freeze
Date: Sat, 28 Nov 2026 15:24:42 +0800	[thread overview]
Message-ID: <20261128072444.1114964-1-longwei27@huawei.com> (raw)

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


             reply	other threads:[~2026-11-28  7:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-28  7:24 Long Wei [this message]
2026-11-28  7:24 ` [PATCH 1/2] " Long Wei
2026-11-28  7:24 ` [PATCH 2/2] selftests/liveupdate: add seal-after-preserve kexec test Long Wei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261128072444.1114964-1-longwei27@huawei.com \
    --to=longwei27@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=hewenliang4@huawei.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=pasha.tatashin@soleen.com \
    --cc=pratyush@kernel.org \
    --cc=rppt@kernel.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®