Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] selftests: regex flaw silently excludes submodule from test assertions --
commit d0e8e8cb940b9b06248942fb57c7a41c66ad8636 Author: Jim Cromie <[email protected]> selftests/dyndbg: Enable FT_classmap_inheritance Exercise classmap state inheritance between supermod and submod, verifying that class settings and controlling parameter states propagate from parent classmap definitions to dependent class users upon module load and during runtime reconfiguration. > diff --git a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh > b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh > index c279c795867b6..d759243a4cbe7 100755 > --- a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh > +++ b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh [ ... ] > @@ -291,6 +292,78 @@ function FT_basic_queries { > ddcmd "file $f =_" "$f" > } > > +function FT_classmap_inheritance { [ ... ] > + # Real-time mathematical proof that load-time (modprobe) parameter > parsing > + # and runtime (sysfs write) parameter configurations are perfectly > equivalent! > + local hash_modprobe=$(slice_and_hash_ddctrl '\[test_dynamic_debug*\]') [Severity: Medium] Does this regex fail to match the sub-module as intended? Looking at FT_classmap_inheritance(), it calls slice_and_hash_ddctrl() which uses grep to filter output. In POSIX Basic Regular Expressions (BRE), the * quantifier matches zero or more occurrences of the preceding character (g). This means the regex matches [test_dynamic_debug] but demands that the bracket ] immediately follows the g's. It completely fails to match [test_dynamic_debug_submod], silently excluding the sub-module from the load-time test assertions. > + > + # Fresh load with default parameters, then configure them dynamically at > runtime > + ifrmmod test_dynamic_debug_submod > + ifrmmod test_dynamic_debug > + my_modprobe test_dynamic_debug > + my_modprobe test_dynamic_debug_submod > + echo 0x16 > /sys/module/test_dynamic_debug/parameters/p_disjoint_bits > + echo 5 > /sys/module/test_dynamic_debug/parameters/p_level_num > + > + local hash_sysfs=$(slice_and_hash_ddctrl '\[test_dynamic_debug*\]') [Severity: Medium] Similar to the issue above, does this regex fail to capture the runtime state of the sub-module? This allows the equivalence check between hash_modprobe and hash_sysfs to pass without actually verifying the sub-module inheritance behavior. > + if [ "$hash_modprobe" != "$hash_sysfs" ]; then > + echo -e "${RED}: Load-time vs runtime parameter equivalence check > failed!${NC}" > + exit $ksft_fail -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=23
