add support for replacing section syms for unbundled sections

Right now, the test patch unnecessarily includes hrtimer_nanosleep()
because the call to do_nanosleep() generates a rela the references the
unbundled .sched.text section.  This section symbol is not currently
replaced by kpatch_replace_sections_syms() as it only replaces bundled
sections symbols.

This commit adds logic to kpatch_replace_sections_syms() to replace
unbundled section symbols as well by scanning the symbol table for
symbols that start at the rela entry's offset within the matching
section.

This allows for properly rela section correlation when the functions
have moved from an unbundled section to a bundled section.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
This commit is contained in:
Seth Jennings 2014-07-28 11:08:52 -05:00
parent 8ac20f5475
commit ebf55f8614

View File

@ -939,7 +939,9 @@ void kpatch_replace_sections_syms(struct kpatch_elf *kelf)
*/
if (strcmp(rela->sym->name, ".data..percpu") &&
strcmp(rela->sym->name, ".data..read_mostly") &&
strcmp(rela->sym->name, ".data.unlikely"))
strcmp(rela->sym->name, ".data.unlikely") &&
!(rela->sym->type == STT_SECTION && rela->sym->sec &&
(rela->sym->sec->sh.sh_flags & SHF_EXECINSTR)))
continue;
list_for_each_entry(sym, &kelf->symbols, list) {