From: sashiko-bot@kernel.org
To: "Joe Lawrence" <joe.lawrence@redhat.com>, live-patching@vger.kernel.org
Cc: "Miroslav Benes" <mbenes@suse.cz>,
"Yafang Shao" <laoar.shao@gmail.com>,
"Josh Poimboeuf" <jpoimboe@kernel.org>,
"Song Liu" <song@kernel.org>, "Petr Mladek" <pmladek@suse.com>
Subject: Re: [RFC PATCH v2 5/7] livepatch/klp-build: add basic out-of-tree module support
Date: Wed, 26 Aug 2026 20:00:37 +0000 [thread overview]
Message-ID: <20260826200038.618EE1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260826195000.455905-6-joe.lawrence@redhat.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The `apply_patch` function omits the `-d` directory option during the actual patch application, failing to apply patches to out-of-tree modules.
- [Medium] Unconditional requirement for `vmlinux` unnecessarily prevents out-of-tree module livepatching against standard distro kernel headers.
--
commit aa6b14041f6a905023bf4d110f2171d49e9e8c84
Author: Joe Lawrence <joe.lawrence@redhat.com>
livepatch/klp-build: add basic out-of-tree module support
klp-build is currently limited to patching in-tree kernel modules.
Introduce a --oot-dir option to enable livepatch generation for basic
out-of-tree (OOT) modules. This requires the associated kernel tree to
be fully built (Module.symvers must exist).
> diff --git a/scripts/livepatch/klp-build b/scripts/livepatch/klp-build
> index b52a8489d9f67..b60f5a5da31e8 100755
> --- a/scripts/livepatch/klp-build
> +++ b/scripts/livepatch/klp-build
[ ... ]
> @@ -377,13 +393,14 @@ apply_patch() {
> local patch="$1"
> shift
> local extra_args=("$@")
> + local patch_target="${OOT_DIR:-$PWD}"
> local drift_regex="with fuzz|offset [0-9]+ line"
> local output
> local status
>
> [[ ! -f "$patch" ]] && die "$patch doesn't exist"
> status=0
> - output=$(patch -p1 --dry-run --no-backup-if-mismatch -r /dev/null "${extra_args[@]}" < "$patch" 2>&1) || status=$?
> + output=$(patch -d "$patch_target" -p1 --dry-run --no-backup-if-mismatch -r /dev/null "${extra_args[@]}" < "$patch" 2>&1) || status=$?
> if [[ "$status" -ne 0 ]]; then
> echo "$output" >&2
> die "$patch did not apply"
[Severity: High]
Does this actual patch application omit the -d directory argument?
It looks like the -d "$patch_target" argument was correctly added to the
dry-run here, but not to the real patch application lower down in
apply_patch():
patch -p1 --no-backup-if-mismatch -r /dev/null "${extra_args[@]}" --silent < "$patch"
When running klp-build --oot-dir <dir> <patch>, won't this attempt to apply
the patch against the kernel root directory instead of the out-of-tree module?
This seems like it would cause the patch application to fail, or erroneously
modify identically-named files in the kernel tree.
[ ... ]
> @@ -597,10 +635,11 @@ copy_orig_objects() {
>
> find_objects | mapfile -t files
>
> + local obj_root="${OOT_DIR:-$PWD}"
> xtrace_save "copying original objects"
> for _file in "${files[@]}"; do
> local rel_file="${_file/.ko/.o}"
> - local file="$PWD/$rel_file"
> + local file="$obj_root/$rel_file"
> local orig_file="$ORIG_DIR/$rel_file"
> local orig_dir="$(dirname "$orig_file")"
>
[Severity: Medium]
Will this script crash for valid out-of-tree module builds against standard
distro kernel headers?
Lower down in copy_orig_objects(), there is an unconditional requirement for
vmlinux to be present:
cp -f "$PWD/vmlinux" "$ORIG_DIR" || die "missing vmlinux"
A primary use case for out-of-tree modules is building against kernel headers
which provide Module.symvers but do not include vmlinux. Since vmlinux is
unused during the object diffing steps for out-of-tree modules, should this
dependency be skipped when running klp-build --oot-dir <dir> <patch> to avoid
unnecessarily preventing livepatching against headers?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260826195000.455905-1-joe.lawrence@redhat.com?part=5
next prev parent reply other threads:[~2026-08-26 20:00 UTC|newest]
Thread overview: 19+ 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-09-10 14:35 ` Miroslav Benes
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-09-10 14:35 ` Miroslav Benes
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 [this message]
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
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=20260826200038.618EE1F00A3A@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.