dynup / kpatch

kpatch - live kernel patching
GNU General Public License v2.0
1.49k stars 305 forks source link

is `find_special_section_data` necessary for build patches for oot-modules #1164

Closed DillionApple closed 3 years ago

DillionApple commented 3 years ago

I'm building a patch for my oot module:

kpatch-build --sourcedir ./refcnt_checker/ --target all -e ./refcnt_checker.ko 0001-patch-the-module.patch

But I get the error:

Using source directory at /home/dillion/refcnt_checker/
Testing patch file(s)
Reading special section data
readelf: : Error: No such file
ERROR: can't find special struct alt_instr size. Check /root/.kpatch/build.log for more details.

I checked the source code and seems readelf needs to parse $VMLINUX (path to vmlinux file) for some data.

The vmlinux file I extracted from /boot/vmlinuz-$(uname -r) seems not meeting the requirements, raising error:

ERROR: can't find special struct alt_instr size. Check /root/.kpatch/build.log for more details.

These two errors are raised from function find_special_section_data in kpatch-build. I commented this function, and the patch is built successfully.

So, is find_special_section_data necessary for building oot-module patches?

jpoimboe commented 3 years ago

Yes, it's necessary though it's possible your module might work without it. Extracting vmlinux from vmlinuz won't work, you'll need the original unstripped vmlinux (e.g. from a kernel-debuginfo RPM).

DillionApple commented 3 years ago

@jpoimboe Thanks a lot.