kpatch/9030-kmod-core-fix-compilation-with-CONFIG_HAVE_ARCH_PREL.patch

35 lines
1008 B
Diff
Raw Normal View History

From da3eed612df1d26e19b0678763e116f666da13b2 Mon Sep 17 00:00:00 2001
From: Artem Savkov <asavkov@redhat.com>
Date: Wed, 14 Nov 2018 12:33:13 +0100
Subject: [PATCH] kmod/core: fix compilation with
CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
Kernel commit 7290d5809571 "module: use relative references for
__ksymtab entries" changed kernel_symbol structure on some
architectures. Adjust kmod/core/core.c accordingly.
Signed-off-by: Artem Savkov <asavkov@redhat.com>
---
kmod/core/core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kmod/core/core.c b/kmod/core/core.c
index 4a73a47..a91d417 100644
--- a/kmod/core/core.c
+++ b/kmod/core/core.c
@@ -651,7 +651,11 @@ static int kpatch_find_external_symbol(const char *objname, const char *name,
sym = find_symbol(name, NULL, NULL, true, true);
preempt_enable();
if (sym) {
+#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
+ *addr = (unsigned long)offset_to_ptr(&sym->value_offset);
+#else
*addr = sym->value;
+#endif
return 0;
}
--
2.19.1