From: sashiko-bot@kernel.org
To: live-patching@vger.kernel.org
Cc: "Petr Mladek" <pmladek@suse.com>,
"Miroslav Benes" <mbenes@suse.cz>,
"Josh Poimboeuf" <jpoimboe@kernel.org>,
"Song Liu" <song@kernel.org>
Subject: Re: [RFC 4/4] livepatch/klp-build: add basic out-of-tree module patching support
Date: Thu, 14 May 2026 21:20:47 +0000 [thread overview]
Message-ID: <20260514212048.5431CC2BCB3@smtp.kernel.org> (raw)
In-Reply-To: <20260512221102.2720763-5-joe.lawrence@redhat.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The script hardcodes the temporary directory (klp-tmp) and default output file to the kernel root directory ($PWD), which breaks building out-of-tree modules against read-only system headers.
- [Medium] The commit message incorrectly states that 'make modules_prepare' is sufficient to prepare the kernel tree for out-of-tree patching.
--
commit c21e20dbe33c0ce1976f54b57ae6fc8cea53b65b
Author: Joe Lawrence <joe.lawrence@redhat.com>
livepatch/klp-build: add basic out-of-tree module patching support
This commit introduces a module-dir option to klp-build to support
generating livepatches for out-of-tree kernel modules. It performs two
builds of the out-of-tree module to generate the original and patched
objects.
> klp-build is currently limited to patching in-tree kernel modules.
> Introduce a -M/--module-dir option to enable livepatch generation for
> basic out-of-tree (OOT) modules. This requires the associated kernel
> tree to be pre-configured (e.g., 'make modules_prepare').
The commit message states that running 'make modules_prepare' is
sufficient to prepare the tree. Is this description accurate?
Looking at do_init(), the script explicitly checks for Module.symvers:
[[ -f "$PWD/Module.symvers" ]] ||
die "kernel must be built first (no Module.symvers in $PWD)"
Running 'make modules_prepare' on a clean kernel source tree prepares
configuration and headers but does not generate Module.symvers.
Could the commit message be updated to clarify that a full build is
required?
> diff --git a/scripts/livepatch/klp-build b/scripts/livepatch/klp-build
> index c4a7acf8edc3f..aef3b47db4f24 100755
> --- a/scripts/livepatch/klp-build
> +++ b/scripts/livepatch/klp-build
[ ... ]
> @@ -433,8 +451,6 @@ validate_patches() {
> }
>
> do_init() {
> - # We're not yet smart enough to handle anything other than in-tree
> - # builds in pwd.
> [[ ! "$PWD" -ef "$SCRIPT_DIR/../.." ]] && die "please run from the kernel root directory"
[ ... ]
> + if [[ -n "$MODULE_DIR" ]]; then
> + [[ -d "$MODULE_DIR" ]] || die "module directory not found: $MODULE_DIR"
> + MODULE_DIR="$(realpath "$MODULE_DIR")"
> + [[ -f "$MODULE_DIR/Kbuild" || -f "$MODULE_DIR/Makefile" ]] ||
> + die "no Kbuild or Makefile in $MODULE_DIR"
> + [[ -f "$PWD/Module.symvers" ]] ||
> + die "kernel must be built first (no Module.symvers in $PWD)"
> + fi
> +
> (( SHORT_CIRCUIT <= 1 )) && rm -rf "$TMP_DIR"
> mkdir -p "$TMP_DIR"
Does creating the temporary directory in the kernel root directory cause
permission regressions when building out-of-tree modules?
Out-of-tree modules are often built against system-installed kernel headers,
which are typically read-only for standard users. Since the script mandates
running from the kernel root directory, creating the temporary working
directory and default output file inside the present working directory will
cause permission denied errors.
Could the script use the module directory or a user-specified path for
temporary files and the default output instead?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260512221102.2720763-1-joe.lawrence@redhat.com?part=4
next prev parent reply other threads:[~2026-05-14 21:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 22:10 [RFC 0/4] klp-build: simple OOT module support Joe Lawrence
2026-05-12 22:10 ` [RFC 1/4] objtool/klp: add --symvers option to klp diff Joe Lawrence
2026-05-14 20:47 ` sashiko-bot
2026-05-12 22:11 ` [RFC 2/4] objtool/klp: allow special section entry size overrides Joe Lawrence
2026-05-14 20:58 ` sashiko-bot
2026-05-12 22:11 ` [RFC 3/4] objtool/klp: add --arch option to display target architecture Joe Lawrence
2026-05-14 21:10 ` sashiko-bot
2026-05-12 22:11 ` [RFC 4/4] livepatch/klp-build: add basic out-of-tree module patching support Joe Lawrence
2026-05-14 21:20 ` sashiko-bot [this message]
2026-05-12 23:30 ` [RFC 0/4] klp-build: simple OOT module support Song Liu
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=20260514212048.5431CC2BCB3@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=jpoimboe@kernel.org \
--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.