kpatch/kpatch-build
Kamalesh Babulal 19b0aba672 PPC64le - do not use the patched functions as callbacks directly
It was observed by Evgenii Shatokhin in PR#755, that when the RCU
callback was called on the patched function, from unloaded livepatch
module triggered a kernel crash.

This patch implements the approach on PowerPC outlined in PR#755.
With -mcmodel=large, like any other data, function pointers are also
loaded relative to the current TOC base and are populated as
relocation entries in .toc section. Every function passing a function
pointer as the argument need to load the function address through
.toc section + offset. Convert such .toc + offset relocation into
a dynamic rela, which resolves to original function address, during
module load.

Also move the comment related to nested function check, into
may_need_dynrela().

Suggested-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Evgenii Shatokhin <eshatokhin@virtuozzo.com>
Cc: Joe Lawrence <jdl1291@gmail.com>
Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
2018-03-21 09:05:25 +05:30
..
gcc-plugins gcc-plugin: create a ppc64le GCC plugin which inserts nops after local calls 2017-11-10 09:17:00 -06:00
insn insn: get it to compile in create-diff-object 2014-05-30 15:19:57 -05:00
create-diff-object.c PPC64le - do not use the patched functions as callbacks directly 2018-03-21 09:05:25 +05:30
create-klp-module.c create-diff-object: don't convert relocation destinations to symbols 2017-11-09 19:16:14 -06:00
create-kpatch-module.c create-kpatch-module: support unbundled symbols 2017-09-20 23:57:24 -05:00
kpatch-build Prepare for built-in.o -> built-in.a rename 2018-03-20 10:46:50 +01:00
kpatch-elf.c kpatch-build: clear Elf_Data d_buf buffer on allocation 2017-10-03 16:42:28 -04:00
kpatch-elf.h PPC64le - do not use the patched functions as callbacks directly 2018-03-21 09:05:25 +05:30
kpatch-gcc Prepare for built-in.o -> built-in.a rename 2018-03-20 10:46:50 +01:00
kpatch-intermediate.h create-klp-module: get rid of redundant kpatch_relocation.offset field 2017-11-09 19:16:14 -06:00
list.h new .fixup group size algorithm 2014-09-15 14:54:57 -05:00
log.h log: include error.h 2017-01-23 12:42:35 -08:00
lookup.c lookup: allow local symbols to be in any order 2017-07-06 12:44:50 -05:00
lookup.h support dup file+symbol 2017-02-04 09:37:18 +08:00
Makefile gcc-plugin: create a ppc64le GCC plugin which inserts nops after local calls 2017-11-10 09:17:00 -06:00