Comments (10)
This issue is actually hard to resolve. create-diff-object changes unchanged LOCAL symbols to GLOBAL symbols with section index UNDEF so that they can be linked to the version in vmlinux. However, this introduces the chance that the local symbol name collides with an existing global symbol in the kernel and we can't determine, from link-vmlinux-syms point of view, which symbol was being referenced since it has no FILE context as LOCAL symbols do.
In the meantime, commit 2be6178 checks for this ambiguity and errors out of the situation above is ever encountered.
from kpatch.
I attempted to recreate this issue, but strangely got another problem. I used the following patch:
Index: src/mm/ksm.c
===================================================================
--- src.orig/mm/ksm.c
+++ src/mm/ksm.c
@@ -2216,6 +2216,10 @@ static ssize_t pages_to_scan_store(struc
{
int err;
unsigned long nr_pages;
+ char buf2[64];
+
+ pages_to_scan_show(kobj, attr, buf2);
+ printk("pages_to_scan_show says %s\n", buf2);
err = kstrtoul(buf, 10, &nr_pages);
if (err || nr_pages > UINT_MAX)
I expected an error, but instead it succeeded, and strangely pages_to_scan_show doesn't show up in the symbol table.
from kpatch.
Looking at the rela table for pages_to_scan_store with the patch applied:
Relocation section [30] '.rela.text.pages_to_scan_store' for section [29] '.text.pages_to_scan_store' at offset 0x8868 contains 9 entries:
Offset Type Value Addend Name
0x0000000000000001 X86_64_NONE 000000000000000000 -4 __fentry__
0x0000000000000009 X86_64_32S 000000000000000000 +0 .rodata.str1.1
0x0000000000000023 X86_64_PC32 000000000000000000 -4 .data.ksm_thread_pages_to_scan
0x0000000000000037 X86_64_PC32 000000000000000000 -4 sprintf
0x0000000000000042 X86_64_32S 000000000000000000 +14 .rodata.str1.1
0x0000000000000049 X86_64_PC32 000000000000000000 -4 printk
0x000000000000005a X86_64_PC32 000000000000000000 -4 kstrtoull
0x0000000000000072 X86_64_PC32 000000000000000000 -4 .data.ksm_thread_pages_to_scan
0x00000000000000a2 X86_64_PC32 000000000000000000 -4 __stack_chk_fail
Looks like the compiler is inlining pages_to_scan_show.
from kpatch.
And the patch does work :)
# echo 100 > pages_to_scan
# dmesg
[17771.153314] pages_to_scan_show says 100
from kpatch.
Blasted compiler.
from kpatch.
/me wonders how to get gcc to not inline an otherwise not inlined function.
from kpatch.
I'm playing around with using -fno-inline, in addition to -f[function|data]-sections in the KCFLAGS for building the diff objects.
from kpatch.
This issue is as fixed as it can be right now, see commit 2be6178
from kpatch.
This may be lower priority, but let's leave it open since it helps us keep track of a real issue that will need to be fixed at some point. I'm not sure that changing unchanged LOCAL symbols to GLOBAL undef symbols in create-diff-object is the best approach.
from kpatch.
With the addition of dynrela support, link-vmlinux-syms doesn't exist anymore and the issue has disappeared because we no longer do the change-symbol-binding trick for pinning addresses into the symbol table.
from kpatch.
Related Issues (20)
- 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
- create-diff-object static local variable correlation and inlining HOT 5
- 1.0 release HOT 2
- Do we need more robust archeticture protection HOT 4
- kpatch-build: verify_patch_files might miss a parameter HOT 2
- ERROR in find_local_syms, couldn't find matching XXX local symbols in vmlinux symbol table HOT 14
- Can you add support for Rocky and Alma? HOT 1
- relocation with type R_X86_64_GOTPCREL is not supported HOT 5
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.