From: sashiko-bot@kernel.org
To: "Joe Lawrence" <joe.lawrence@redhat.com>, live-patching@vger.kernel.org
Cc: "Petr Mladek" <pmladek@suse.com>,
"Josh Poimboeuf" <jpoimboe@kernel.org>,
"Miroslav Benes" <mbenes@suse.cz>,
"Yafang Shao" <laoar.shao@gmail.com>,
"Song Liu" <song@kernel.org>
Subject: Re: [RFC PATCH v2 6/7] livepatch/klp-build: add pre-built object support for advanced OOT workflows
Date: Wed, 26 Aug 2026 20:01:18 +0000 [thread overview]
Message-ID: <20260826200119.486511F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260826195000.455905-7-joe.lawrence@redhat.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
New issues:
- [Medium] The newly introduced `--symvers` option breaks standard and `--oot-dir` builds when provided with a relative path, and it fails to override the `$PWD/Module.symvers` validation check for `--oot-dir` builds.
- [Medium] The `--show-first-changed` (`-f`) option is silently ignored in the pre-built object workflow.
Pre-existing issues:
- [High] Arbitrary command execution via maliciously crafted filenames containing Make functions in pre-built object directories.
--
commit f9d7e858a4afcd50869696d974b4dd56100b6cf0
Author: Joe Lawrence <joe.lawrence@redhat.com>
Subject: livepatch/klp-build: add pre-built object support for advanced OOT workflows
This commit introduces `--orig-dir` and `--patched-dir` options to klp-build,
allowing users to supply pre-built original and patched objects directly
rather than relying on internal build stages. It performs binary comparison,
symbol extraction, and livepatch module assembly using these pre-built objects.
> diff --git a/scripts/livepatch/klp-build b/scripts/livepatch/klp-build
> index b60f5a5da31e8..e118f133e923c 100755
> --- a/scripts/livepatch/klp-build
> +++ b/scripts/livepatch/klp-build
[ ... ]
> @@ -456,7 +486,19 @@ validate_patches() {
> do_init() {
> [[ ! "$PWD" -ef "$SCRIPT_DIR/../.." ]] && die "please run from the kernel root directory"
>
> - if [[ -n "$OOT_DIR" ]]; then
> + if [[ -n "$USER_ORIG_DIR" ]]; then
> + [[ -d "$USER_ORIG_DIR" ]] || die "directory not found: $USER_ORIG_DIR"
> + [[ -d "$USER_PATCHED_DIR" ]] || die "directory not found: $USER_PATCHED_DIR"
> + USER_ORIG_DIR="$(realpath "$USER_ORIG_DIR")"
> + USER_PATCHED_DIR="$(realpath "$USER_PATCHED_DIR")"
> + if [[ -n "$SYMVERS_PATH" ]]; then
> + SYMVERS_PATH="$(realpath "$SYMVERS_PATH")"
> + [[ -f "$SYMVERS_PATH" ]] || die "Module.symvers not found: $SYMVERS_PATH"
> + else
> + [[ -f "$PWD/Module.symvers" ]] ||
> + die "no Module.symvers in $PWD; use --symvers to specify"
> + fi
> + elif [[ -n "$OOT_DIR" ]]; then
[Severity: Medium]
Will this leave `SYMVERS_PATH` as an unexpanded relative path when used with
`--oot-dir` or standard builds, since the `realpath` conversion is nested
inside the `--orig-dir` conditional branch?
Also, in the `elif [[ -n "$OOT_DIR" ]];` branch that follows, there is a check
for `[[ -f "$PWD/Module.symvers" ]]`.
Does this fail to respect the provided `SYMVERS_PATH` during OOT
initialization and enforce validation on the hardcoded `$PWD/Module.symvers`,
preventing alternative paths?
[ ... ]
> @@ -757,7 +804,11 @@ diff_objects() {
> cmd+=("klp")
> cmd+=("diff")
> (( ${#opts[@]} > 0 )) && cmd+=("${opts[@]}")
> - [[ -n "$OOT_DIR" ]] && cmd+=("--symvers" "$PWD/Module.symvers")
> + if [[ -n "$SYMVERS_PATH" ]]; then
> + cmd+=("--symvers" "$SYMVERS_PATH")
[Severity: Medium]
If `SYMVERS_PATH` remains a relative path from the issue above, will this
command fail when it is executed from the `$ORIG_CSUM_DIR` subshell?
[ ... ]
> @@ -931,11 +982,54 @@ build_patch_module() {
> }
>
>
> +setup_oot() {
> + local files=()
> + local rel
> +
> + mkdir -p "$ORIG_DIR" "$PATCHED_DIR"
> +
> + find "$USER_ORIG_DIR" -type f -name "*.o" -printf '%P\n' | mapfile -t files
[Severity: High]
This is a pre-existing issue, but this pipeline ingests user-supplied
filenames from the pre-built object directories without sanitization.
Later in build_patch_module(), these filenames are written directly into the
generated Kbuild file target list:
echo -n " $rel_file" >> "$makefile"
Can this allow arbitrary command execution via maliciously crafted filenames
containing Make functions (e.g., `$(shell command).o`) when processing untrusted
pre-built objects?
[ ... ]
> + status "Building patch module: $OUTFILE"
> + build_patch_module
> +
> + status "SUCCESS"
> + exit 0
> +fi
> +
[Severity: Medium]
Because this block executes the pre-built workflow and exits immediately,
doesn't it fully bypass the `diff_checksums` hook?
Will this silently ignore the `--show-first-changed` (`-f`) option in the
pre-built object workflow?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260826195000.455905-1-joe.lawrence@redhat.com?part=6
next prev parent reply other threads:[~2026-08-26 20:01 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 19:49 [RFC PATCH v2 0/7] klp-build: OOT module support Joe Lawrence
2026-08-26 19:49 ` [RFC PATCH v2 1/7] objtool/klp: simplify read_exports file handling Joe Lawrence
2026-08-26 23:31 ` Song Liu
2026-08-26 19:49 ` [RFC PATCH v2 2/7] objtool/klp: add --symvers option to klp diff Joe Lawrence
2026-08-26 23:31 ` Song Liu
2026-08-26 19:49 ` [RFC PATCH v2 3/7] objtool/klp: allow special section entry size overrides Joe Lawrence
2026-08-27 19:17 ` Josh Poimboeuf
2026-08-26 19:49 ` [RFC PATCH v2 4/7] objtool: add target architecture to usage Joe Lawrence
2026-08-26 19:57 ` sashiko-bot
2026-08-27 19:23 ` Josh Poimboeuf
2026-08-26 19:49 ` [RFC PATCH v2 5/7] livepatch/klp-build: add basic out-of-tree module support Joe Lawrence
2026-08-26 20:00 ` sashiko-bot
2026-08-27 21:21 ` Josh Poimboeuf
2026-08-26 19:49 ` [RFC PATCH v2 6/7] livepatch/klp-build: add pre-built object support for advanced OOT workflows Joe Lawrence
2026-08-26 20:01 ` sashiko-bot [this message]
2026-08-27 21:45 ` Josh Poimboeuf
2026-08-26 19:50 ` [RFC PATCH v2 7/7] livepatch/klp-build: add validation for user-supplied OOT objects Joe Lawrence
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260826200119.486511F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=joe.lawrence@redhat.com \
--cc=jpoimboe@kernel.org \
--cc=laoar.shao@gmail.com \
--cc=live-patching@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=pmladek@suse.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=song@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox