[PATCH v2 0/6] selftests/liveupdate: add memfd tests

Pratyush Yadav posted 6 patches 2 months, 2 weeks ago
There is a newer version of this series
tools/testing/selftests/liveupdate/Makefile   |   2 +
.../testing/selftests/liveupdate/luo_memfd.c  | 355 ++++++++++++++++++
.../selftests/liveupdate/luo_test_utils.c     | 189 +++++++++-
.../selftests/liveupdate/luo_test_utils.h     |  10 +
4 files changed, 555 insertions(+), 1 deletion(-)
create mode 100644 tools/testing/selftests/liveupdate/luo_memfd.c
[PATCH v2 0/6] selftests/liveupdate: add memfd tests
Posted by Pratyush Yadav 2 months, 2 weeks ago
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 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     | 189 +++++++++-
 .../selftests/liveupdate/luo_test_utils.h     |  10 +
 4 files changed, 555 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/liveupdate/luo_memfd.c


base-commit: 98ddd87f9704ef2fc837ec2ca38877c364d8dada
-- 
2.53.0.1213.gd9a14994de-goog
Re: [PATCH v2 0/6] selftests/liveupdate: add memfd tests
Posted by Andrew Morton 2 months, 2 weeks ago
On Fri,  3 Apr 2026 19:40:06 +0000 Pratyush Yadav <pratyush@kernel.org> wrote:

> 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.

Look like a nice series and it comes well-reviewed.  Maybe my "we're
all full" policy-making should have a selftests escape clause...

I see that the malignant gaze of Sauron's eye fell upon your work:
	https://sashiko.dev/#/patchset/20260403194014.3704180-1-pratyush@kernel.org
Re: [PATCH v2 0/6] selftests/liveupdate: add memfd tests
Posted by Pratyush Yadav 2 months, 2 weeks ago
On Fri, Apr 03 2026, Andrew Morton wrote:

> On Fri,  3 Apr 2026 19:40:06 +0000 Pratyush Yadav <pratyush@kernel.org> wrote:
>
>> 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.
>
> Look like a nice series and it comes well-reviewed.  Maybe my "we're
> all full" policy-making should have a selftests escape clause...
>
> I see that the malignant gaze of Sauron's eye fell upon your work:
> 	https://sashiko.dev/#/patchset/20260403194014.3704180-1-pratyush@kernel.org

Nothing escapes His Eye...

It does raise some good points for patch 2. I'll send a v3 shortly. It
would be great if this series can go in with this merge window. Since
these are only minor bugfixes and no fundamental changes, I'll keep the
R-by.

-- 
Regards,
Pratyush Yadav
Re: [PATCH v2 0/6] selftests/liveupdate: add memfd tests
Posted by Pasha Tatashin 2 months, 2 weeks ago
On Fri, Apr 3, 2026 at 6:08 PM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Fri,  3 Apr 2026 19:40:06 +0000 Pratyush Yadav <pratyush@kernel.org> wrote:
>
> > 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.
>
> Look like a nice series and it comes well-reviewed.  Maybe my "we're
> all full" policy-making should have a selftests escape clause...

LOL. I noticed Sashiko is uncharacteristically lenient toward
selftests; I guess it sees a use for them as well.
>
> I see that the malignant gaze of Sauron's eye fell upon your work:
>         https://sashiko.dev/#/patchset/20260403194014.3704180-1-pratyush@kernel.org