aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Lawrence <joe.lawrence@redhat.com>2019-07-29 11:34:41 -0400
committerMasahiro Yamada <yamada.masahiro@socionext.com>2019-08-15 23:33:53 +0900
commit4f52037e0c85998601cafe5c6843b11063203514 (patch)
treec694854aa0e407106ae7b8f14ce41738bf53eb74
parenta8f41063159cdd4d2265a29a4e3209b5763d5296 (diff)
downloadlinux-kbuild-klp-cleanup.tar.gz
livepatch/klp-convert: abort on special sectionsklp-cleanup
To properly convert alternatives, paravirt ops, and static keys, klp-convert needs to implement "klp.arch" sections as supported by d4c3e6e1b193 (“livepatch/x86: apply alternatives and paravirt patches after relocations”). There is some amount of ELF section bookkeeping required for this (ie, moving data structure entries and relocations to their ".klp.arch" equivalents) but the hardest part will be determining klp_object relationships. This may require some larger changes to livepatch API, so defer support for now. Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
-rw-r--r--scripts/livepatch/klp-convert.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/livepatch/klp-convert.c b/scripts/livepatch/klp-convert.c
index abf050f8ec52ab..2e59c6da1e876a 100644
--- a/scripts/livepatch/klp-convert.c
+++ b/scripts/livepatch/klp-convert.c
@@ -617,6 +617,18 @@ static void free_converted_resources(struct elf *klp_elf)
}
}
+/* Check for special sections that klp-convert doesn't support */
+static bool is_section_supported(char *sname)
+{
+ if (strcmp(sname, ".rela.altinstructions") == 0)
+ return false;
+ if (strcmp(sname, ".rela.parainstructions") == 0)
+ return false;
+ if (strcmp(sname, ".rela__jump_table") == 0)
+ return false;
+ return true;
+}
+
int main(int argc, const char **argv)
{
const char *klp_in_module, *klp_out_module, *symbols_list;
@@ -649,6 +661,12 @@ int main(int argc, const char **argv)
}
list_for_each_entry_safe(sec, aux, &klp_elf->sections, list) {
+ if (!is_section_supported(sec->name)) {
+ WARN("Special ELF section: %s not supported",
+ sec->name);
+ return -1;
+ }
+
if (!is_rela_section(sec) ||
is_klp_rela_section(sec->name))
continue;