Re: [PATCH 18/48] klp-build: Fix hang on out-of-date .config

Josh Poimboeuf
2026-04-28T15:57:05Z

On Fri, Apr 24, 2026 at 02:51:54PM -0700, Song Liu wrote:
> On Wed, Apr 22, 2026 at 9:04 PM Josh Poimboeuf <jpoimboe@kernel.org> wrote:
> >
> > If .config is out of date with the kernel source, 'make syncconfig'
> > hangs while waiting for user input on new config options. Detect the
> > mismatch and return an error.
> >
> > Fixes: 6f93f7b06810 ("livepatch/klp-build: Fix inconsistent kernel version")
> > Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
> > ---
> > scripts/livepatch/klp-build | 7 ++++++-
> > 1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/scripts/livepatch/klp-build b/scripts/livepatch/klp-build
> > index 0ad7e6631314..81b35fc10877 100755
> > --- a/scripts/livepatch/klp-build
> > +++ b/scripts/livepatch/klp-build
> > @@ -306,7 +306,12 @@ set_kernelversion() {
> >
> > stash_file "$file"
> >
> > - kernelrelease="$(cd "$SRC" && make syncconfig &>/dev/null && make -s kernelrelease)"
> > + if [[ -n "$(make -s listnewconfig 2>/dev/null)" ]]; then
> > + die ".config mismatch, check your .config or run 'make olddefconfig'"
> > + fi
> > + make syncconfig &>/dev/null || die "make syncconfig failed"
> > +
> > + kernelrelease="$(cd "$SRC" && make -s kernelrelease)"
>
> Do we really need cd "$SRC" here? If so, we need it before
> all the make commands, right?

Yeah, the "$SRC" thing is a half-hearted implementation throughout, with
the idea of eventually having the sourcedir outside of $PWD, and/or
building the object files in a separate directory. That's confusing,
I'll just strip all that out for now.

--
Josh