From: Pratyush Yadav <pratyush@kernel.org>
To: Pasha Tatashin <pasha.tatashin@soleen.com>,
Mike Rapoport <rppt@kernel.org>,
Pratyush Yadav <pratyush@kernel.org>,
Shuah Khan <shuah@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Usama Arif <usama.arif@linux.dev>
Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-mm@kvack.org
Subject: [PATCH v3 0/6] selftests/liveupdate: add memfd tests
Date: Sat, 4 Apr 2026 10:24:43 +0000 [thread overview]
Message-ID: <20260404102452.4091740-1-pratyush@kernel.org> (raw)
From: "Pratyush Yadav (Google)" <pratyush@kernel.org>
Hi,
This series adds some tests for memfd preservation across a live update.
Currently memfd is only tested indirectly via luo_kexec_simple or
luo_multi_session. Add a dedicated test suite for it.
Patches 1 and 2 are preparatory, adding base framework and helpers, and
the other patches each add a test. Some of the code is taken from the
libluo patches [0] I sent a while ago.
[0] https://lore.kernel.org/linux-mm/20250723144649.1696299-33-pasha.tatashin@soleen.com/
Changes in v3:
- Retry on EINTR instead of giving up in read_size() and write_size().
- Use O_TRUNC in save_test_data().
- Return the value of write_size() directly in create_random_memfd(). No
need to check errno since write_size() already returns -errno.
- Save errno before calling close() in create_random_memfd() to avoid
overwriting the value.
- Use memcmp() instead of open-coding the comparison loop.
- Return value of test_harness_run() from main().
Changes in v2:
- Drop LIVEUPDATE_DEV since it isn't used.
- Split luo_fd and stage declaration on separate lines.
- Split all 2-stage tests into helper function for each test.
- Fix wording and argument order when LUO_DEVICE fails to open.
- Rename verify_fd_content() to verify_fd_content_read().
- Advance buffer pointer in {read,write}_size().
- Add a check to make sure current working directory is not on a tmpfs
mount. If so, skip the tests since saved data files will be lost.
- Rename RANDOM_DATA_FILE and RANDOM_DATA_FILE_FALLOCATE to
MEMFD_DATA_FS_COPY and FALLOCATE_DATA_FS_COPY respectively. Also
update the file names to reflect this naming convention.
- Collect R-bys.
Regards,
Pratyush Yadav
Pratyush Yadav (Google) (6):
selftests/liveupdate: add framework for memfd tests
selftests/liveupdate: add helper functions for memfd tests
selftests/liveupdate: add test for memfd content preservation
selftests/liveupdate: add test for zero-size memfd preservation
selftests/liveupdate: add test for operations on a preserved memfd
selftests/liveupdate: add fallocate test for memfd
tools/testing/selftests/liveupdate/Makefile | 2 +
.../testing/selftests/liveupdate/luo_memfd.c | 355 ++++++++++++++++++
.../selftests/liveupdate/luo_test_utils.c | 191 +++++++++-
.../selftests/liveupdate/luo_test_utils.h | 10 +
4 files changed, 557 insertions(+), 1 deletion(-)
create mode 100644 tools/testing/selftests/liveupdate/luo_memfd.c
base-commit: 98ddd87f9704ef2fc837ec2ca38877c364d8dada
--
2.53.0.1213.gd9a14994de-goog
next reply other threads:[~2026-04-04 10:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-04 10:24 Pratyush Yadav [this message]
2026-04-04 10:24 ` [PATCH v3 1/6] selftests/liveupdate: add framework for memfd tests Pratyush Yadav
2026-04-04 10:24 ` [PATCH v3 2/6] selftests/liveupdate: add helper functions " Pratyush Yadav
2026-04-04 17:53 ` Zhu Yanjun
2026-04-05 7:34 ` Pratyush Yadav
2026-04-05 16:30 ` Zhu Yanjun
2026-04-04 10:24 ` [PATCH v3 3/6] selftests/liveupdate: add test for memfd content preservation Pratyush Yadav
2026-04-04 10:24 ` [PATCH v3 4/6] selftests/liveupdate: add test for zero-size memfd preservation Pratyush Yadav
2026-04-04 10:24 ` [PATCH v3 5/6] selftests/liveupdate: add test for operations on a preserved memfd Pratyush Yadav
2026-04-04 10:24 ` [PATCH v3 6/6] selftests/liveupdate: add fallocate test for memfd Pratyush Yadav
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=20260404102452.4091740-1-pratyush@kernel.org \
--to=pratyush@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pasha.tatashin@soleen.com \
--cc=rppt@kernel.org \
--cc=shuah@kernel.org \
--cc=usama.arif@linux.dev \
/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