From 15067fcd64a77e8430f3ce7421b0cca8b27e9179 Mon Sep 17 00:00:00 2001 From: Joe Lawrence Date: Fri, 1 May 2020 08:52:23 -0400 Subject: [PATCH] kmod/core: apply dynrela addend for R_X86_64_64 User stettberger noticed that the kpatch support module does not apply the addend for R_X86_64_64 in kpatch_write_relocations(). The AMD64 ABI draft doc [1], Table 4.10: Relocation Types lists that relocation type as: Name Value Field Calculation R_X86_64_64 1 word64 S + A where: S : Represents the value of the symbol whose index resides in the relocation entry. A : Represents the addend used to compute the value of the relocatable field. [1] http://refspecs.linuxfoundation.org/elf/x86_64-abi-0.99.pdf Fixes: #1093 Reported-by: Christian Dietrich Signed-off-by: Joe Lawrence --- kmod/core/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kmod/core/core.c b/kmod/core/core.c index e4c6a04..c66e0c8 100644 --- a/kmod/core/core.c +++ b/kmod/core/core.c @@ -742,7 +742,7 @@ static int kpatch_write_relocations(struct kpatch_module *kpmod, break; case R_X86_64_64: loc = dynrela->dest; - val = dynrela->src; + val = dynrela->src + dynrela->addend; size = 8; break; default: