From 579ce0dfc674e4a08178aa00b579b22701488e5f Mon Sep 17 00:00:00 2001 From: Ross Lagerwall Date: Wed, 1 Mar 2017 09:03:52 +0000 Subject: [PATCH] create-diff-object: Strip *kpatch_ignore_*_* symbols Strip kpatch_ignore_func_* and __UNIQUE_ID_kpatch_ignore_section_* symbols to prevent the inclusion of .kpatch.ignore.functions and .kpatch.ignore.sections. Mark the symbols as SAME, otherwise they are considered NEW and are recursively included. This includes the corresponding ignore sections and rela sections and may also create new, unnecessary dynrelas. Signed-off-by: Ross Lagerwall --- kpatch-build/create-diff-object.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c index 92ddcc3..ec6c688 100644 --- a/kpatch-build/create-diff-object.c +++ b/kpatch-build/create-diff-object.c @@ -1691,11 +1691,18 @@ static void kpatch_mark_ignored_sections_same(struct kpatch_elf *kelf) sym->status = SAME; } } + + /* strip temporary global __UNIQUE_ID_kpatch_ignore_section_* symbols */ + list_for_each_entry(sym, &kelf->symbols, list) + if (!strncmp(sym->name, "__UNIQUE_ID_kpatch_ignore_section_", + strlen("__UNIQUE_ID_kpatch_ignore_section_"))) + sym->status = SAME; } static void kpatch_mark_ignored_functions_same(struct kpatch_elf *kelf) { struct section *sec; + struct symbol *sym; struct rela *rela; sec = find_section_by_name(&kelf->sections, ".kpatch.ignore.functions"); @@ -1717,6 +1724,12 @@ static void kpatch_mark_ignored_functions_same(struct kpatch_elf *kelf) if (rela->sym->sec->rela) rela->sym->sec->rela->status = SAME; } + + /* strip temporary global kpatch_ignore_func_* symbols */ + list_for_each_entry(sym, &kelf->symbols, list) + if (!strncmp(sym->name, "__kpatch_ignore_func_", + strlen("__kpatch_ignore_func_"))) + sym->status = SAME; } static void kpatch_create_kpatch_arch_section(struct kpatch_elf *kelf, char *objname)