Comments (8)
I also met this problem, but the problematic section kpatch_verify_patchability complained is '__bug_table', rather than '.rela.smp_locks'.
[ryan@localhost kpatch]$ ./kpatch-build/kpatch-build -r ./kernel-3.13.6-200.fc20.src.rpm ~/workspace/mlock.patch -d
DEBUG mode enabled
Using cache at /home/ryan/.kpatch/3.13.6-200.fc20.x86_64/src
Testing patch file
patching file mm/mlock.c
Building original kernel
Building patched kernel
Detecting changed objects
Rebuilding changed objects
Extracting new and modified ELF sections
changed function: mlock_vma_page
kpatch_verify_patchability:730: changed section __bug_table not selected for inclusion
/home/ryan/workspace/upstream/kpatch/kpatch-build/create-diff-object: unreconcilable difference
ERROR: kpatch build failed. Check /tmp/kpatch-build-1396494986.log for more details.
from kpatch.
I know of the __bug_table issue and am working to fix it
from kpatch.
I had compared two mlock.o:
[ryan@localhost kpatch]$ readelf -S /tmp/tmp.0TM37HJNqd/orig/mm/mlock.o
...
[10] __bug_table PROGBITS 0000000000000000 00000197
00000000000000c0 0000000000000000 A 0 0 1
...
[16] .rela.smp_locks RELA 0000000000000000 00005730
0000000000000108 0000000000000018 97 15 8
...
[ryan@localhost kpatch]$ readelf -S /tmp/tmp.0TM37HJNqd/patched/mm/mlock.o
...
[10] __bug_table PROGBITS 0000000000000000 00000197
00000000000000b4 0000000000000000 A 0 0 1
...
[16] .rela.smp_locks RELA 0000000000000000 000056e0
0000000000000108 0000000000000018 97 15 8
...
the size of the __bug_table section is changed after patching.
but for .rela.smp_locks section, the size is same.
from kpatch.
Saw this again with the following patch:
Index: src/net/unix/af_unix.c
===================================================================
--- src.orig/net/unix/af_unix.c
+++ src/net/unix/af_unix.c
@@ -1921,6 +1921,8 @@ static int unix_stream_recvmsg(struct ki
long timeo;
int skip;
+ printk_once("foo\n");
+
err = -EINVAL;
if (sk->sk_state != TCP_ESTABLISHED)
goto out;
$ kpatch-build unix_stream_recvmsg.patch
Using cache at /home/jpoimboe/.kpatch/3.13.10-200.fc20.x86_64/src
Testing patch file
patching file net/unix/af_unix.c
Building original kernel
Building patched kernel
Detecting changed objects
Rebuilding changed objects
Extracting new and modified ELF sections
changed function: unix_stream_recvmsg
kpatch_verify_patchability:736: changed section .rela.smp_locks not selected for inclusion
/usr/local/libexec/kpatch/create-diff-object: unreconcilable difference
ERROR: kpatch build failed. Check /tmp/kpatch-build-1398089722.log for more details.
from kpatch.
Each use of an atomic variable or spinlock (any instruction using the x86 "lock" prefix) results in the instruction's address getting added to the .smp_lock section, for potential future code modification (removing or adding the x86 "lock" instruction prefix). Each entry in the section contains only a 4-byte address which is placed there via relocation (.rela.smp.locks).
To support this I think we need to do something similar to what was done with the bug table, except both the .smp_locks and its rela section will need to be regenerated. Only those entries for which the rela refers to an included function should be kept. Regenerating .smp_locks shouldn't be hard since it's just all zeros.
Since this looks like it could be a common pattern emerging, maybe we can replace kpatch_regenerate_bug_table_rela_section with something more generic that covers both cases (and probably more cases we will discover). I think as long as it knows the entry size, that should be enough information for it to examine each of the relas within each entry and copy the needed base and rela entries.
from kpatch.
This is next in my queue. Thanks for the analysis @jpoimboe
from kpatch.
@madper after this fix, i was able to build your patch. Please confirm.
@jpoimboe with your patch, i feel through to a .rela.init.text not included error. I think it is because of the BUILD_BUG_ON in the __init function. however, it does fix the smp_locks failure.
from kpatch.
@Spartacus06 Thanks, when I get a chance I'll take a closer look at the .rela.init.text error. I'm going to go ahead and merge this fix now. @madper , please open a new issue if you still see the same error.
from kpatch.
Related Issues (20)
- kpatch-build: .rela.return_sites not selected for inclusion on 5.18.12-rc1+ kernels HOT 2
- kpatch-cc build error when source tree prefix matches substring in changed object file
- kpatch module build could fail when kernel 5.19+ contains dynamic symbols HOT 21
- kpatch_version: Unknown symbol kpatch_unregister HOT 8
- '-'/'_' mismatch for OOT modules HOT 2
- kpatch load can't find core module HOT 8
- Fix possible buffer overflow in ESP transformation error System.map error HOT 3
- integration tests: CONFIG_MODVERSIONS and linux-5.18.0/symvers-disagreement-FAIL.patch HOT 8
- After the kpatch install "xxx. ko" on openeuler, the machine was restarted. The kpatch service failed, resulting in the kernel patch restart not taking effect
- What do I need to do to support riscv64? HOT 11
- ERROR: testmod_drv.o: .return_sites section header details differ from .return_sites HOT 20
- Need suggestions for CONFIG_LTO_CLANG support HOT 40
- New error building patch for 6.2-rc2? HOT 12
- kpatch-build errors for kernel v6.1.4 HOT 4
- ubsan for kpatch HOT 2
- find_local_syms for <modified-file>: found_none HOT 2
- 6.3 failure with setlocalversion HOT 5
- Outstanding clang issues for 6.2 HOT 3
- x86 NOP padded functions without __pfx_ symbol HOT 4
- Linux 6.1 LTS: livepatch module fails to load HOT 26
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.