Skip to content

Commit

Permalink
Workaround create-diff-object issue
Browse files Browse the repository at this point in the history
We've seen this on Linux 6.9:

create-diff-object: ERROR: x86.o: kpatch_bundle_symbols: 251: symbol get_cpu_tsc_khz at offset 16 within section .text.get_cpu_tsc_khz, expected 0

The workaround comes from:
https://gitee.com/src-openeuler/kpatch/issues/I9I3EZ

Signed-off-by: Julian Stecklina <julian.stecklina@cyberus-technology.de>
Signed-off-by: Thomas Prescher <thomas.prescher@cyberus-technology.de>
  • Loading branch information
blitz committed Jul 24, 2024
1 parent 6115a1a commit d1ec316
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kpatch-build/create-diff-object.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ static void kpatch_bundle_symbols(struct kpatch_elf *kelf)
{
struct symbol *sym;
unsigned int expected_offset;
unsigned int directcall_offset = 16;

list_for_each_entry(sym, &kelf->symbols, list) {
if (is_bundleable(sym)) {
Expand All @@ -247,7 +248,8 @@ static void kpatch_bundle_symbols(struct kpatch_elf *kelf)
else
expected_offset = 0;

if (sym->sym.st_value != expected_offset) {
if (sym->sym.st_value != expected_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,
sym->sec->name, expected_offset);
Expand Down
2 changes: 2 additions & 0 deletions kpatch-build/kpatch-build
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,8 @@ else
KBUILD_EXTRA_SYMBOLS="$SYMVERSFILE"
fi

grep -q "CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS=y" "$CONFIGFILE" && export CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS=1

# unsupported kernel option checking
[[ -n "$CONFIG_DEBUG_INFO_SPLIT" ]] && die "kernel option 'CONFIG_DEBUG_INFO_SPLIT' not supported"
[[ -n "$CONFIG_GCC_PLUGIN_LATENT_ENTROPY" ]] && die "kernel option 'CONFIG_GCC_PLUGIN_LATENT_ENTROPY' not supported"
Expand Down

0 comments on commit d1ec316

Please sign in to comment.