[kpatch] missing removal of changed_objs

Josh Poimboeuf jpoimboe at redhat.com
Fri Jul 22 15:13:01 UTC 2016


On Fri, Jul 22, 2016 at 09:24:30AM -0400, Martin Carroll wrote:
> Hello,
> 
> There is what appears to me to be a glaring bug in the kbuild-patch script.
> Immediately after the script builds the original kernel, the following line
> should appear (but does not):
> 
>      >$TEMPDIR/changed_objs
> 
> Without that line, the script goes on to die with a bogus "invalid ancestor"
> error. If you turn those bogus errors into warnings, then the script goes on
> to incorrectly put into the generated .ko file every single function that
> was compiled in the *original* kernel build, thereby producing an immense
> .ko file with more than 64k sections that the linux kernel cannot load.
> 
> Adding the above line fixes everything. Indeed, the description in README.md
> of how kpatch-build works implies that the above line has to be present in
> the kpatch-build script.
> 
> Fascinatingly enough, I have poked around through the git history and I
> cannot find the above line present in any earlier commit state. (I also
> cannot find a mention of this issue in the mail archives, although I might
> have missed it.) So I am wondering, how in the world does this script work
> for all of you?

Any chance you made some changes to the code base?  It should work
because of the following line in kpatch-gcc:

if [[ -z "$TEMPDIR" ]]; then
	exec "$TOOLCHAINCMD" "$@"
fi

When the original kernel is built, TEMPDIR hasn't been exported yet.  So
kpatch-gcc skips its special logic to create changed_objs and copy the
changed objects.

(I admit this is all kind of magical and could definitely use some
cleanup to make it more obvious what's going on.)

-- 
Josh




More information about the kpatch mailing list