kpatch/kpatch-build
Seth Jennings 7dfad2fb76 fix dynrela corruption in load/unload hooks
In kpatch_create_dynamic_rela_sections() the dest field is filled in
with either the function symbol or the section symbol that contains the
function depending on whether or not the sym field of the base section
is NULL or not (around line 2153).

In the case of the hook functions, we strip the FUNC symbol to prevent
it from being added to the kpatch.funcs section as a patched function.
However we weren't unbundling the stripped symbol from the section.
This resulted in the sym field pointing to the null symbol (index 0),
corrupting the dynrelas rela section.

Before:

Relocation section [14] '.rela.kpatch.dynrelas' for section [13] '.kpatch.dynrelas' at offset 0x8b8 contains 6 entries:
  Offset              Type            Value               Addend Name
  000000000000000000  X86_64_64       000000000000000000      +9
  0x0000000000000018  X86_64_64       000000000000000000      +8 .kpatch.strings
  0x0000000000000020  X86_64_64       000000000000000000      +0 .kpatch.strings
  0x0000000000000030  X86_64_64       000000000000000000      +9
  0x0000000000000048  X86_64_64       000000000000000000      +8 .kpatch.strings
  0x0000000000000050  X86_64_64       000000000000000000      +0 .kpatch.strings

This commit unbundles the stripped symbol from the section so that the
section symbol is used in the dynrelas rela section.

After:

Relocation section [14] '.rela.kpatch.dynrelas' for section [13] '.kpatch.dynrelas' at offset 0x8b8 contains 6 entries:
  Offset              Type            Value               Addend Name
  000000000000000000  X86_64_64       000000000000000000      +9 .text.kpatch_load_aio_max_nr
  0x0000000000000018  X86_64_64       000000000000000000      +8 .kpatch.strings
  0x0000000000000020  X86_64_64       000000000000000000      +0 .kpatch.strings
  0x0000000000000030  X86_64_64       000000000000000000      +9 .text.kpatch_unload_aio_max_nr
  0x0000000000000048  X86_64_64       000000000000000000      +8 .kpatch.strings
  0x0000000000000050  X86_64_64       000000000000000000      +0 .kpatch.strings

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-08-13 13:40:29 -05:00
..
insn insn: get it to compile in create-diff-object 2014-05-30 15:19:57 -05:00
Makefile restructure building process 2014-08-07 17:25:05 -05:00
create-diff-object.c fix dynrela corruption in load/unload hooks 2014-08-13 13:40:29 -05:00
kpatch-build kpatch-build: don't link unchanged objects 2014-08-08 14:22:17 -05:00
kpatch-gcc kpatch-gcc: fix for .tmp_* objects on RHEL 7 2014-08-12 21:21:53 -05:00
list.h create-diff-object: create __mcount_loc section 2014-07-01 08:29:37 -05:00
lookup.c exclude UNDEF global syms from lookup_global_symbol 2014-06-02 20:34:37 -05:00
lookup.h merge add-patches-section functionality into create-obj-diff 2014-05-20 12:44:30 -05:00