Re: [PATCH v5 7/9] selftests: livepatch: Add provides/obsoletes test scenarios
| Newsgroups | org.kernel.vger.live-patching |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Race condition in test-provides-obsoletes.sh leading to flaky test failures. -- --- Patch [7]: [PATCH v5 7/9] selftests: livepatch: Add provides/obsoletes test scenarios --- commit b45263c641deb4b2b48bbe22a1f0bf862b20a22f Author: Yafang Shao <[email protected]> selftests: livepatch: Add provides/obsoletes test scenarios This commit adds test scenarios for the new provides/obsoletes mechanism in livepatching. It introduces test-provides-obsoletes.sh to verify replacement, coexistence, and obsolete features. > diff --git a/tools/testing/selftests/livepatch/test-provides-obsoletes.sh b/tools/testing/selftests/livepatch/test-provides-obsoletes.sh > new file mode 100755 > index 0000000000000..c740d463f556d > --- /dev/null > +++ b/tools/testing/selftests/livepatch/test-provides-obsoletes.sh [ ... ] > +start_test "provides 0 replaces provides 0" > + > +load_lp $MOD_LIVEPATCH provides=0 > +load_lp $MOD_ATOMIC provides=0 > + > +mods=($SYSFS_KLP_DIR/*) > +nmods=${#mods[@]} > +if [[ "$nmods" -ne 1 ]]; then > + die "Expecting one module listed, found $nmods" > +fi [Severity: Medium] Could this directory check race with the asynchronous sysfs cleanup of the replaced patch? When load_lp returns, it polls until the new patch's sysfs transition file reads '0'. However, in the kernel, klp_try_complete_transition() clears klp_transition_patch before scheduling the asynchronous work to free replaced patches (klp_free_replaced_patches_async). If the test checks the directory count immediately, couldn't it sporadically see the old patch before the async cleanup completes, causing the test to flake with "Expecting one module listed, found 2"? This same pattern appears in the "same provides replaces" and "obsoletes replaces" test cases later in this script. -- Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=7