Code Monkey home page Code Monkey logo

Comments (8)

joe-lawrence avatar joe-lawrence commented on July 19, 2024

Hello @hongwentakkk ,

First thing: 3.10.0-693.el7.x86_64 (at least the Red Hat version of this kernel) is from RHEL-7.4 and was built on 06-Jul-2017. I would strongly suggest upgrading both distribution and kernel versions if possible. There will be many security issues closed by upgrading those that kpatch alone cannot solve.

Next, it looks like the kernel is complaining about symbols that should be found in the now deprecated kpatch support module. It has been many years since I've looked at it, but there should be a kmod/core/kpatch.ko file created when you built the kpatch project. Try installing the kpatch core module prior to any kpatch .ko and let us know how that works out.

from kpatch.

hongwentakkk avatar hongwentakkk commented on July 19, 2024

hello @joe-lawrence
Excuse me, what's wrong with my operation ,how can i solve this problem ? thanks;

root@centos-uk:[/opt/patch_workspace]cd /root/kpatch/kmod/core/
root@centos-uk:[/root/kpatch/kmod/core]make
make: `kpatch.ko' is up to date.
root@centos-uk:[/root/kpatch/kmod/core]

/root/.kaptch/build.log
make[1]: Entering directory `/root/.kpatch/src'
LD /root/.kpatch/tmp/patch/built-in.o
CC [M] /root/.kpatch/tmp/patch/patch-hook.o
LDS /root/.kpatch/tmp/patch/kpatch.lds
LD [M] /root/.kpatch/tmp/patch/kpatch-version.o
Building modules, stage 2.
MODPOST 1 modules
WARNING: could not find /root/.kpatch/tmp/patch/.output.o.cmd for /root/.kpatch/tmp/patch/output.o
WARNING: "kpatch_root_kobj" [/root/.kpatch/tmp/patch/kpatch-version.ko] undefined!
WARNING: "kpatch_unregister" [/root/.kpatch/tmp/patch/kpatch-version.ko] undefined!
WARNING: "kpatch_register" [/root/.kpatch/tmp/patch/kpatch-version.ko] undefined!
CC /root/.kpatch/tmp/patch/kpatch-version.mod.o
LD [M] /root/.kpatch/tmp/patch/kpatch-version.ko

kpatch-build -t vmlinux version.patch -r /root/rpm/kernel-3.10.0-693.el7.src.rpm --skip-compiler-check

root@centos-uk:[/opt/patch_workspace]kpatch install kpatch-version.ko
installing kpatch-version.ko (3.10.0-693.el7.x86_64)
root@centos-uk:[/opt/patch_workspace]kpatch load kpatch-version.ko
kpatch: can't find core module
root@centos-uk:[/opt/patch_workspace]

dmesg:
[12183.935560] kpatch_version: loading out-of-tree module taints kernel.
[12183.935613] kpatch_version: module verification failed: signature and/or required key missing - tainting kernel
[12183.935661] kpatch_version: Unknown symbol kpatch_register (err 0)
[12183.935678] kpatch_version: Unknown symbol kpatch_unregister (err 0)
[12183.935683] kpatch_version: Unknown symbol kpatch_root_kobj (err 0)
[12254.797429] kpatch_version: Unknown symbol kpatch_register (err 0)
[12254.797448] kpatch_version: Unknown symbol kpatch_unregister (err 0)
[12254.797454] kpatch_version: Unknown symbol kpatch_root_kobj (err 0)

from kpatch.

joe-lawrence avatar joe-lawrence commented on July 19, 2024
root@centos-uk:[/opt/patch_workspace]kpatch install kpatch-version.ko
installing kpatch-version.ko (3.10.0-693.el7.x86_64)
root@centos-uk:[/opt/patch_workspace]kpatch load kpatch-version.ko
kpatch: can't find core module
root@centos-uk:[/opt/patch_workspace]

The message, "kpatch: can't find core module" suggests that the kpatch utility is trying to load kpatch.ko, but it couldn't find one installed on the system. Did you run make install from the top-level kpatch git clone directory? That should copy kmod/core/kpatch.ko to the system where subsequent kpatch load will find for it. Alternatively, you may be able to manually insmod the kpatch.ko file before running any of the commands.

from kpatch.

hongwentakkk avatar hongwentakkk commented on July 19, 2024

already install the top-level kpatch git clone directory;

root@centos-uk:[/opt/patch_workspace]lsmod | grep kpatch
kpatch 55995 0

root@centos-uk:[/opt/patch_workspace]insmod kpatch-version.ko
insmod: ERROR: could not insert module kpatch-version.ko: Invalid parameters

[Aug 5 09:02] kpatch_version: no symbol version for kpatch_register
[ +0.000005] kpatch_version: Unknown symbol kpatch_register (err -22)
[ +0.000012] kpatch_version: no symbol version for kpatch_unregister
[ +0.000001] kpatch_version: Unknown symbol kpatch_unregister (err -22)
[ +0.000002] kpatch_version: no symbol version for kpatch_root_kobj
[ +0.000001] kpatch_version: Unknown symbol kpatch_root_kobj (err -22)

from kpatch.

euspectre avatar euspectre commented on July 19, 2024

@hongwentakkk Is it still needed to make it work for 3.10.0-693.el7.x86_64 or, perhaps, a newer kernel version would do? IIRC, even the newer kernels 3.10.0-x from RHEL7 support livepatch and do not require kpatch.ko.

from kpatch.

euspectre avatar euspectre commented on July 19, 2024

If you still like to use kpatch.ko-based patch, I'd recommend the following steps:

cd path/to/kpatch/source/dir
make -C kpatch-build

# Replace /lib/modules/{kernel_version}/build/ with the path to the build tree for your kernel
make KPATCH_BUILD=/lib/modules/{kernel_version}/build/ -C kmod/core

# Do not copy kpatch-build, etc., anywhere. Instead, use it directly to build your patch module:
./kpatch-build/kpatch-build {...}

This way, kpatch-build will find Module.symvers for kpatch.ko if needed. It looks for it in specific locations, depending on where kpatch-build itself is.

from kpatch.

euspectre avatar euspectre commented on July 19, 2024

An unrelated issue but may be worth mentioning. Using --skip-compiler-check can be a bad idea if the compiler you use and the compiler used to build the kernel are too different (e.g., if they differ in major or minor versions, like gcc 4.8.5 VS gcc 6.1.0).

If the compilers are too different, building of the patch might fail, at best.

from kpatch.

joe-lawrence avatar joe-lawrence commented on July 19, 2024

I believe this was closed via #1290, please reopen if that is not the case.

from kpatch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.