kpatch/huawei-lookup.c-ignore-BTF-ID-when-matching-locals.patch

33 lines
966 B
Diff
Raw Normal View History

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