Re: [PATCH 2/2] kernel: add support for live patching
From: Vojtech Pavlik
Date: Thu Nov 06 2014 - 13:25:06 EST
On Thu, Nov 06, 2014 at 10:20:49AM -0600, Seth Jennings wrote:
> Yes, I should explain it.
>
> This is something that is currently only used in the kpatch approach.
> It allows the patching core to do dynamic relocations on the new
> function code, similar to what the kernel module linker does, but this
> works for non-exported symbols as well.
>
> This is so the patch module doesn't have to do a kallsyms lookup on
> every non-exported symbol that the new functions use.
>
> The fields of the dynrela structure are those of a normal ELF rela
> entry, except for the "external" field, which conveys information about
> where the core module should go looking for the symbol referenced in the
> dynrela entry.
>
> Josh was under the impression that Vojtech was ok with putting the
> dynrela stuff in the core. Is that not correct (misunderstanding)?
Yes, that is correct, as obviously the kpatch way of generating patches
by extracting code from a compiled kernel would not be viable without
it.
For our own kGraft usage we're choosing to compile patches from C
source, and there we can simply replace the function calls by calls via
pointer looked up through kallsyms.
However, kGraft also has tools to create patches in an automated way,
where the individual functions are extracted from the compiled patched
kernel using a modified objopy and this is hitting exactly the same
issue of having to do relocation of unexported symbols if any are
referenced.
So no objection to the idea. We'll have to look more into the code to
comment on the implementation of the dynrela stuff.
--
Vojtech Pavlik
Director SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/