Package: kpatch
Version: 0.3.2-3.1
Severity: normal
Tags: patch

Hello,

The version of kpatch in Sid is quite old and doesn't work with
the current kernel. Please consider updating to the latest
upstream version. However it seems that 0.4.0 (latest release) is
not recent enough, so consider using the latest Git version (e.g.
4b2f20e) which works fine me.

The attached patch performs the update to 0.4.0+git4b2f20e and
works fine here (Sid and Stretch). It also adds a few minor
changes to better suit current upstream:

- Upstream uses the kernel's LIVEPATCH per default and only falls
  back to its own kpatch.ko module if LIVEPATCH is not available.
  As LIVEPATCH is supported since Stretch, my patch removes the
  dependency on kpatch-dkms as kpatch works fine without it and
  users of older kernels can install it manully if necessary. Not
  depending on dkms (and thus a compiler) is a nice feature.
- Remove patches which are no longer required:
  create-diff-object-fix-WARN-_ONCE-detection-on-newer.patch
  kmod-core-use-save_stack_trace_tsk-backport.patch
- Update existing patches to apply.
- Add patch to fix uname -p (which always returns unknown on my
  systems); I think this should be upstreamed.
  fix-uname-p.patch
- Add patch to respect CPPFLAGS. Should be upstreamed as well.
  respect-cppflags.patch
- Updates post-dkms.sh which was failing for me. It builds and
  installs fine, but I didn't test it thoroughly and the comment
  from the other bug still applies I think. Maybe the -dkms part
  should be removed completely as upstream is switching to
  LIVEPATCH (and will drop kpatch.ko in the future).

Please also consider making a backport for Stretch (package can
be backported without any issues) as the kpatch version in
Stretch doesn't work with the kernel in Stretch making it rather
useless. The Git version works fine with the Stretch kernel.

Regards
Simon
-- 
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9
diff -u -N -r kpatch-0.3.2/debian/control kpatch-0.4.0+git4b2f20e/debian/control
--- kpatch-0.3.2/debian/control 2016-06-27 21:03:09.000000000 +0200
+++ kpatch-0.4.0+git4b2f20e/debian/control      2017-08-14 12:07:25.497788719 
+0200
@@ -10,8 +10,7 @@
 
 Package: kpatch
 Architecture: linux-amd64
-Depends: ${shlibs:Depends}, ${misc:Depends}, kpatch-dkms,
- linux-headers-amd64 | linux-headers-generic
+Depends: ${shlibs:Depends}, ${misc:Depends}, binutils
 Description: Runtime tools for Kpatch
  kpatch is a Linux dynamic kernel patching tool which allows you to patch a
  running kernel without rebooting or restarting any processes.  It enables
@@ -22,7 +21,8 @@
 
 Package: kpatch-dkms
 Architecture: linux-amd64
-Depends: ${shlibs:Depends}, ${misc:Depends}, dkms
+Depends: ${shlibs:Depends}, ${misc:Depends}, dkms,
+ linux-headers-amd64 | linux-headers-generic
 Description: DKMS module for Kpatch
  This package contains the Kpatch module built with DKMS. It installs the 
source
  and makefiles into the appropriate locations in order to handle various kernel
diff -u -N -r kpatch-0.3.2/debian/patches/fix-uname-p.patch 
kpatch-0.4.0+git4b2f20e/debian/patches/fix-uname-p.patch
--- kpatch-0.3.2/debian/patches/fix-uname-p.patch       1970-01-01 
01:00:00.000000000 +0100
+++ kpatch-0.4.0+git4b2f20e/debian/patches/fix-uname-p.patch    2017-08-12 
12:43:07.884688093 +0200
@@ -0,0 +1,18 @@
+Description: detect architecture properly
+ uname -p returns unknown for unknown reasons. uname -m seems to work
+Author: Simon Ruderich <si...@ruderich.org>
+Last-Update: 2017-08-11
+
+Index: kpatch-0.4.0.g4b2f20e/Makefile.inc
+===================================================================
+--- kpatch-0.4.0.g4b2f20e.orig/Makefile.inc
++++ kpatch-0.4.0.g4b2f20e/Makefile.inc
+@@ -3,7 +3,7 @@ CC    = gcc
+ 
+ INSTALL = /usr/bin/install
+ 
+-ARCH       = $(shell uname -p)
++ARCH       = $(shell uname -m)
+ 
+ PREFIX    ?= /usr/local
+ LIBDIR    ?= lib
diff -u -N -r kpatch-0.3.2/debian/patches/kpatch-build-adjust-dirs.patch 
kpatch-0.4.0+git4b2f20e/debian/patches/kpatch-build-adjust-dirs.patch
--- kpatch-0.3.2/debian/patches/kpatch-build-adjust-dirs.patch  2016-02-18 
17:46:39.000000000 +0100
+++ kpatch-0.4.0+git4b2f20e/debian/patches/kpatch-build-adjust-dirs.patch       
2017-08-11 23:32:54.551552778 +0200
@@ -3,26 +3,37 @@
  paths to adjust for this. In addition the debian packaging uses /usr/lib
  instead of /usr/libexec for internal binaries.
 Author: Chris J Arges <chris.j.ar...@canonical.com>
-Last-Update: 2016-01-08
+Last-Update: 2017-08-11
 
---- a/kpatch-build/kpatch-build
-+++ b/kpatch-build/kpatch-build
-@@ -99,14 +99,14 @@
+Index: kpatch-0.4.0.g4b2f20e/kpatch-build/kpatch-build
+===================================================================
+--- kpatch-0.4.0.g4b2f20e.orig/kpatch-build/kpatch-build
++++ kpatch-0.4.0.g4b2f20e/kpatch-build/kpatch-build
+@@ -121,9 +121,9 @@ find_dirs() {
+               # git repo
+               TOOLSDIR="$SCRIPTDIR"
                DATADIR="$(readlink -f $SCRIPTDIR/../kmod)"
-               SYMVERSFILE="$DATADIR/core/Module.symvers"
-               return
 -      elif [[ -e "$SCRIPTDIR/../libexec/kpatch/create-diff-object" ]]; then
 +      elif [[ -e "$SCRIPTDIR/../lib/kpatch/create-diff-object" ]]; then
                # installation path
 -              TOOLSDIR="$(readlink -f $SCRIPTDIR/../libexec/kpatch)"
 +              TOOLSDIR="$(readlink -f $SCRIPTDIR/../lib/kpatch)"
                DATADIR="$(readlink -f $SCRIPTDIR/../share/kpatch)"
+       else
+               return 1
+@@ -135,12 +135,12 @@ find_core_symvers() {
+       if [[ -e "$SCRIPTDIR/create-diff-object" ]]; then
+               # git repo
+               SYMVERSFILE="$DATADIR/core/Module.symvers"
+-      elif [[ -e "$SCRIPTDIR/../libexec/kpatch/create-diff-object" ]]; then
++      elif [[ -e "$SCRIPTDIR/../lib/kpatch/create-diff-object" ]]; then
+               # installation path
                if [[ -e $SCRIPTDIR/../lib/kpatch/$ARCHVERSION/Module.symvers 
]]; then
                        SYMVERSFILE="$(readlink -f 
$SCRIPTDIR/../lib/kpatch/$ARCHVERSION/Module.symvers)"
 -              elif [[ -e 
/lib/modules/$ARCHVERSION/extra/kpatch/Module.symvers ]]; then
 -                      SYMVERSFILE="$(readlink -f 
/lib/modules/$ARCHVERSION/extra/kpatch/Module.symvers)"
 +              elif [[ -e 
/lib/modules/$ARCHVERSION/updates/dkms/kpatch.Module.symvers ]]; then
 +                      SYMVERSFILE="$(readlink -f 
/lib/modules/$ARCHVERSION/updates/dkms/kpatch.Module.symvers)"
-               else
-                       warn "unable to find Module.symvers for kpatch core 
module"
-                       return 1
+               fi
+       fi
+ 
diff -u -N -r kpatch-0.3.2/debian/patches/respect-cppflags.patch 
kpatch-0.4.0+git4b2f20e/debian/patches/respect-cppflags.patch
--- kpatch-0.3.2/debian/patches/respect-cppflags.patch  1970-01-01 
01:00:00.000000000 +0100
+++ kpatch-0.4.0+git4b2f20e/debian/patches/respect-cppflags.patch       
2017-08-11 23:52:44.050643466 +0200
@@ -0,0 +1,26 @@
+Description: apply CPPFLAGS
+Author: Simon Ruderich <si...@ruderich.org>
+Last-Update: 2017-08-11
+
+Index: kpatch-0.4.0.g4b2f20e/kpatch-build/Makefile
+===================================================================
+--- kpatch-0.4.0.g4b2f20e.orig/kpatch-build/Makefile
++++ kpatch-0.4.0.g4b2f20e/kpatch-build/Makefile
+@@ -20,7 +20,7 @@ all: $(TARGETS)
+ -include $(SOURCES:.c=.d)
+ 
+ %.o : %.c
+-      $(CC) -MMD -MP $(CFLAGS) -c -o $@ $<
++      $(CC) -MMD -MP $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+ 
+ create-diff-object: create-diff-object.o kpatch-elf.o \
+                                       lookup.o $(INSN)
+@@ -28,7 +28,7 @@ create-klp-module: create-klp-module.o k
+ create-kpatch-module: create-kpatch-module.o kpatch-elf.o
+ 
+ $(TARGETS):
+-      $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
++      $(CC) $(CPPFLAGS) $(CFLAGS) $^ -o $@ $(LDFLAGS)
+ 
+ install: all
+       $(INSTALL) -d $(LIBEXECDIR)
diff -u -N -r kpatch-0.3.2/debian/patches/series 
kpatch-0.4.0+git4b2f20e/debian/patches/series
--- kpatch-0.3.2/debian/patches/series  2017-04-01 21:03:23.000000000 +0200
+++ kpatch-0.4.0+git4b2f20e/debian/patches/series       2017-08-11 
23:44:45.861490807 +0200
@@ -1,4 +1,3 @@
 kpatch-build-adjust-dirs.patch
-kpatch-build-works-without-kpatch-kmod.patch
-create-diff-object-fix-WARN-_ONCE-detection-on-newer.patch
-kmod-core-use-save_stack_trace_tsk-backport.patch
+fix-uname-p.patch
+respect-cppflags.patch
diff -u -N -r kpatch-0.3.2/debian/post-dkms.sh 
kpatch-0.4.0+git4b2f20e/debian/post-dkms.sh
--- kpatch-0.3.2/debian/post-dkms.sh    2016-02-18 17:46:39.000000000 +0100
+++ kpatch-0.4.0+git4b2f20e/debian/post-dkms.sh 2017-08-12 12:56:28.914680838 
+0200
@@ -1,4 +1,5 @@
 #!/bin/bash
 module_version=$1
 kernelver=$2
+mkdir -p /lib/modules/$kernelver/updates/dkms
 cp /var/lib/dkms/kpatch/$module_version/build/kmod/core/Module.symvers 
/lib/modules/$kernelver/updates/dkms/kpatch.Module.symvers

Attachment: signature.asc
Description: PGP signature

Reply via email to