From 3f8e1062cc0e0f782ba6793735d59b1e07116265 Mon Sep 17 00:00:00 2001 From: Josh Poimboeuf Date: Wed, 11 May 2022 14:36:41 -0700 Subject: [PATCH] create-diff-object: support R_X86_64_NONE in kpatch_replace_sections_syms() Add support for R_X86_64_NONE. With an upstream kernel, it's quite rare, only used for a few jump labels. With older kernels it was used for fentry hooks. Either way, it should be treated like a PC-relative relocation. Signed-off-by: Josh Poimboeuf --- kpatch-build/create-diff-object.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c index 03c3321..4f1bb21 100644 --- a/kpatch-build/create-diff-object.c +++ b/kpatch-build/create-diff-object.c @@ -1580,7 +1580,8 @@ static void kpatch_replace_sections_syms(struct kpatch_elf *kelf) rela->type == R_X86_64_32S) add_off = 0; else if (rela->type == R_X86_64_PC32 || - rela->type == R_X86_64_PLT32) { + rela->type == R_X86_64_PLT32 || + rela->type == R_X86_64_NONE) { struct insn insn; rela_insn(relasec, rela, &insn); add_off = (unsigned int)((long)insn.next_byte -