Re: [RFC PATCH 6/6] selftests/liveupdate: add tmpfs kexec test

From: sashiko-bot

Date: Wed Sep 23 2026 - 19:14:52 EST


Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] selftests/liveupdate: luo_kexec_tmpfs fails on persistent rootfs
--

commit 656981de91db4b31da49ddcf77d65f446841090b
Author: Pratyush Yadav (Google) <pratyush@xxxxxxxxxx>

selftests/liveupdate: add tmpfs kexec test

This commit adds a two-stage kexec test for tmpfs preservation. The first
stage creates a tmpfs mount, creates a file, and preserves both. The second
stage retrieves both and verifies the contents.

> diff --git a/tools/testing/selftests/liveupdate/luo_kexec_tmpfs.c b/tools/testing/selftests/liveupdate/luo_kexec_tmpfs.c
> new file mode 100644
> index 0000000000000..608a6eddbd7ba
> --- /dev/null
> +++ b/tools/testing/selftests/liveupdate/luo_kexec_tmpfs.c
[ ... ]
> +/* Stage 1: Executed before the kexec reboot. */
> +static void run_stage_1(int luo_fd)
> +{
[ ... ]
> + ksft_print_msg("[STAGE 1] Mounting tmpfs at %s...\n", TMPFS_DIR);
> + if (mkdir(TMPFS_DIR, 0755) < 0)
> + fail_exit("mkdir %s", TMPFS_DIR);

[Severity: Medium]
Will this fail on test re-runs if the directory is left behind from a prior
run?

> + if (mount("tmpfs", TMPFS_DIR, "tmpfs", 0, NULL) < 0)
> + fail_exit("mount tmpfs at %s", TMPFS_DIR);
[ ... ]
> +/* Stage 2: Executed after the kexec reboot. */
> +static void run_stage_2(int luo_fd, int state_session_fd)
> +{
[ ... ]
> + ksft_print_msg("[STAGE 2] Attaching the restored mount at %s...\n",
> + TMPFS_DIR);
> + if (mkdir(TMPFS_DIR, 0755) < 0)
> + fail_exit("mkdir %s", TMPFS_DIR);

[Severity: Medium]
Will this unconditionally fail with EEXIST in run_stage_2() if the underlying
root filesystem is persistent across kexec?

> + if (move_mount_empty_from(mnt_fd, TMPFS_DIR) < 0)
> + fail_exit("move_mount of the restored mount to %s", TMPFS_DIR);
> + close(mnt_fd);
[ ... ]
> + ksft_print_msg("[STAGE 2] Test data verified successfully.\n");
> + if (luo_session_finish(session_fd) < 0)
> + fail_exit("luo_session_finish for test session");
> + close(session_fd);
> +
> + if (luo_session_finish(state_session_fd) < 0)
> + fail_exit("luo_session_finish for state session");
> + close(state_session_fd);
> +
> + ksft_print_msg("\n--- TMPFS KEXEC TEST PASSED ---\n");
> +}

[Severity: Medium]
Does the test exit successfully here without calling umount() or rmdir() to
clean up the environment? If so, does it leak the /tmpfs directory and its
mount on the host system?

--
Sashiko AI review · https://sashiko.dev/#/patchset/20260923224408.3745689-1-pratyush@xxxxxxxxxx?part=6