* [PATCH blktests v2] nvme/071: add multipath command effects log lifetime test
@ 2026-09-23 1:35 Yao Sang
2026-10-30 8:25 ` Shin'ichiro Kawasaki
0 siblings, 1 reply; 2+ messages in thread
From: Yao Sang @ 2026-09-23 1:35 UTC (permalink / raw)
To: shinichiro.kawasaki; +Cc: dwagner, linux-block, Yao Sang
Add a regression test for kernel commit b2461c48db87 ("nvme: fix command
effects log lifetime for multipath heads").
Create a subsystem with two controller paths, remove the first controller,
and issue an I/O passthrough command through the namespace-head character
device. On affected kernels, the head still references the removed
controller's command effects log, and KASAN reports a use-after-free.
Signed-off-by: Yao Sang <sangyao@kylinos.cn>
---
Changes since v1:
- Reference the kernel fix in the commit message and test header.
- Use set_conditions() to run for the configured transports instead of
forcing loop.
- Rebase on current blktests master and renumber nvme/070 to nvme/071.
The KASAN requirement is retained, as agreed in review.
v1: https://lore.kernel.org/linux-block/20260814070019.3860097-1-sangyao@kylinos.cn/
tests/nvme/071 | 59 ++++++++++++++++++++++++++++++++++++++++++++++
tests/nvme/071.out | 2 ++
2 files changed, 61 insertions(+)
create mode 100755 tests/nvme/071
create mode 100644 tests/nvme/071.out
diff --git a/tests/nvme/071 b/tests/nvme/071
new file mode 100755
index 0000000..6df76af
--- /dev/null
+++ b/tests/nvme/071
@@ -0,0 +1,59 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2026 Yao Sang <sangyao@kylinos.cn>
+#
+# Regression test for kernel commit b2461c48db87 ("nvme: fix command effects
+# log lifetime for multipath heads").
+
+. tests/nvme/rc
+
+DESCRIPTION="test NVMe multipath command effects log lifetime"
+QUICK=1
+CHECK_DMESG=1
+
+requires() {
+ _nvme_requires
+ _have_loop
+ _have_module_param_value nvme_core multipath Y
+ _have_kernel_options KASAN
+}
+
+set_conditions() {
+ _set_nvme_trtype "$@"
+}
+
+test() {
+ echo "Running ${TEST_NAME}"
+
+ local first_ctrl
+ local ngdev
+ local ns
+ local nsid
+ local -a ports
+
+ _setup_nvmet
+ _nvmet_target_setup --ports 2
+
+ _get_nvmet_ports "${def_subsysnqn}" ports
+
+ _nvme_connect_subsys --port "${ports[0]}"
+ first_ctrl=$(_find_nvme_dev "${def_subsysnqn}")
+
+ _nvme_connect_subsys --port "${ports[1]}"
+
+ ns=$(_find_nvme_ns "${def_subsys_uuid}")
+ nsid=$(cat "/sys/block/${ns}/nsid")
+ ngdev="${ns/nvme/ng}"
+
+ _nvme_disconnect_ctrl "${first_ctrl}"
+
+ if ! nvme io-passthru "/dev/${ngdev}" --opcode 0 \
+ --namespace-id "${nsid}" >> "${FULL}" 2>&1; then
+ echo "io-passthru failed"
+ fi
+
+ _nvme_disconnect_subsys >> "${FULL}" 2>&1
+ _nvmet_target_cleanup
+
+ echo "Test complete"
+}
diff --git a/tests/nvme/071.out b/tests/nvme/071.out
new file mode 100644
index 0000000..146809b
--- /dev/null
+++ b/tests/nvme/071.out
@@ -0,0 +1,2 @@
+Running nvme/071
+Test complete
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH blktests v2] nvme/071: add multipath command effects log lifetime test
2026-09-23 1:35 [PATCH blktests v2] nvme/071: add multipath command effects log lifetime test Yao Sang
@ 2026-10-30 8:25 ` Shin'ichiro Kawasaki
0 siblings, 0 replies; 2+ messages in thread
From: Shin'ichiro Kawasaki @ 2026-10-30 8:25 UTC (permalink / raw)
To: Yao Sang; +Cc: dwagner, linux-block
On Sep 23, 2026 / 09:35, Yao Sang wrote:
> Add a regression test for kernel commit b2461c48db87 ("nvme: fix command
> effects log lifetime for multipath heads").
>
> Create a subsystem with two controller paths, remove the first controller,
> and issue an I/O passthrough command through the namespace-head character
> device. On affected kernels, the head still references the removed
> controller's command effects log, and KASAN reports a use-after-free.
>
> Signed-off-by: Yao Sang <sangyao@kylinos.cn>
Thanks for the v2 patch, and sorry for my slow response. I applied it. Please
note that I renumbered the test case to nvme/075, and fixed the relevant kernel
commit's git hash.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-30 8:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-23 1:35 [PATCH blktests v2] nvme/071: add multipath command effects log lifetime test Yao Sang
2026-10-30 8:25 ` Shin'ichiro Kawasaki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox