Re: [PATCH v2 02/58] objtool/klp: Check the klp test environment once, before any test
From: sashiko-bot@kernel.org
Date: 2026-09-14 06:37:46
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] Tool existence checks for READELF, OBJCOPY, and LD will fail if these variables contain CLI arguments, incorrectly aborting the test suite. -- commit 2ddfaa45c9b45195802f915e9ca42e1e7b224f4b Author: Song Liu [off-list ref] objtool/klp: Check the klp test environment once, before any test This commit adds a preflight check to evaluate the objtool test environment once before the test suite runs. It exports the environment answers and fails the entire run if prerequisites are missing, rather than skipping tests individually.
quoted hunk ↗ jump to hunk
diff --git a/tools/objtool/tests/lib.sh b/tools/objtool/tests/lib.sh index 714371232fa30..6e4e54b108659 100644 --- a/tools/objtool/tests/lib.sh +++ b/tools/objtool/tests/lib.sh
[ ... ]
+klp_preflight()
+{
+ local tmp tool cc_version host cc_arch
+
+ bail() { echo "Bail out! $*" >&2; exit 1; }[ ... ]
+ command -v "${CC%% *}" >/dev/null || bail "compiler not found: $CC"
+
+ for tool in "$READELF" "$OBJCOPY" "$LD"; do
+ command -v "$tool" >/dev/null || bail "$tool not found"
+ done
[Severity: Low]
Will this check fail if the toolchain variables contain CLI arguments?
Unlike the compiler check just above it which correctly uses parameter
expansion to strip arguments (`${CC%% *}`), passing the full string to
`command -v` when it contains spaces (e.g., if a developer or CI system
overrides `OBJCOPY="llvm-objcopy --target=arm64"`) will cause `command -v`
to treat the entire string as a single binary name and fail.
Could this incorrectly abort the test suite under valid configurations?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260914062514.926997-1-song@kernel.org?part=2