Comments (14)
Please try the latest kpatch code
from kpatch.
Hi, thanks for advice.
I upgrade kpatch to latest version but still fail to make kpatch.
It seems that this is caused by new kernel 6.4.0 ?
My environment:
kpatch version: latest version 0.9.9 downloaded from github
kernel version: 6.4.0
architecture: x86_64
linux: openEuler
[root@openEuler patch_workspace]# ./make_hotpatch -i testklp -d .v1 -j 32
kernel version:6.4.0-6.0.0.14.oe2309.x86_64
grep: warning: stray \ before -
grep: warning: stray \ before -
grep: warning: stray \ before -
detect change files:/usr/src/linux-6.4.0-6.0.0.14.oe2309.x86_64/kernel/time/ntp.c.v1
make patch /tmp/klp_testklp/testklp.patch
Using source directory at /usr/src/linux-6.4.0-6.0.0.14.oe2309.x86_64
Testing patch file(s)
Reading special section data
Building original source
Building patched source
Extracting new and modified ELF sections
create-diff-object: ERROR: ntp.o: kpatch_bundle_symbols: 251: czy symbol ntp_update_frequency at offset 16 within section .text.ntp_update_frequency, expected 0
ERROR: 1 error(s) encountered. Check /root/.kpatch/build.log for more details.
error: invoke kpatch-build shell script to build patch failed
from kpatch.
Might be a problem with the handling of CONFIG_PREFIX_SYMBOLS. This should have been handled by 3e54c63 but maybe there's a gap somewhere. Please post the output of readelf -Ws /usr/src/linux-6.4.0-6.0.0.14.oe2309.x86_64/kernel/time/ntp.o
.
from kpatch.
[root@openEuler ~]# readelf -Ws /usr/src/linux-6.4.0-6.0.0.14.oe2309.x86_64/kernel/time/ntp.o
Symbol table '.symtab' contains 88 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 FILE LOCAL DEFAULT ABS ntp.c
2: 0000000000000000 0 SECTION LOCAL DEFAULT 4 .text.ntp_update_frequency
3: 0000000000000010 108 FUNC LOCAL DEFAULT 4 ntp_update_frequency
from kpatch.
I compare the ELF data of ntp.o produced by kernel-5.10, the st_value is differenet
readelf -Ws /usr/src/kernels/linux-5.10.0-xxxxx/kernel/time/ntp.o
Symbol table '.symtab' contains 105 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 FILE LOCAL DEFAULT ABS ntp.c
2: 0000000000000000 0 SECTION LOCAL DEFAULT 1 .text
3: 0000000000000000 0 SECTION LOCAL DEFAULT 2 .data
4: 0000000000000000 0 SECTION LOCAL DEFAULT 3 .bss
5: 0000000000000000 0 SECTION LOCAL DEFAULT 4 .text.ntp_update_frequency
7: 0000000000000000 136 FUNC LOCAL DEFAULT 4 ntp_update_frequency
from kpatch.
Yes, the 16 byte offset is expected, and should be dealt with by 3e54c63, are you sure you have that commit?
Can you also post the output of readelf -Ws /usr/src/linux-6.4.0-6.0.0.14.oe2309.x86_64/kernel/time/ntp.o |grep ntp_update_frequency
(lower case "s" this time)?
from kpatch.
- I am sure my current kpatch have commit 3e54c6 by adding debug log.
- There is no _pfx symbol of ntp_update_frequency
[root@openEuler patch_workspace]# readelf -Ws /usr/src/linux-6.4.0-6.0.0.14.oe2309.x86_64/kernel/time/ntp.o | grep ntp_update_frequency
2: 0000000000000000 0 SECTION LOCAL DEFAULT 4 .text.ntp_update_frequency
3: 0000000000000010 108 FUNC LOCAL DEFAULT 4 ntp_update_frequency
- I belive the problem occurs in sym->pfx code:
list_for_each_entry(sym, &kelf->symbols, list) {
if (is_bundleable(sym)) {
if (sym->pfx)
expected_offset = 16;
else if (is_gcc6_localentry_bundled_sym(kelf, sym))
In my case, when iterating ntp_update_frequency symbol, sym->pfx returns false and results mismatch between st_value and expected_offset
from kpatch.
Maybe this error is releated to this PR :#1350
from kpatch.
I comment out CONFIG_X86_KERNEL_IBT and the error is gone, a new one come up:
Maybe this error is found or fix before?
from kpatch.
I comment out CONFIG_X86_KERNEL_IBT and the error is gone, a new one come up: Maybe this error is found or fix before?
this error comes from making this patch:
diff --git a/fs/proc/version.c b/fs/proc/version.c.new
index 02e3c3c..47445f9 100644
--- a/fs/proc/version.c
+++ b/fs/proc/version.c.new
@@ -13,6 +13,7 @@ static int version_proc_show(struct seq_file *m, void *v)
utsname()->sysname,
utsname()->release,
utsname()->version);
+ seq_printf(m, "hotpatched\n");
return 0;
}
/root/.kpatch/tmp/vmlinux.symtab:
rreadelf -sW /root/.kpatch/tmp/orig/fs/proc/version.o:
readelf -sW /usr/src/linux-6.4.0-1.0.1.4.oe2309.x86_64/vmlinux:
from kpatch.
so find_local_syms error happens because vmlinux.symtab does not contains __pfx_
symbols but version.o contains them, and local symbols cannot match.
maybe maybe_discarded_sym() should add __pfx_
pattern?
from kpatch.
so find_local_syms error happens because vmlinux.symtab does not contains "_pfx" symbols but version.o contains them, and local symbols cannot match.
maybe maybe_discarded_sym() should add "_pfx" pattern?
seems that this patch can solve the find_local_syms error:
diff --git a/kpatch-build/lookup.c b/kpatch-build/lookup.c
index bd2b732..2008cce 100644
--- a/kpatch-build/lookup.c
+++ b/kpatch-build/lookup.c
@@ -83,6 +83,7 @@ static bool maybe_discarded_sym(const char *name)
!strncmp(name, "__brk_reservation_fn_", 21) ||
!strncmp(name, "__func_stack_frame_non_standard_", 32) ||
strstr(name, "__addressable_") ||
+ strstr(name, "__pfx_") ||
strstr(name, "__UNIQUE_ID_") ||
!strncmp(name, ".L.str", 6) ||
is_ubsan_sec(name))
from kpatch.
This issue has been open for 30 days with no activity and no assignee. It will be closed in 7 days unless a comment is added.
from kpatch.
This issue was closed because it was inactive for 7 days after being marked stale.
from kpatch.
Related Issues (20)
- Can you add support for Rocky and Alma? HOT 1
- relocation with type R_X86_64_GOTPCREL is not supported HOT 5
- Arch Compile kpatch-git test failed HOT 4
- Regarding "statically allocated data" again HOT 2
- kpatch-build error when modifying an object file's only syscall
- nowhere to find the definition of klp_register_patch HOT 5
- x86 paravirt code uses alternatives v6.8+ HOT 1
- special-static.patch can fail to build on s390x / upstream v6.8 HOT 6
- CONFIG_FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY not supported on ppc64le HOT 6
- function __pfx_new_sync_read has no fentry/mcount call, unable to patch HOT 6
- Unchanged and unpatchable function moves from .text to .text.unlikely HOT 5
- Why did the kpatch-build script export the KPATCH-BUILD environment variable from the BUILD directory to the SOURCE directory? HOT 3
- CONFIG_WERROR=y and CONFIG_LD_ORPHAN_WARN_LEVEL="error" break kpatch-build HOT 2
- linux 6.9.0-rc6 can't find special struct paravirt_patch_site size HOT 6
- fair.o: changed section .data..read_mostly not selected for inclusion HOT 11
- find_local_syms: 218: couldn't find matching cm.c local symbols in ib_mad symbol table HOT 7
- Kernel Warning: Unpatched return thunk in use. This should not happen! HOT 7
- kpatch load/unload patch transition has stalled HOT 1
- kpatch_check_relocations: 2678: .debug_loc+0x2e26: out-of-range relocation HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kpatch.