Re: [PATCH v3 0/9] klp-convert livepatch build tooling
From: Joe Lawrence
Date: Tue Apr 16 2019 - 09:37:42 EST
On 4/16/19 1:24 AM, Balbir Singh wrote:
Could we get some details with examples or a sample, sorry I might be dense
and missing simple information. The problem being solved is not clear to
me from the changelog.
Hi Balbir,
I see that Miroslav has already pointed to documentation, samples and
self-tests for the patchset, but here is a summary in my own words:
kpatch-build constructs livepatch kernel modules by comparing a
reference build with a patched build, combing through ELF object
sections and extracting new and changed sections that include patched code.
An alternative approach is "source-based", in which a livepatch kernel
module is built (mostly entirely) using the kernel's build
infrastructure. Sources for a livepatch are gathered ahead of time and
then built like an ordinary kernel module.
In either approach, there lies the problem of symbol visibility: how can
a livepatch resolve symbols that a kernel module ordinarily can't. For
example, file local or simply unexported symbols in across the kernel
and other modules. Enter the concept of "livepatch symbols" described
in module-elf-format.txt.
kpatch-build already creates such "livepatch symbols" (see its
create_klp_relasecs_and_syms()) and the livepatching core kernel code
already knows how resolve such symbols at klp_object patch time (see
klp_write_object_relocations()).
The klp-convert tool and this supporting patchset would empower
source-based-constructed livepatch modules to do the same.
-- Joe