56 lines
2.2 KiB
Diff
56 lines
2.2 KiB
Diff
From e8674bab4db104357780db9b960b78938fac5a6d Mon Sep 17 00:00:00 2001
|
|
From: rpm-build <rpm-build>
|
|
Date: Wed, 22 May 2024 20:31:59 +0800
|
|
Subject: [PATCH] huawei adapt arm64 dynamic ftrace call with 2 nops
|
|
|
|
---
|
|
kpatch-build/create-diff-object.c | 5 +++++
|
|
kpatch-build/kpatch-build | 1 +
|
|
2 files changed, 6 insertions(+)
|
|
|
|
diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c
|
|
index 73b8337..f1dfc1d 100644
|
|
--- a/kpatch-build/create-diff-object.c
|
|
+++ b/kpatch-build/create-diff-object.c
|
|
@@ -242,6 +242,7 @@ static void kpatch_bundle_symbols(struct kpatch_elf *kelf)
|
|
struct symbol *sym;
|
|
unsigned int expected_offset;
|
|
unsigned int directcall_offset = 16;
|
|
+ unsigned int dynamic_ftracecall_offset = 8;
|
|
|
|
list_for_each_entry(sym, &kelf->symbols, list) {
|
|
if (is_bundleable(sym)) {
|
|
@@ -253,6 +254,7 @@ static void kpatch_bundle_symbols(struct kpatch_elf *kelf)
|
|
expected_offset = 0;
|
|
|
|
if (sym->sym.st_value != expected_offset &&
|
|
+ !(getenv("CONFIG_DYNAMIC_FTRACE_WITH_CALL_OPS") && sym->sym.st_value == dynamic_ftracecall_offset) &&
|
|
!(getenv("CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS") && sym->sym.st_value == directcall_offset)) {
|
|
ERROR("symbol %s at offset %lu within section %s, expected %u",
|
|
sym->name, sym->sym.st_value,
|
|
@@ -3446,6 +3448,9 @@ static int function_ptr_rela(const struct rela *rela)
|
|
if (getenv("CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS"))
|
|
entry_offset = 16;
|
|
|
|
+ if (getenv("CONFIG_DYNAMIC_FTRACE_WITH_CALL_OPS"))
|
|
+ entry_offset = 8;
|
|
+
|
|
return (rela_toc && rela_toc->sym->type == STT_FUNC &&
|
|
!rela_toc->sym->parent &&
|
|
(rela_toc->addend == (int)rela_toc->sym->sym.st_value ||
|
|
diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build
|
|
index edc05b3..886a753 100755
|
|
--- a/kpatch-build/kpatch-build
|
|
+++ b/kpatch-build/kpatch-build
|
|
@@ -1181,6 +1181,7 @@ else
|
|
fi
|
|
|
|
grep -q "CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS=y" "$CONFIGFILE" && export CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS=1
|
|
+grep -q "CONFIG_DYNAMIC_FTRACE_WITH_CALL_OPS=y" "$CONFIGFILE" && export CONFIG_DYNAMIC_FTRACE_WITH_CALL_OPS=1
|
|
|
|
# unsupported kernel option checking
|
|
[[ -n "$CONFIG_DEBUG_INFO_SPLIT" ]] && die "kernel option 'CONFIG_DEBUG_INFO_SPLIT' not supported"
|
|
--
|
|
2.33.0
|
|
|