]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
kunit: tool: copy caller args in run_kernel to prevent mutation
authorShuvam Pandey <shuvampandey1@gmail.com>
Thu, 26 Feb 2026 15:29:10 +0000 (21:14 +0545)
committerShuah Khan <skhan@linuxfoundation.org>
Mon, 2 Mar 2026 17:02:06 +0000 (10:02 -0700)
commit40804c4974b8df2adab72f6475d343eaff72b7f6
tree22dce1959618475831674051ea0d9b08a2f07623
parent7dd34dfc8dfa92a7244242098110388367996ac3
kunit: tool: copy caller args in run_kernel to prevent mutation

run_kernel() appended KUnit flags directly to the caller-provided args
list. When exec_tests() calls run_kernel() repeatedly (e.g. with
--run_isolated), each call mutated the same list, causing later runs
to inherit stale filter_glob values and duplicate kunit.enable flags.

Fix this by copying args at the start of run_kernel(). Add a regression
test that calls run_kernel() twice with the same list and verifies the
original remains unchanged.

Fixes: ff9e09a3762f ("kunit: tool: support running each suite/test separately")
Signed-off-by: Shuvam Pandey <shuvampandey1@gmail.com>
Reviewed-by: David Gow <david@davidgow.net>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/kunit/kunit_kernel.py
tools/testing/kunit/kunit_tool_test.py