kpatch/huawei-lookup.c-ignore-BTF-ID-when-matching-locals.patch
caixiaomeng 8f98369eed adapt kpatch to 6.6 kernel and fix bundle symbols change
(cherry picked from commit b3f9ce4d4dcefd054057d8796c5026147736497b)
2024-05-09 14:17:19 +08:00

33 lines
966 B
Diff

From c0a0955cfe04f9cd536f57d0866683fd88894576 Mon Sep 17 00:00:00 2001
From: hubin <hubin73@huawei.com>
Date: Tue, 5 Mar 2024 10:15:59 +0800
Subject: [PATCH] lookup.c: ignore BTF ID when matching locals
BTF info may not be enabled when compiling kernel in compile env,
but exist in vmlinux symtab, which causes
kpatch unable to find matching local symbols
---
kpatch-build/lookup.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kpatch-build/lookup.c b/kpatch-build/lookup.c
index 458b447..2fe1fd0 100644
--- a/kpatch-build/lookup.c
+++ b/kpatch-build/lookup.c
@@ -107,6 +107,11 @@ static bool locals_match(struct lookup_table *table, int idx,
continue;
if (table_sym->type != STT_FUNC && table_sym->type != STT_OBJECT)
continue;
+ /*
+ * BTF info may not be enabled when compiling kernel, but exists in vmlinux symtab
+ */
+ if (!strncmp(table_sym->name, "__BTF_ID__", 10))
+ continue;
found = 0;
sym = file_sym;
--
2.33.0