On Tue, Jul 24, 2018 at 10:39 AM, Lennert Buytenhek
<[email protected]> wrote:
> Hi!
>
> I need the patch below to make kpatch-build work on Ubuntu 18.04.  On
> this distro, the linux-image package is built from the linux-signed
> source package, which just seems to be a wrapper and does not actually
> contain the kernel source code.
>
> Also, on top of the instructions on the github page, I need to 'apt
> install elfutils' for eu-readelf to be there, but with those changes,
> it seems I can generate a live patch:
>
>         root@build:~/kpatch/kpatch-build# ./kpatch-build 
> ~/kvm-fix-lapic-timer-drift-when-guest-uses-periodic-mode.patch
>         Using cache at /root/.kpatch/src
>         Testing patch file(s)
>         Reading special section data
>         Building original kernel
>         Building patched kernel
>         Extracting new and modified ELF sections
>         lapic.o: new function: advance_periodic_target_expiration
>         lapic.o: changed function: apic_timer_fn
>         lapic.o: changed function: kvm_lapic_expired_hv_timer
>         Patched objects: arch/x86/kvm/kvm.ko
>         Building patch module: 
> livepatch-kvm-fix-lapic-timer-drift-when-guest-u.ko
>         SUCCESS
>         root@build:~/kpatch/kpatch-build#

Note that upstream kpatch does not build an Ubuntu kernel correctly.
kpatch-build uses the kernel's Makefile but an Ubuntu kernel is built
using specific Debian rules. I've started to fix this but then got
side-tracked by Meltdown/Spectre which still keeps me busy,
unfortunately. If your build host runs Ubuntu, you should be able to
use the kpatch-build package from the Ubuntu repo. And if that doesn't
work please file a bug at
https://launchpad.net/ubuntu/+source/kpatch/+bugs.

...Juerg


> And I'm able to load it:
>
>         root@build:~/kpatch/kpatch# ./kpatch load 
> ../kpatch-build/livepatch-kvm-fix-lapic-timer-drift-when-guest-u.ko
>         loading patch module: 
> ../kpatch-build/livepatch-kvm-fix-lapic-timer-drift-when-guest-u.ko
>         waiting (up to 15 seconds) for patch transition to complete...
>         transition complete (2 seconds)
>         root@build:~/kpatch/kpatch#
>
>
>
> diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build
> index ab70b0f..f0e089e 100755
> --- a/kpatch-build/kpatch-build
> +++ b/kpatch-build/kpatch-build
> @@ -623,7 +623,7 @@ else
>                         sublevel="SUBLEVEL ="
>                 fi
>
> -               pkgname="$(dpkg-query -W -f='${Source}' 
> "linux-image-$ARCHVERSION")"
> +               pkgname="$(dpkg-query -W -f='${Source}' 
> "linux-image-$ARCHVERSION" | sed s/-signed//)"
>                 pkgver="$(dpkg-query -W -f='${Version}' 
> "linux-image-$ARCHVERSION")"
>                 dscname="${pkgname}_${pkgver}.dsc"
>
>
> _______________________________________________
> kpatch mailing list
> [email protected]
> https://www.redhat.com/mailman/listinfo/kpatch

_______________________________________________
kpatch mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/kpatch

Reply via email to