Debian

Available patches from Ubuntu

To see Ubuntu differences wrt. to Debian, write down a grep-dctrl query identifying the packages you're interested in:
grep-dctrl -n -sPackage Sources.Debian
(e.g. -FPackage linux-ntfs or linux-ntfs)

Modified packages are listed below:

Debian ( Changelog | PTS | Bugs ) Ubuntu ( Changelog | txt | LP | Bugs ) | Diff from Ubuntu

Source: kpatch

kpatch (0.8.0-0ubuntu2) focal; urgency=medium * No-change rebuild for libgcc-s1 package name change. -- Matthias Klose <doko@ubuntu.com> Sun, 22 Mar 2020 16:45:05 +0100 kpatch (0.8.0-0ubuntu1) focal; urgency=low [ Benjamin M Romer ] * Upstream bump to 0.8.0 * These remaining patches have been refreshed to apply to the updated upstream: - kpatch-build-adjust-dirs.patch - use-debian-rules-for-ubuntu-builds.patch - ubuntu-kernel-variants.patch * Packaging changes to produce only kpatch and kpatch-build - kpatch-dkms will be deprecated in the upstream soon - kmod-fix-symbol-lookup-on-linux-4.19.patch no longer needed * Enhance ubuntu-kernel-variants.patch to support additional kernel flavors * Added missing devscripts dependency, required by kpatch-build * Added elfutils dependency for ppc64el support * Added gcc plugin devpackage dependency for ppc64el support * Extra patch for xenial shellcheck version [ Matthias Klose ] * Depend on python2-dev instead of python-dev. -- Benjamin M Romer <benjamin.romer@canonical.com> Tue, 21 Jan 2020 16:12:05 +0100 kpatch (0.5.0-0ubuntu2) disco; urgency=medium * Import v0.6 pataches from unstable for v4.19/v5 compat. * Add more shellcheck fixes. -- Dimitri John Ledkov <xnox@ubuntu.com> Mon, 18 Feb 2019 09:39:39 +0100 kpatch (0.5.0-0ubuntu1) bionic; urgency=low * Upstream bump to 0.5.0 (LP: #1763065). * Drop patches that are present in the upstream release: - kpatch-build-works-without-kpatch-kmod.patch - kmod-core-fix-stacktrace_ops-address-function-protot.patch - create-diff-object-fix-WARN-_ONCE-detection-on-newer.patch - use-livepatch-4.5-kernel-features.patch * output-kernel-build-in-debug.patch was dropped to reduce build output. * These remaining patches have been updated to apply to the refreshed upstream: - kpatch-build-adjust-dirs.patch - use-debian-rules-for-ubuntu-builds.patch - ubuntu-kernel-variants.patch * The shellcheck linter is called during packaging, to verify the quality of the scripts used in the package. * List the Ubuntu Kernel Team as the package maintainer in the control file * kmod/core: fix stacktrace_ops 'address' function prototype for 4.6 (LP: #1665613, #1659581) -- Benjamin M Romer <benjamin.romer@canonical.com> Wed, 11 Apr 2018 21:41:51 -0400 kpatch (0.3.2-3ubuntu1) yakkety; urgency=low * Merge from Debian unstable. Remaining changes: - Add additional depends for building Ubuntu kernel - Ubuntu Specific Patches: - output-kernel-build-in-debug.patch - ubuntu-kernel-variants.patch - use-debian-rules-for-ubuntu-builds.patch - use-livepatch-4.5-kernel-features.patch - use-ubuntu-utsrelease-for-kpatch-build.patch - make dpks updates dir in post-dkms.sh script -- Chris J Arges <chris.j.arges@canonical.com> Tue, 16 Aug 2016 08:41:04 -0500

Modifications :
  1. Download patch test/integration/fedora-27/cmdline-string.patch

    --- 0.6.0-0.2/test/integration/fedora-27/cmdline-string.patch 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/fedora-27/cmdline-string.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -diff -Nupr src.orig/fs/proc/cmdline.c src/fs/proc/cmdline.c ---- src.orig/fs/proc/cmdline.c 2017-11-17 15:58:41.126211972 -0500 -+++ src/fs/proc/cmdline.c 2017-11-17 15:58:54.891211972 -0500 -@@ -5,7 +5,7 @@ - - static int cmdline_proc_show(struct seq_file *m, void *v) - { -- seq_printf(m, "%s\n", saved_command_line); -+ seq_printf(m, "%s kpatch=1\n", saved_command_line); - return 0; - } -
  2. Download patch .git/config

    --- 0.6.0-0.2/.git/config 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/.git/config 2019-08-28 17:34:00.000000000 +0000 @@ -0,0 +1,11 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true +[remote "origin"] + url = https://github.com/dynup/kpatch.git + fetch = +refs/heads/*:refs/remotes/origin/* +[branch "master"] + remote = origin + merge = refs/heads/master
  3. Download patch test/integration/fedora-27/module-kvm-fixup.patch

    --- 0.6.0-0.2/test/integration/fedora-27/module-kvm-fixup.patch 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/fedora-27/module-kvm-fixup.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -diff -Nupr src.orig/arch/x86/kvm/vmx.c src/arch/x86/kvm/vmx.c ---- src.orig/arch/x86/kvm/vmx.c 2017-11-17 15:58:19.369211972 -0500 -+++ src/arch/x86/kvm/vmx.c 2017-11-17 15:59:27.980211972 -0500 -@@ -11275,6 +11275,8 @@ static int vmx_check_intercept(struct kv - struct x86_instruction_info *info, - enum x86_intercept_stage stage) - { -+ if (!jiffies) -+ printk("kpatch vmx_check_intercept\n"); - return X86EMUL_CONTINUE; - } -
  4. Download patch .git/refs/heads/master

    --- 0.6.0-0.2/.git/refs/heads/master 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/.git/refs/heads/master 2019-08-28 17:34:00.000000000 +0000 @@ -0,0 +1 @@ +30a7dd677bcc25bd70070f7f9d16a88c190b8b0b
  5. Download patch test/integration/centos-7/multiple.test

    --- 0.6.0-0.2/test/integration/centos-7/multiple.test 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/centos-7/multiple.test 2019-08-28 17:34:00.000000000 +0000 @@ -4,6 +4,10 @@ SCRIPTDIR="$(readlink -f $(dirname $(typ ROOTDIR="$(readlink -f $SCRIPTDIR/../../..)" KPATCH="sudo $ROOTDIR/kpatch/kpatch" +MODULE_PREFIX="test-" +MODULE_POSTFIX=".ko" +TEST_POSTFIX="-LOADED.test" + set -o errexit die() { @@ -12,12 +16,27 @@ die() { } ko_to_test() { - tmp=${1%.ko}-LOADED.test - echo ${tmp#kpatch-} + tmp=${1%${MODULE_POSTFIX}}${TEST_POSTFIX} + echo ${tmp#${MODULE_PREFIX}} } # make sure any modules added here are disjoint -declare -a modules=(kpatch-cmdline-string.ko kpatch-meminfo-string.ko) +declare -a modules +declare -a blacklist=(data-new-LOADED.test) + +for file in "${SCRIPTDIR}"/*"${TEST_POSTFIX}"; do + name=$(basename ${file}) + skip=0 + for bname in "${blacklist[@]}"; do + if [ "${bname}" == "${name}" ]; then + skip=1 + break + fi + done + if [ ${skip} -eq 0 ]; then + modules+=(${MODULE_PREFIX}${name%${TEST_POSTFIX}}${MODULE_POSTFIX}) + fi +done for mod in "${modules[@]}"; do testprog=$(ko_to_test $mod) @@ -33,7 +52,8 @@ for mod in "${modules[@]}"; do $SCRIPTDIR/$testprog || die "$SCRIPTDIR/$testprog failed after loading modules" done -for mod in "${modules[@]}"; do +for ((idx=${#modules[@]}-1 ; idx>=0 ; idx--)); do + mod=${modules[idx]} $KPATCH unload $mod done
  6. Download patch test/integration/fedora-27/multiple.test

    --- 0.6.0-0.2/test/integration/fedora-27/multiple.test 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/fedora-27/multiple.test 2019-08-28 17:34:00.000000000 +0000 @@ -4,6 +4,10 @@ SCRIPTDIR="$(readlink -f $(dirname $(typ ROOTDIR="$(readlink -f $SCRIPTDIR/../../..)" KPATCH="sudo $ROOTDIR/kpatch/kpatch" +MODULE_PREFIX="test-" +MODULE_POSTFIX=".ko" +TEST_POSTFIX="-LOADED.test" + set -o errexit die() { @@ -12,12 +16,27 @@ die() { } ko_to_test() { - tmp=${1%.ko}-LOADED.test - echo ${tmp#kpatch-} + tmp=${1%${MODULE_POSTFIX}}${TEST_POSTFIX} + echo ${tmp#${MODULE_PREFIX}} } # make sure any modules added here are disjoint -declare -a modules=(kpatch-cmdline-string.ko kpatch-meminfo-string.ko) +declare -a modules +declare -a blacklist=(meminfo-cmdline-rebuild-SLOW-LOADED.test) + +for file in "${SCRIPTDIR}"/*"${TEST_POSTFIX}"; do + name=$(basename ${file}) + skip=0 + for bname in "${blacklist[@]}"; do + if [ "${bname}" == "${name}" ]; then + skip=1 + break + fi + done + if [ ${skip} -eq 0 ]; then + modules+=(${MODULE_PREFIX}${name%${TEST_POSTFIX}}${MODULE_POSTFIX}) + fi +done for mod in "${modules[@]}"; do testprog=$(ko_to_test $mod)
  7. Download patch test/integration/fedora-27/meminfo-string-LOADED.test

    --- 0.6.0-0.2/test/integration/fedora-27/meminfo-string-LOADED.test 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/fedora-27/meminfo-string-LOADED.test 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -#!/bin/bash - -grep VMALLOCCHUNK /proc/meminfo
  8. Download patch test/integration/fedora-27/meminfo-cmdline-rebuild-SLOW-LOADED.test

    --- 0.6.0-0.2/test/integration/fedora-27/meminfo-cmdline-rebuild-SLOW-LOADED.test 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/fedora-27/meminfo-cmdline-rebuild-SLOW-LOADED.test 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -#!/bin/bash - -grep VMALLOCCHUNK /proc/meminfo && grep kpatch=1 /proc/cmdline
  9. Download patch README.md

    --- 0.6.0-0.2/README.md 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/README.md 2019-08-28 17:34:00.000000000 +0000 @@ -44,6 +44,9 @@ sudo dnf install pesign yum-utils openss sudo dnf builddep kernel-${UNAME%.*} sudo dnf debuginfo-install kernel-${UNAME%.*} +# required on ppc64le +sudo dnf install gcc-plugin-devel + # optional, but highly recommended sudo dnf install ccache ccache --max-size=5G @@ -75,6 +78,9 @@ sudo yum install pesign yum-utils zlib-d sudo yum-builddep kernel-${UNAME%.*} sudo debuginfo-install kernel-${UNAME%.*} +# required on ppc64le +sudo yum install gcc-plugin-devel + # optional, but highly recommended sudo yum install https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/c/ccache-3.3.4-1.el7.x86_64.rpm ccache --max-size=5G @@ -152,7 +158,7 @@ ccache --max-size=5G sudo yum install patchutils ``` -#### Ubuntu 14.04 +#### Ubuntu *NOTE: You'll need about 15GB of free disk space for the kpatch-build cache in `~/.kpatch` and for ccache.* @@ -166,9 +172,13 @@ apt-get install make gcc libelf-dev Install the dependencies for the "kpatch-build" command: ```bash -apt-get install dpkg-dev devscripts +apt-get install dpkg-dev devscripts elfutils apt-get build-dep linux +# required on ppc64le +# e.g., on Ubuntu 18.04 for gcc-7.3 +apt-get install gcc-7-plugin-dev + # optional, but highly recommended apt-get install ccache ccache --max-size=5G @@ -232,6 +242,10 @@ Install the dependencies for the "kpatch apt-get install dpkg-dev apt-get build-dep linux + # required on ppc64le + # e.g., on stretch for gcc-6.3 + apt-get install gcc-6-plugin-dev + # optional, but highly recommended apt-get install ccache ccache --max-size=5G @@ -459,11 +473,10 @@ Limitations supported. kpatch-build will return an error if the patch attempts to do so. -- Patches which modify statically allocated data are not supported. - kpatch-build will detect that and return an error. (In the future - we will add a facility to support it. It will probably require the - user to write code which runs at patch module loading time which manually - updates the data.) +- Patches which modify statically allocated data are not directly supported. + kpatch-build will detect that and return an error. This limitation can be + overcome by using callbacks or shadow variables, as described in the + [Patch Author Guide](doc/patch-author-guide.md). - Patches which change the way a function interacts with dynamically allocated data might be safe, or might not. It isn't possible for @@ -634,9 +647,27 @@ sys_nanosleep(), etc?** **Q. Can you patch out-of-tree modules?** -- Yes, though it's currently a bit of a manual process. See this - [message](https://www.redhat.com/archives/kpatch/2015-June/msg00004.html) on - the kpatch mailing list for more information. +Yes! There's a few requirements, and the feature is still in its infancy. + +1. You need to use the `--oot-module` flag to specify the version of the +module that's currently running on the machine. +2. `--sourcedir` has to be passed with a directory containing the same +version of code as the running module, all set up and ready to build with a +`make` command. For example, some modules need `autogen.sh` and +`./configure` to have been run with the appropriate flags to match the +currently-running module. +3. If the `Module.symvers` file for the out-of-tree module doesn't appear +in the root of the provided source directory, a symlink needs to be created +in that directory that points to its actual location. +4. Usually you'll need to pass the `--target` flag as well, to specify the +proper `make` target names. +5. This has only been tested for a single out-of-tree module per patch, and +not for out-of-tree modules with dependencies on other out-of-tree modules +built separately. + +***Sample invocation*** + +`kpatch-build --sourcedir ~/test/ --target default --oot-module /lib/modules/$(uname -r)/extra/test.ko test.patch` Get involved
  10. Download patch kpatch-build/lookup.c
  11. Download patch .git/hooks/pre-push.sample

    --- 0.6.0-0.2/.git/hooks/pre-push.sample 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/.git/hooks/pre-push.sample 2019-08-28 17:33:59.000000000 +0000 @@ -0,0 +1,53 @@ +#!/bin/sh + +# An example hook script to verify what is about to be pushed. Called by "git +# push" after it has checked the remote status, but before anything has been +# pushed. If this script exits with a non-zero status nothing will be pushed. +# +# This hook is called with the following parameters: +# +# $1 -- Name of the remote to which the push is being done +# $2 -- URL to which the push is being done +# +# If pushing without using a named remote those arguments will be equal. +# +# Information about the commits which are being pushed is supplied as lines to +# the standard input in the form: +# +# <local ref> <local sha1> <remote ref> <remote sha1> +# +# This sample shows how to prevent push of commits where the log message starts +# with "WIP" (work in progress). + +remote="$1" +url="$2" + +z40=0000000000000000000000000000000000000000 + +while read local_ref local_sha remote_ref remote_sha +do + if [ "$local_sha" = $z40 ] + then + # Handle delete + : + else + if [ "$remote_sha" = $z40 ] + then + # New branch, examine all commits + range="$local_sha" + else + # Update to existing branch, examine new commits + range="$remote_sha..$local_sha" + fi + + # Check for WIP commit + commit=`git rev-list -n 1 --grep '^WIP' "$range"` + if [ -n "$commit" ] + then + echo >&2 "Found WIP commit in $local_ref, not pushing" + exit 1 + fi + fi +done + +exit 0
  12. Download patch kpatch-build/create-diff-object.c
  13. Download patch kmod/patch/Makefile

    --- 0.6.0-0.2/kmod/patch/Makefile 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/kmod/patch/Makefile 2019-08-28 17:34:00.000000000 +0000 @@ -11,13 +11,15 @@ KBUILD_CFLAGS_MODULE += -mcmodel=large endif obj-m += $(KPATCH_NAME).o +ldflags-y += -T $(src)/kpatch.lds +extra-y := kpatch.lds -$(KPATCH_NAME)-objs += patch-hook.o kpatch.lds output.o +$(KPATCH_NAME)-objs += patch-hook.o output.o all: $(KPATCH_NAME).ko $(KPATCH_NAME).ko: - $(KPATCH_MAKE) $(KPATCH_NAME).ko + $(KPATCH_MAKE) patch-hook.o: patch-hook.c kpatch-patch-hook.c livepatch-patch-hook.c $(KPATCH_MAKE) patch-hook.o
  14. Download patch test/integration/fedora-27/gcc-mangled-3.patch

    --- 0.6.0-0.2/test/integration/fedora-27/gcc-mangled-3.patch 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/fedora-27/gcc-mangled-3.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -ensure that __cmpxchg_double_slab.isra.45 and -__cmpxchg_double_slab.isra.45.part.46 aren't correlated. - -diff -Nupr src.orig/mm/slub.c src/mm/slub.c ---- src.orig/mm/slub.c 2017-11-17 15:58:51.157211972 -0500 -+++ src/mm/slub.c 2017-11-17 15:59:07.361211972 -0500 -@@ -5824,6 +5824,9 @@ void get_slabinfo(struct kmem_cache *s, - int node; - struct kmem_cache_node *n; - -+ if (!jiffies) -+ printk("slabinfo\n"); -+ - for_each_kmem_cache_node(s, node, n) { - nr_slabs += node_nr_slabs(n); - nr_objs += node_nr_objs(n);
  15. Download patch debian/patches/kpatch-build-works-without-kpatch-kmod.patch

    --- 0.6.0-0.2/debian/patches/kpatch-build-works-without-kpatch-kmod.patch 2018-06-15 22:23:46.000000000 +0000 +++ 0.8.0-0ubuntu2/debian/patches/kpatch-build-works-without-kpatch-kmod.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -Description: only warn if kpatch module isn't available - kpatch-build checks if the kpatch module is installed properly. In cases where we build - livepatch modules this is not necessary. Turn these errors into warnings and let the user - proceed. -Author: Chris J Arges <chris.j.arges@canonical.com> -Last-Update: 2016-01-20 - ---- a/kpatch-build/kpatch-build -+++ b/kpatch-build/kpatch-build -@@ -109,7 +109,6 @@ - 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 - return - fi -@@ -340,7 +339,7 @@ - - find_dirs || die "can't find supporting tools" - --[[ -e "$SYMVERSFILE" ]] || die "can't find core module Module.symvers" -+[[ -e "$SYMVERSFILE" ]] || warn "can't find core module Module.symvers" - - - if [[ $SKIPGCCCHECK -eq 0 ]]; then
  16. Download patch kpatch-build/lookup.h

    --- 0.6.0-0.2/kpatch-build/lookup.h 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/kpatch-build/lookup.h 2019-08-28 17:34:00.000000000 +0000 @@ -14,7 +14,7 @@ struct sym_compare_type { int type; }; -struct lookup_table *lookup_open(char *obj_path, char *symvers_path, +struct lookup_table *lookup_open(char *symtab_path, char *symvers_path, char *hint, struct sym_compare_type *locals); void lookup_close(struct lookup_table *table); int lookup_local_symbol(struct lookup_table *table, char *name,
  17. Download patch .git/hooks/pre-receive.sample

    --- 0.6.0-0.2/.git/hooks/pre-receive.sample 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/.git/hooks/pre-receive.sample 2019-08-28 17:33:59.000000000 +0000 @@ -0,0 +1,24 @@ +#!/bin/sh +# +# An example hook script to make use of push options. +# The example simply echoes all push options that start with 'echoback=' +# and rejects all pushes when the "reject" push option is used. +# +# To enable this hook, rename this file to "pre-receive". + +if test -n "$GIT_PUSH_OPTION_COUNT" +then + i=0 + while test "$i" -lt "$GIT_PUSH_OPTION_COUNT" + do + eval "value=\$GIT_PUSH_OPTION_$i" + case "$value" in + echoback=*) + echo "echo from the pre-receive-hook: ${value#*=}" >&2 + ;; + reject) + exit 1 + esac + i=$((i + 1)) + done +fi
  18. Download patch debian/rules

    --- 0.6.0-0.2/debian/rules 2019-01-07 19:34:02.000000000 +0000 +++ 0.8.0-0ubuntu2/debian/rules 2019-08-28 17:37:11.000000000 +0000 @@ -12,13 +12,4 @@ export BUILDMOD=no override_dh_auto_install: dh_auto_install -- PREFIX=/usr -override_dh_auto_test: - -dh_auto_test -override_dh_install: - mkdir -p debian/tmp/usr/src/kpatch-$(VERSION) - dh_install -pkpatch-dkms -X.o -X.ko -Xkmod/patch kmod/ usr/src/kpatch-$(VERSION) - dh_install -pkpatch-dkms Makefile.inc usr/src/kpatch-$(VERSION) - dh_install -pkpatch-dkms debian/post-dkms.sh usr/src/kpatch-$(VERSION) - dh_dkms -V $(VERSION) - dh_install
  19. Download patch test/integration/fedora-27/meminfo-cmdline-rebuild-SLOW.patch

    --- 0.6.0-0.2/test/integration/fedora-27/meminfo-cmdline-rebuild-SLOW.patch 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/fedora-27/meminfo-cmdline-rebuild-SLOW.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ -diff -Nupr src.orig/fs/proc/cmdline.c src/fs/proc/cmdline.c ---- src.orig/fs/proc/cmdline.c 2017-11-17 15:58:41.126211972 -0500 -+++ src/fs/proc/cmdline.c 2017-11-17 15:59:19.323211972 -0500 -@@ -5,7 +5,7 @@ - - static int cmdline_proc_show(struct seq_file *m, void *v) - { -- seq_printf(m, "%s\n", saved_command_line); -+ seq_printf(m, "%s kpatch=1\n", saved_command_line); - return 0; - } - -diff -Nupr src.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c ---- src.orig/fs/proc/meminfo.c 2017-11-17 15:58:41.113211972 -0500 -+++ src/fs/proc/meminfo.c 2017-11-17 15:59:19.323211972 -0500 -@@ -132,7 +132,7 @@ static int meminfo_proc_show(struct seq_ - seq_printf(m, "VmallocTotal: %8lu kB\n", - (unsigned long)VMALLOC_TOTAL >> 10); - show_val_kb(m, "VmallocUsed: ", 0ul); -- show_val_kb(m, "VmallocChunk: ", 0ul); -+ show_val_kb(m, "VMALLOCCHUNK: ", 0ul); - - #ifdef CONFIG_MEMORY_FAILURE - seq_printf(m, "HardwareCorrupted: %5lu kB\n", -diff -Nupr src.orig/include/linux/kernel.h src/include/linux/kernel.h ---- src.orig/include/linux/kernel.h 2017-11-17 15:58:48.205211972 -0500 -+++ src/include/linux/kernel.h 2017-11-17 15:59:19.376211972 -0500 -@@ -2,6 +2,7 @@ - #define _LINUX_KERNEL_H - - -+ - #include <stdarg.h> - #include <linux/linkage.h> - #include <linux/stddef.h>
  20. Download patch test/integration/centos-7/meminfo-cmdline-rebuild-SLOW.patch.disabled

    --- 0.6.0-0.2/test/integration/centos-7/meminfo-cmdline-rebuild-SLOW.patch.disabled 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/centos-7/meminfo-cmdline-rebuild-SLOW.patch.disabled 2019-08-28 17:34:00.000000000 +0000 @@ -0,0 +1,37 @@ +Disabled due to CSWTITCH issue from https://github.com/dynup/kpatch/issues/876 +--- +diff -Nupr src.orig/fs/proc/cmdline.c src/fs/proc/cmdline.c +--- src.orig/fs/proc/cmdline.c 2017-09-22 15:27:21.698056175 -0400 ++++ src/fs/proc/cmdline.c 2017-09-22 15:27:37.842123028 -0400 +@@ -5,7 +5,7 @@ + + static int cmdline_proc_show(struct seq_file *m, void *v) + { +- seq_printf(m, "%s\n", saved_command_line); ++ seq_printf(m, "%s kpatch=1\n", saved_command_line); + return 0; + } + +diff -Nupr src.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c +--- src.orig/fs/proc/meminfo.c 2017-09-22 15:27:21.699056179 -0400 ++++ src/fs/proc/meminfo.c 2017-09-22 15:27:37.843123032 -0400 +@@ -99,7 +99,7 @@ static int meminfo_proc_show(struct seq_ + "Committed_AS: %8lu kB\n" + "VmallocTotal: %8lu kB\n" + "VmallocUsed: %8lu kB\n" +- "VmallocChunk: %8lu kB\n" ++ "VMALLOCCHUNK: %8lu kB\n" + #ifdef CONFIG_MEMORY_FAILURE + "HardwareCorrupted: %5lu kB\n" + #endif +diff -Nupr src.orig/include/linux/kernel.h src/include/linux/kernel.h +--- src.orig/include/linux/kernel.h 2017-09-22 15:27:20.379050713 -0400 ++++ src/include/linux/kernel.h 2017-09-22 15:27:37.843123032 -0400 +@@ -2,6 +2,7 @@ + #define _LINUX_KERNEL_H + + ++ + #include <stdarg.h> + #include <linux/linkage.h> + #include <linux/stddef.h>
  21. Download patch kpatch-build/log.h

    --- 0.6.0-0.2/kpatch-build/log.h 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/kpatch-build/log.h 2019-08-28 17:34:00.000000000 +0000 @@ -2,13 +2,14 @@ #define _LOG_H_ #include <error.h> +#include "kpatch.h" /* Files that include log.h must define loglevel and childobj */ extern enum loglevel loglevel; extern char *childobj; #define ERROR(format, ...) \ - error(1, 0, "ERROR: %s: %s: %d: " format, childobj, __FUNCTION__, __LINE__, ##__VA_ARGS__) + error(EXIT_STATUS_ERROR, 0, "ERROR: %s: %s: %d: " format, childobj, __FUNCTION__, __LINE__, ##__VA_ARGS__) #define log_debug(format, ...) log(DEBUG, format, ##__VA_ARGS__) #define log_normal(format, ...) log(NORMAL, "%s: " format, childobj, ##__VA_ARGS__)
  22. Download patch debian/patches/xenial-shellcheck-fixes.patch

    --- 0.6.0-0.2/debian/patches/xenial-shellcheck-fixes.patch 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/debian/patches/xenial-shellcheck-fixes.patch 2019-08-28 17:37:11.000000000 +0000 @@ -0,0 +1,40 @@ +--- a/kpatch-build/kpatch-build ++++ b/kpatch-build/kpatch-build +@@ -689,7 +689,9 @@ + sublevel="SUBLEVEL =" + fi + ++ # shellcheck disable=SC2016 + pkgname="$(dpkg-query -W -f='${Source}' "linux-image-$ARCHVERSION" | sed s/-signed//)" ++ # shellcheck disable=SC2016 + pkgver="$(dpkg-query -W -f='${Version}' "linux-image-$ARCHVERSION")" + dscname="${pkgname}_${pkgver}.dsc" + +--- a/kpatch-build/kpatch-gcc ++++ b/kpatch-build/kpatch-gcc +@@ -13,6 +13,7 @@ + + declare -a args=("$@") + ++# shellcheck disable=SC2076 + if [[ "$TOOLCHAINCMD" =~ "gcc" ]] ; then + while [ "$#" -gt 0 ]; do + if [ "$1" = "-o" ]; then +--- a/kpatch/kpatch ++++ b/kpatch/kpatch +@@ -310,6 +310,7 @@ + out="$(LC_ALL=C insmod "$module" 2>&1)" + [[ -z "$out" ]] && break + echo "$out" 1>&2 ++ # shellcheck disable=SC2076 + [[ ! "$out" =~ "Device or resource busy" ]] && + die "failed to load module $module" + +@@ -348,6 +349,7 @@ + out="$(export LC_ALL=C; sh -c "echo 0 > $enabled" 2>&1)" + [[ -z "$out" ]] && break + echo "$out" 1>&2 ++ # shellcheck disable=SC2076 + if [[ ! "$out" =~ "Device or resource busy" ]]; then + die "failed to disable module $modname" + fi
  23. Download patch test/integration/centos-7/module-shadow.patch

    --- 0.6.0-0.2/test/integration/centos-7/module-shadow.patch 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/centos-7/module-shadow.patch 2019-08-28 17:34:00.000000000 +0000 @@ -1,22 +1,23 @@ -diff -Nupr src.orig/arch/x86/kvm/vmx.c src/arch/x86/kvm/vmx.c ---- src.orig/arch/x86/kvm/vmx.c 2017-09-22 15:27:20.853052676 -0400 -+++ src/arch/x86/kvm/vmx.c 2017-09-22 15:27:44.742151601 -0400 -@@ -10581,10 +10581,20 @@ static void vmx_leave_nested(struct kvm_ +Index: src/arch/x86/kvm/vmx.c +=================================================================== +--- src.orig/arch/x86/kvm/vmx.c ++++ src/arch/x86/kvm/vmx.c +@@ -11406,10 +11406,20 @@ static void vmx_leave_nested(struct kvm_ * It should only be called before L2 actually succeeded to run, and when * vmcs01 is current (it doesn't leave_guest_mode() or switch vmcss). */ -+#include "kpatch.h" ++#include <linux/livepatch.h> static void nested_vmx_entry_failure(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12, u32 reason, unsigned long qualification) { + int *kpatch; + -+ kpatch = kpatch_shadow_alloc(vcpu, "kpatch", sizeof(*kpatch), -+ GFP_KERNEL); ++ kpatch = klp_shadow_alloc(vcpu, 0, sizeof(*kpatch), ++ GFP_KERNEL, NULL, NULL); + if (kpatch) { -+ kpatch_shadow_get(vcpu, "kpatch"); -+ kpatch_shadow_free(vcpu, "kpatch"); ++ klp_shadow_get(vcpu, 0); ++ klp_shadow_free(vcpu, 0, NULL); + } + load_vmcs12_host_state(vcpu, vmcs12);
  24. Download patch test/integration/fedora-27/macro-printk.patch

    --- 0.6.0-0.2/test/integration/fedora-27/macro-printk.patch 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/fedora-27/macro-printk.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,147 +0,0 @@ -diff -Nupr src.orig/net/ipv4/fib_frontend.c src/net/ipv4/fib_frontend.c ---- src.orig/net/ipv4/fib_frontend.c 2017-11-17 16:16:54.789211972 -0500 -+++ src/net/ipv4/fib_frontend.c 2017-11-17 16:19:58.429211972 -0500 -@@ -740,6 +740,7 @@ errout: - return err; - } - -+#include "kpatch-macros.h" - static int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, - struct netlink_ext_ack *extack) - { -@@ -759,6 +760,7 @@ static int inet_rtm_newroute(struct sk_b - } - - err = fib_table_insert(net, tb, &cfg, extack); -+ KPATCH_PRINTK("[inet_rtm_newroute]: err is %d\n", err); - errout: - return err; - } -diff -Nupr src.orig/net/ipv4/fib_semantics.c src/net/ipv4/fib_semantics.c ---- src.orig/net/ipv4/fib_semantics.c 2017-11-17 16:16:54.789211972 -0500 -+++ src/net/ipv4/fib_semantics.c 2017-11-17 16:21:11.653211972 -0500 -@@ -1026,6 +1026,7 @@ fib_convert_metrics(struct fib_info *fi, - return 0; - } - -+#include "kpatch-macros.h" - struct fib_info *fib_create_info(struct fib_config *cfg, - struct netlink_ext_ack *extack) - { -@@ -1059,6 +1060,7 @@ struct fib_info *fib_create_info(struct - #endif - - err = -ENOBUFS; -+ KPATCH_PRINTK("[fib_create_info]: create error err is %d\n",err); - if (fib_info_cnt >= fib_info_hash_size) { - unsigned int new_size = fib_info_hash_size << 1; - struct hlist_head *new_info_hash; -@@ -1079,6 +1081,7 @@ struct fib_info *fib_create_info(struct - if (!fib_info_hash_size) - goto failure; - } -+ KPATCH_PRINTK("[fib_create_info]: 2 create error err is %d\n",err); - - fi = kzalloc(sizeof(*fi)+nhs*sizeof(struct fib_nh), GFP_KERNEL); - if (!fi) -@@ -1093,6 +1096,8 @@ struct fib_info *fib_create_info(struct - } else { - fi->fib_metrics = (struct dst_metrics *)&dst_default_metrics; - } -+ KPATCH_PRINTK("[fib_create_info]: 3 create error err is %d\n",err); -+ - fib_info_cnt++; - fi->fib_net = net; - fi->fib_protocol = cfg->fc_protocol; -@@ -1110,6 +1115,7 @@ struct fib_info *fib_create_info(struct - if (!nexthop_nh->nh_pcpu_rth_output) - goto failure; - } endfor_nexthops(fi) -+ KPATCH_PRINTK("[fib_create_info]: 4 create error err is %d\n",err); - - err = fib_convert_metrics(fi, cfg); - if (err) -@@ -1174,6 +1180,9 @@ struct fib_info *fib_create_info(struct - #endif - } - -+ KPATCH_PRINTK("[fib_create_info]: 5 create error err is %d\n",err); -+ KPATCH_PRINTK("[fib_create_info]: 6 create error err is %d\n",err); -+ - if (fib_props[cfg->fc_type].error) { - if (cfg->fc_gw || cfg->fc_oif || cfg->fc_mp) { - NL_SET_ERR_MSG(extack, -@@ -1194,6 +1203,7 @@ struct fib_info *fib_create_info(struct - goto err_inval; - } - } -+ KPATCH_PRINTK("[fib_create_info]: 7 create error err is %d\n",err); - - if (cfg->fc_scope > RT_SCOPE_HOST) { - NL_SET_ERR_MSG(extack, "Invalid scope"); -@@ -1232,6 +1242,7 @@ struct fib_info *fib_create_info(struct - if (linkdown == fi->fib_nhs) - fi->fib_flags |= RTNH_F_LINKDOWN; - } -+ KPATCH_PRINTK("[fib_create_info]: 8 create error err is %d\n",err); - - if (fi->fib_prefsrc && !fib_valid_prefsrc(cfg, fi->fib_prefsrc)) { - NL_SET_ERR_MSG(extack, "Invalid prefsrc address"); -@@ -1242,6 +1253,7 @@ struct fib_info *fib_create_info(struct - fib_info_update_nh_saddr(net, nexthop_nh); - fib_add_weight(fi, nexthop_nh); - } endfor_nexthops(fi) -+ KPATCH_PRINTK("[fib_create_info]: 9 create error err is %d\n",err); - - fib_rebalance(fi); - -@@ -1253,6 +1265,7 @@ link_it: - ofi->fib_treeref++; - return ofi; - } -+ KPATCH_PRINTK("[fib_create_info]: 10 create error err is %d\n",err); - - fi->fib_treeref++; - refcount_set(&fi->fib_clntref, 1); -@@ -1276,6 +1289,7 @@ link_it: - hlist_add_head(&nexthop_nh->nh_hash, head); - } endfor_nexthops(fi) - spin_unlock_bh(&fib_info_lock); -+ KPATCH_PRINTK("[fib_create_info]: 11 create error err is %d\n",err); - return fi; - - err_inval: -@@ -1286,6 +1300,7 @@ failure: - fi->fib_dead = 1; - free_fib_info(fi); - } -+ KPATCH_PRINTK("[fib_create_info]: 12 create error err is %d\n",err); - - return ERR_PTR(err); - } -diff -Nupr src.orig/net/ipv4/fib_trie.c src/net/ipv4/fib_trie.c ---- src.orig/net/ipv4/fib_trie.c 2017-11-17 16:16:54.789211972 -0500 -+++ src/net/ipv4/fib_trie.c 2017-11-17 16:22:11.702211972 -0500 -@@ -1116,6 +1116,7 @@ static bool fib_valid_key_len(u32 key, u - } - - /* Caller must hold RTNL. */ -+#include "kpatch-macros.h" - int fib_table_insert(struct net *net, struct fib_table *tb, - struct fib_config *cfg, struct netlink_ext_ack *extack) - { -@@ -1138,11 +1139,14 @@ int fib_table_insert(struct net *net, st - - pr_debug("Insert table=%u %08x/%d\n", tb->tb_id, key, plen); - -+ KPATCH_PRINTK("[fib_table_insert]: start\n"); - fi = fib_create_info(cfg, extack); - if (IS_ERR(fi)) { - err = PTR_ERR(fi); -+ KPATCH_PRINTK("[fib_table_insert]: create error err is %d\n",err); - goto err; - } -+ KPATCH_PRINTK("[fib_table_insert]: cross\n"); - - l = fib_find_node(t, &tp, key); - fa = l ? fib_find_alias(&l->leaf, slen, tos, fi->fib_priority,
  25. Download patch kpatch-build/create-klp-module.c

    --- 0.6.0-0.2/kpatch-build/create-klp-module.c 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/kpatch-build/create-klp-module.c 2019-08-28 17:34:00.000000000 +0000 @@ -57,9 +57,7 @@ static struct symbol *find_or_add_ksym_t if (!rela) ERROR("name of ksym not found?"); - name = strdup(strings + rela->addend); - if (!name) - ERROR("strdup"); + name = strings + rela->addend; /* Get objname of ksym */ rela = find_rela_by_offset(ksymsec->rela, @@ -67,9 +65,7 @@ static struct symbol *find_or_add_ksym_t if (!rela) ERROR("objname of ksym not found?"); - objname = strdup(strings + rela->addend); - if (!objname) - ERROR("strdup"); + objname = strings + rela->addend; snprintf(pos, 32, "%lu", ksym->pos); /* .klp.sym.objname.name,pos */ @@ -81,7 +77,7 @@ static struct symbol *find_or_add_ksym_t return sym; } - ALLOC_LINK(sym, &kelf->symbols); + ALLOC_LINK(sym, NULL); sym->name = strdup(buf); if (!sym->name) ERROR("strdup"); @@ -93,6 +89,25 @@ static struct symbol *find_or_add_ksym_t */ sym->sym.st_shndx = SHN_LIVEPATCH; sym->sym.st_info = GELF_ST_INFO(sym->bind, sym->type); + /* + * Figure out where to put the new symbol: + * a) locals need to be grouped together, before globals + * b) globals can be tacked into the end of the list + */ + if (is_local_sym(sym)) { + struct list_head *head; + struct symbol *s; + + head = &kelf->symbols; + list_for_each_entry(s, &kelf->symbols, list) { + if (!is_local_sym(s)) + break; + head = &s->list; + } + list_add_tail(&sym->list, head); + } else { + list_add_tail(&sym->list, &kelf->symbols); + } return sym; } @@ -183,9 +198,7 @@ static void create_klp_relasecs_and_syms if (!rela) ERROR("find_rela_by_offset"); - objname = strdup(strings + rela->addend); - if (!objname) - ERROR("strdup"); + objname = strings + rela->addend; /* Get the .kpatch.symbol entry for the rela src */ rela = find_rela_by_offset(krelasec->rela, @@ -231,7 +244,6 @@ static void create_klp_relasecs_and_syms static void create_klp_arch_sections(struct kpatch_elf *kelf, char *strings) { struct section *karch, *sec, *base = NULL; - struct kpatch_arch *entries; struct rela *rela, *rela2; char *secname, *objname = NULL; char buf[256]; @@ -241,11 +253,10 @@ static void create_klp_arch_sections(str if (!karch) return; - entries = karch->data->d_buf; - nr = karch->data->d_size / sizeof(*entries); + nr = karch->data->d_size / sizeof(struct kpatch_arch); for (index = 0; index < nr; index++) { - offset = index * sizeof(*entries); + offset = index * sizeof(struct kpatch_arch); /* Get the base section (.parainstructions or .altinstructions) */ rela = find_rela_by_offset(karch->rela, @@ -263,9 +274,7 @@ static void create_klp_arch_sections(str if (!rela) ERROR("find_rela_by_offset"); - objname = strdup(strings + rela->addend); - if (!objname) - ERROR("strdup"); + objname = strings + rela->addend; /* Example: .klp.arch.vmlinux..parainstructions */ snprintf(buf, 256, "%s%s.%s", KLP_ARCH_PREFIX, objname, base->name); @@ -292,6 +301,27 @@ static void create_klp_arch_sections(str * single .klp.arch.vmlinux..parainstructions section */ old_size = sec->data->d_size; + + /* + * Due to a quirk in how .parainstructions gets linked, the + * section size doesn't encompass the last 4 bytes of the last + * entry. Align the old size properly before merging. + */ + if (!strcmp(base->name, ".parainstructions")) { + char *str; + static int align_mask = 0; + + if (!align_mask) { + str = getenv("PARA_STRUCT_SIZE"); + if (!str) + ERROR("PARA_STRUCT_SIZE not set"); + + align_mask = atoi(str) - 1; + } + + old_size = (old_size + align_mask) & ~align_mask; + } + new_size = old_size + base->data->d_size; sec->data->d_buf = realloc(sec->data->d_buf, new_size); sec->data->d_size = new_size; @@ -456,6 +486,9 @@ int main(int argc, char *argv[]) /* Rebuild rela sections, new klp rela sections will be rebuilt too. */ symtab = find_section_by_name(&kelf->sections, ".symtab"); + if (!symtab) + ERROR("missing .symtab section"); + list_for_each_entry(sec, &kelf->sections, list) { if (!is_rela_section(sec)) continue;
  26. Download patch kpatch-build/gcc-plugins/gcc-common.h

    --- 0.6.0-0.2/kpatch-build/gcc-plugins/gcc-common.h 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/kpatch-build/gcc-plugins/gcc-common.h 2019-08-28 17:34:00.000000000 +0000 @@ -96,6 +96,10 @@ #include "predict.h" #include "ipa-utils.h" +#if BUILDING_GCC_VERSION >= 8000 +#include "stringpool.h" +#endif + #if BUILDING_GCC_VERSION >= 4009 #include "attribs.h" #include "varasm.h"
  27. Download patch debian/control

    --- 0.6.0-0.2/debian/control 2018-06-15 22:23:46.000000000 +0000 +++ 0.8.0-0ubuntu2/debian/control 2020-01-21 15:11:09.000000000 +0000 @@ -1,16 +1,19 @@ Source: kpatch Section: kernel Priority: optional -Maintainer: Chris J Arges <chris.j.arges@canonical.com> -Build-Depends: debhelper (>= 9), libelf-dev, dkms, shellcheck +Maintainer: Ubuntu Kernel Team <kernel-team@lists.ubuntu.com> +XSBC-Original-Maintainer: Chris J Arges <chris.j.arges@canonical.com> +Build-Depends: debhelper (>= 9), libelf-dev, shellcheck, gcc-9-plugin-dev Standards-Version: 3.9.8 Homepage: http://github.com/dynup/kpatch -Vcs-Git: https://salsa.debian.org/debian/kpatch.git -Vcs-Browser: https://salsa.debian.org/debian/kpatch +#Vcs-Git: git://anonscm.debian.org/collab-maint/kpatch.git +#Vcs-Browser: https://anonscm.debian.org/gitweb/?p=collab-maint/kpatch.git;a=summary Package: kpatch -Architecture: linux-amd64 -Depends: ${shlibs:Depends}, ${misc:Depends}, binutils +Architecture: any +Replaces: kpatch-dkms +Depends: ${shlibs:Depends}, ${misc:Depends}, + linux-headers-amd64 | linux-headers-generic 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 @@ -19,20 +22,15 @@ Description: Runtime tools for Kpatch for scheduled reboot windows. It gives more control over up-time without sacrificing security or stability. -Package: kpatch-dkms -Architecture: linux-amd64 -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 - versions. - Package: kpatch-build -Architecture: linux-amd64 -Depends: ${shlibs:Depends}, ${misc:Depends}, dpkg-dev, linux-source, kernel-wedge, gawk, bc +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, dpkg-dev, debhelper (>= 5), + dh-systemd, cpio, kernel-wedge, kmod, makedumpfile, libelf-dev, devscripts, + libnewt-dev, libiberty-dev, rsync, libdw-dev, libpci-dev, pkg-config, flex, + bison, libunwind8-dev, openssl, libssl-dev, libaudit-dev, bc, python2-dev, gawk, + libudev-dev, autoconf, automake, libtool, uuid-dev, xmlto, docbook-utils, + ghostscript, transfig, bzip2, sharutils, asciidoc, elfutils Suggests: ccache Description: Build Tools for Kpatch and Livepatch kpatch-build is a tool that can build both kpatch and livepatch modules from a given patch. -
  28. Download patch kpatch-build/kpatch-build
  29. Download patch test/integration/fedora-27/gcc-constprop.patch

    --- 0.6.0-0.2/test/integration/fedora-27/gcc-constprop.patch 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/fedora-27/gcc-constprop.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -ensure timekeeping_forward_now.constprop.8 and -timekeeping_forward_now.constprop.9 are correlated. - -diff -Nupr src.orig/kernel/time/timekeeping.c src/kernel/time/timekeeping.c ---- src.orig/kernel/time/timekeeping.c 2017-11-17 15:58:51.500211972 -0500 -+++ src/kernel/time/timekeeping.c 2017-11-17 15:59:03.810211972 -0500 -@@ -1206,6 +1206,9 @@ void do_gettimeofday(struct timeval *tv) - { - struct timespec64 now; - -+ if (!tv) -+ return; -+ - getnstimeofday64(&now); - tv->tv_sec = now.tv_sec; - tv->tv_usec = now.tv_nsec/1000;
  30. Download patch test/integration/fedora-27/cmdline-string-LOADED.test

    --- 0.6.0-0.2/test/integration/fedora-27/cmdline-string-LOADED.test 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/fedora-27/cmdline-string-LOADED.test 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -#!/bin/bash - -grep kpatch=1 /proc/cmdline
  31. Download patch test/integration/fedora-27/meminfo-init2-FAIL.patch

    --- 0.6.0-0.2/test/integration/fedora-27/meminfo-init2-FAIL.patch 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/fedora-27/meminfo-init2-FAIL.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ -diff -Nupr src.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c ---- src.orig/fs/proc/meminfo.c 2017-11-17 15:58:41.113211972 -0500 -+++ src/fs/proc/meminfo.c 2017-11-17 15:59:21.276211972 -0500 -@@ -51,6 +51,8 @@ static int meminfo_proc_show(struct seq_ - unsigned long pages[NR_LRU_LISTS]; - int lru; - -+ printk("a\n"); -+ - si_meminfo(&i); - si_swapinfo(&i); - committed = percpu_counter_read_positive(&vm_committed_as); -@@ -175,6 +177,7 @@ static const struct file_operations memi - - static int __init proc_meminfo_init(void) - { -+ printk("a\n"); - proc_create("meminfo", 0, NULL, &meminfo_proc_fops); - return 0; - }
  32. Download patch test/integration/fedora-27/meminfo-cmdline-rebuild-SLOW.patch.disabled

    --- 0.6.0-0.2/test/integration/fedora-27/meminfo-cmdline-rebuild-SLOW.patch.disabled 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/fedora-27/meminfo-cmdline-rebuild-SLOW.patch.disabled 2019-08-28 17:34:00.000000000 +0000 @@ -0,0 +1,40 @@ +Disabled due to https://github.com/dynup/kpatch/issues/767 +--- +Index: src/fs/proc/cmdline.c +=================================================================== +--- src.orig/fs/proc/cmdline.c ++++ src/fs/proc/cmdline.c +@@ -7,7 +7,7 @@ + static int cmdline_proc_show(struct seq_file *m, void *v) + { + seq_puts(m, saved_command_line); +- seq_putc(m, '\n'); ++ seq_puts(m, " kpatch=1\n"); + return 0; + } + +Index: src/fs/proc/meminfo.c +=================================================================== +--- src.orig/fs/proc/meminfo.c ++++ src/fs/proc/meminfo.c +@@ -120,7 +120,7 @@ static int meminfo_proc_show(struct seq_ + seq_printf(m, "VmallocTotal: %8lu kB\n", + (unsigned long)VMALLOC_TOTAL >> 10); + show_val_kb(m, "VmallocUsed: ", 0ul); +- show_val_kb(m, "VmallocChunk: ", 0ul); ++ show_val_kb(m, "VMALLOCCHUNK: ", 0ul); + + #ifdef CONFIG_MEMORY_FAILURE + seq_printf(m, "HardwareCorrupted: %5lu kB\n", +Index: src/include/linux/kernel.h +=================================================================== +--- src.orig/include/linux/kernel.h ++++ src/include/linux/kernel.h +@@ -3,6 +3,7 @@ + #define _LINUX_KERNEL_H + + ++ + #include <stdarg.h> + #include <linux/linkage.h> + #include <linux/stddef.h>
  33. Download patch test/integration/centos-7/macro-printk.patch

    --- 0.6.0-0.2/test/integration/centos-7/macro-printk.patch 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/centos-7/macro-printk.patch 2019-08-28 17:34:00.000000000 +0000 @@ -1,7 +1,8 @@ -diff -Nupr src.orig/net/ipv4/fib_frontend.c src/net/ipv4/fib_frontend.c ---- src.orig/net/ipv4/fib_frontend.c 2017-09-22 16:52:10.646110299 -0400 -+++ src/net/ipv4/fib_frontend.c 2017-09-22 16:55:14.395870305 -0400 -@@ -633,6 +633,7 @@ errout: +Index: src/net/ipv4/fib_frontend.c +=================================================================== +--- src.orig/net/ipv4/fib_frontend.c ++++ src/net/ipv4/fib_frontend.c +@@ -685,6 +685,7 @@ errout: return err; } @@ -9,7 +10,7 @@ diff -Nupr src.orig/net/ipv4/fib_fronten static int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh) { struct net *net = sock_net(skb->sk); -@@ -651,6 +652,7 @@ static int inet_rtm_newroute(struct sk_b +@@ -703,6 +704,7 @@ static int inet_rtm_newroute(struct sk_b } err = fib_table_insert(net, tb, &cfg); @@ -17,10 +18,11 @@ diff -Nupr src.orig/net/ipv4/fib_fronten errout: return err; } -diff -Nupr src.orig/net/ipv4/fib_semantics.c src/net/ipv4/fib_semantics.c ---- src.orig/net/ipv4/fib_semantics.c 2017-09-22 16:52:10.645110295 -0400 -+++ src/net/ipv4/fib_semantics.c 2017-09-22 16:54:05.175584004 -0400 -@@ -925,6 +925,7 @@ fib_convert_metrics(struct fib_info *fi, +Index: src/net/ipv4/fib_semantics.c +=================================================================== +--- src.orig/net/ipv4/fib_semantics.c ++++ src/net/ipv4/fib_semantics.c +@@ -969,6 +969,7 @@ fib_convert_metrics(struct fib_info *fi, return 0; } @@ -28,7 +30,7 @@ diff -Nupr src.orig/net/ipv4/fib_semanti struct fib_info *fib_create_info(struct fib_config *cfg) { int err; -@@ -949,6 +950,7 @@ struct fib_info *fib_create_info(struct +@@ -993,6 +994,7 @@ struct fib_info *fib_create_info(struct #endif err = -ENOBUFS; @@ -36,7 +38,7 @@ diff -Nupr src.orig/net/ipv4/fib_semanti if (fib_info_cnt >= fib_info_hash_size) { unsigned int new_size = fib_info_hash_size << 1; struct hlist_head *new_info_hash; -@@ -969,6 +971,7 @@ struct fib_info *fib_create_info(struct +@@ -1013,6 +1015,7 @@ struct fib_info *fib_create_info(struct if (!fib_info_hash_size) goto failure; } @@ -44,15 +46,15 @@ diff -Nupr src.orig/net/ipv4/fib_semanti fi = kzalloc(sizeof(*fi)+nhs*sizeof(struct fib_nh), GFP_KERNEL); if (fi == NULL) -@@ -980,6 +983,7 @@ struct fib_info *fib_create_info(struct - } else - fi->fib_metrics = (u32 *) dst_default_metrics; +@@ -1028,6 +1031,7 @@ struct fib_info *fib_create_info(struct + fi->fib_metrics = (struct dst_metrics *)&dst_default_metrics; + } fib_info_cnt++; + KPATCH_PRINTK("[fib_create_info]: 3 create error err is %d\n",err); - fi->fib_net = net; fi->fib_protocol = cfg->fc_protocol; -@@ -996,8 +1000,10 @@ struct fib_info *fib_create_info(struct + fi->fib_scope = cfg->fc_scope; +@@ -1043,8 +1047,10 @@ struct fib_info *fib_create_info(struct if (!nexthop_nh->nh_pcpu_rth_output) goto failure; } endfor_nexthops(fi) @@ -63,7 +65,7 @@ diff -Nupr src.orig/net/ipv4/fib_semanti if (err) goto failure; -@@ -1048,6 +1054,7 @@ struct fib_info *fib_create_info(struct +@@ -1095,6 +1101,7 @@ struct fib_info *fib_create_info(struct nh->nh_weight = 1; #endif } @@ -71,7 +73,7 @@ diff -Nupr src.orig/net/ipv4/fib_semanti if (fib_props[cfg->fc_type].error) { if (cfg->fc_gw || cfg->fc_oif || cfg->fc_mp) -@@ -1065,6 +1072,7 @@ struct fib_info *fib_create_info(struct +@@ -1112,6 +1119,7 @@ struct fib_info *fib_create_info(struct goto err_inval; } } @@ -79,7 +81,7 @@ diff -Nupr src.orig/net/ipv4/fib_semanti if (cfg->fc_scope > RT_SCOPE_HOST) goto err_inval; -@@ -1087,6 +1095,7 @@ struct fib_info *fib_create_info(struct +@@ -1134,6 +1142,7 @@ struct fib_info *fib_create_info(struct goto failure; } endfor_nexthops(fi) } @@ -87,7 +89,7 @@ diff -Nupr src.orig/net/ipv4/fib_semanti if (fi->fib_prefsrc) { if (cfg->fc_type != RTN_LOCAL || !cfg->fc_dst || -@@ -1099,6 +1108,7 @@ struct fib_info *fib_create_info(struct +@@ -1146,6 +1155,7 @@ struct fib_info *fib_create_info(struct fib_info_update_nh_saddr(net, nexthop_nh); fib_add_weight(fi, nexthop_nh); } endfor_nexthops(fi) @@ -95,7 +97,7 @@ diff -Nupr src.orig/net/ipv4/fib_semanti fib_rebalance(fi); -@@ -1110,6 +1120,7 @@ link_it: +@@ -1157,6 +1167,7 @@ link_it: ofi->fib_treeref++; return ofi; } @@ -103,7 +105,7 @@ diff -Nupr src.orig/net/ipv4/fib_semanti fi->fib_treeref++; atomic_inc(&fi->fib_clntref); -@@ -1133,6 +1144,7 @@ link_it: +@@ -1180,6 +1191,7 @@ link_it: hlist_add_head(&nexthop_nh->nh_hash, head); } endfor_nexthops(fi) spin_unlock_bh(&fib_info_lock); @@ -111,7 +113,7 @@ diff -Nupr src.orig/net/ipv4/fib_semanti return fi; err_inval: -@@ -1143,6 +1155,7 @@ failure: +@@ -1190,6 +1202,7 @@ failure: fi->fib_dead = 1; free_fib_info(fi); } @@ -119,10 +121,11 @@ diff -Nupr src.orig/net/ipv4/fib_semanti return ERR_PTR(err); } -diff -Nupr src.orig/net/ipv4/fib_trie.c src/net/ipv4/fib_trie.c ---- src.orig/net/ipv4/fib_trie.c 2017-09-22 16:52:10.645110295 -0400 -+++ src/net/ipv4/fib_trie.c 2017-09-22 16:55:39.940975963 -0400 -@@ -1191,6 +1191,7 @@ static int fib_insert_alias(struct trie +Index: src/net/ipv4/fib_trie.c +=================================================================== +--- src.orig/net/ipv4/fib_trie.c ++++ src/net/ipv4/fib_trie.c +@@ -1105,6 +1105,7 @@ static int fib_insert_alias(struct trie } /* Caller must hold RTNL. */ @@ -130,7 +133,7 @@ diff -Nupr src.orig/net/ipv4/fib_trie.c int fib_table_insert(struct net *net, struct fib_table *tb, struct fib_config *cfg) { -@@ -1216,11 +1217,14 @@ int fib_table_insert(struct net *net, st +@@ -1130,11 +1131,14 @@ int fib_table_insert(struct net *net, st if ((plen < KEYLENGTH) && (key << plen)) return -EINVAL; @@ -144,4 +147,4 @@ diff -Nupr src.orig/net/ipv4/fib_trie.c + KPATCH_PRINTK("[fib_table_insert]: cross\n"); l = fib_find_node(t, &tp, key); - fa = l ? fib_find_alias(&l->leaf, slen, tos, fi->fib_priority) : NULL; + fa = l ? fib_find_alias(&l->leaf, slen, tos, fi->fib_priority,
  34. Download patch test/integration/fedora-27/bug-table-section.patch

    --- 0.6.0-0.2/test/integration/fedora-27/bug-table-section.patch 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/fedora-27/bug-table-section.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -diff -Nupr src.orig/fs/proc/proc_sysctl.c src/fs/proc/proc_sysctl.c ---- src.orig/fs/proc/proc_sysctl.c 2017-11-17 15:58:41.115211972 -0500 -+++ src/fs/proc/proc_sysctl.c 2017-11-17 15:58:51.725211972 -0500 -@@ -332,6 +332,8 @@ static void start_unregistering(struct c - - static struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head) - { -+ if (jiffies == 0) -+ printk("kpatch-test: testing __bug_table section changes\n"); - BUG_ON(!head); - spin_lock(&sysctl_lock); - if (!use_table(head))
  35. Download patch .git/hooks/pre-rebase.sample

    --- 0.6.0-0.2/.git/hooks/pre-rebase.sample 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/.git/hooks/pre-rebase.sample 2019-08-28 17:33:59.000000000 +0000 @@ -0,0 +1,169 @@ +#!/bin/sh +# +# Copyright (c) 2006, 2008 Junio C Hamano +# +# The "pre-rebase" hook is run just before "git rebase" starts doing +# its job, and can prevent the command from running by exiting with +# non-zero status. +# +# The hook is called with the following parameters: +# +# $1 -- the upstream the series was forked from. +# $2 -- the branch being rebased (or empty when rebasing the current branch). +# +# This sample shows how to prevent topic branches that are already +# merged to 'next' branch from getting rebased, because allowing it +# would result in rebasing already published history. + +publish=next +basebranch="$1" +if test "$#" = 2 +then + topic="refs/heads/$2" +else + topic=`git symbolic-ref HEAD` || + exit 0 ;# we do not interrupt rebasing detached HEAD +fi + +case "$topic" in +refs/heads/??/*) + ;; +*) + exit 0 ;# we do not interrupt others. + ;; +esac + +# Now we are dealing with a topic branch being rebased +# on top of master. Is it OK to rebase it? + +# Does the topic really exist? +git show-ref -q "$topic" || { + echo >&2 "No such branch $topic" + exit 1 +} + +# Is topic fully merged to master? +not_in_master=`git rev-list --pretty=oneline ^master "$topic"` +if test -z "$not_in_master" +then + echo >&2 "$topic is fully merged to master; better remove it." + exit 1 ;# we could allow it, but there is no point. +fi + +# Is topic ever merged to next? If so you should not be rebasing it. +only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` +only_next_2=`git rev-list ^master ${publish} | sort` +if test "$only_next_1" = "$only_next_2" +then + not_in_topic=`git rev-list "^$topic" master` + if test -z "$not_in_topic" + then + echo >&2 "$topic is already up to date with master" + exit 1 ;# we could allow it, but there is no point. + else + exit 0 + fi +else + not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` + /usr/bin/perl -e ' + my $topic = $ARGV[0]; + my $msg = "* $topic has commits already merged to public branch:\n"; + my (%not_in_next) = map { + /^([0-9a-f]+) /; + ($1 => 1); + } split(/\n/, $ARGV[1]); + for my $elem (map { + /^([0-9a-f]+) (.*)$/; + [$1 => $2]; + } split(/\n/, $ARGV[2])) { + if (!exists $not_in_next{$elem->[0]}) { + if ($msg) { + print STDERR $msg; + undef $msg; + } + print STDERR " $elem->[1]\n"; + } + } + ' "$topic" "$not_in_next" "$not_in_master" + exit 1 +fi + +<<\DOC_END + +This sample hook safeguards topic branches that have been +published from being rewound. + +The workflow assumed here is: + + * Once a topic branch forks from "master", "master" is never + merged into it again (either directly or indirectly). + + * Once a topic branch is fully cooked and merged into "master", + it is deleted. If you need to build on top of it to correct + earlier mistakes, a new topic branch is created by forking at + the tip of the "master". This is not strictly necessary, but + it makes it easier to keep your history simple. + + * Whenever you need to test or publish your changes to topic + branches, merge them into "next" branch. + +The script, being an example, hardcodes the publish branch name +to be "next", but it is trivial to make it configurable via +$GIT_DIR/config mechanism. + +With this workflow, you would want to know: + +(1) ... if a topic branch has ever been merged to "next". Young + topic branches can have stupid mistakes you would rather + clean up before publishing, and things that have not been + merged into other branches can be easily rebased without + affecting other people. But once it is published, you would + not want to rewind it. + +(2) ... if a topic branch has been fully merged to "master". + Then you can delete it. More importantly, you should not + build on top of it -- other people may already want to + change things related to the topic as patches against your + "master", so if you need further changes, it is better to + fork the topic (perhaps with the same name) afresh from the + tip of "master". + +Let's look at this example: + + o---o---o---o---o---o---o---o---o---o "next" + / / / / + / a---a---b A / / + / / / / + / / c---c---c---c B / + / / / \ / + / / / b---b C \ / + / / / / \ / + ---o---o---o---o---o---o---o---o---o---o---o "master" + + +A, B and C are topic branches. + + * A has one fix since it was merged up to "next". + + * B has finished. It has been fully merged up to "master" and "next", + and is ready to be deleted. + + * C has not merged to "next" at all. + +We would want to allow C to be rebased, refuse A, and encourage +B to be deleted. + +To compute (1): + + git rev-list ^master ^topic next + git rev-list ^master next + + if these match, topic has not merged in next at all. + +To compute (2): + + git rev-list master..topic + + if this is empty, it is fully merged to "master". + +DOC_END
  36. Download patch test/integration/fedora-27/parainstructions-section.patch

    --- 0.6.0-0.2/test/integration/fedora-27/parainstructions-section.patch 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/fedora-27/parainstructions-section.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -diff -Nupr src.orig/fs/proc/generic.c src/fs/proc/generic.c ---- src.orig/fs/proc/generic.c 2017-11-17 16:08:17.202211972 -0500 -+++ src/fs/proc/generic.c 2017-11-17 16:08:46.585211972 -0500 -@@ -191,6 +191,7 @@ int proc_alloc_inum(unsigned int *inum) - { - int i; - -+ printk("kpatch-test: testing change to .parainstructions section\n"); - i = ida_simple_get(&proc_inum_ida, 0, UINT_MAX - PROC_DYNAMIC_FIRST + 1, - GFP_KERNEL); - if (i < 0)
  37. Download patch .git/hooks/pre-commit.sample

    --- 0.6.0-0.2/.git/hooks/pre-commit.sample 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/.git/hooks/pre-commit.sample 2019-08-28 17:33:59.000000000 +0000 @@ -0,0 +1,49 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed. +# Called by "git commit" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message if +# it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-commit". + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=$(git hash-object -t tree /dev/null) +fi + +# If you want to allow non-ASCII filenames set this variable to true. +allownonascii=$(git config --bool hooks.allownonascii) + +# Redirect output to stderr. +exec 1>&2 + +# Cross platform projects tend to avoid non-ASCII filenames; prevent +# them from being added to the repository. We exploit the fact that the +# printable range starts at the space character and ends with tilde. +if [ "$allownonascii" != "true" ] && + # Note that the use of brackets around a tr range is ok here, (it's + # even required, for portability to Solaris 10's /usr/bin/tr), since + # the square bracket bytes happen to fall in the designated range. + test $(git diff --cached --name-only --diff-filter=A -z $against | + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 +then + cat <<\EOF +Error: Attempt to add a non-ASCII file name. + +This can cause problems if you want to work with people on other platforms. + +To be portable it is advisable to rename the file. + +If you know what you are doing you can disable this check using: + + git config hooks.allownonascii true +EOF + exit 1 +fi + +# If there are whitespace errors, print the offending file names and fail. +exec git diff-index --check --cached $against --
  38. Download patch test/integration/centos-7/meminfo-cmdline-rebuild-SLOW-LOADED.test.disabled

    --- 0.6.0-0.2/test/integration/centos-7/meminfo-cmdline-rebuild-SLOW-LOADED.test.disabled 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/centos-7/meminfo-cmdline-rebuild-SLOW-LOADED.test.disabled 2019-08-28 17:34:00.000000000 +0000 @@ -0,0 +1,3 @@ +#!/bin/bash + +grep VMALLOCCHUNK /proc/meminfo && grep kpatch=1 /proc/cmdline
  39. Download patch .git/logs/refs/heads/master

    --- 0.6.0-0.2/.git/logs/refs/heads/master 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/.git/logs/refs/heads/master 2019-08-28 17:34:00.000000000 +0000 @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 30a7dd677bcc25bd70070f7f9d16a88c190b8b0b Benjamin M Romer <benjamin.romer@canonical.com> 1567013640 -0400 clone: from https://github.com/dynup/kpatch.git
  40. Download patch .git/description

    --- 0.6.0-0.2/.git/description 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/.git/description 2019-08-28 17:33:59.000000000 +0000 @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository.
  41. Download patch test/integration/fedora-27/gcc-isra.patch

    --- 0.6.0-0.2/test/integration/fedora-27/gcc-isra.patch 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/fedora-27/gcc-isra.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -diff -Nupr src.orig/fs/proc/proc_sysctl.c src/fs/proc/proc_sysctl.c ---- src.orig/fs/proc/proc_sysctl.c 2017-11-17 15:58:41.115211972 -0500 -+++ src/fs/proc/proc_sysctl.c 2017-11-17 15:59:05.548211972 -0500 -@@ -47,6 +47,7 @@ void proc_sys_poll_notify(struct ctl_tab - if (!poll) - return; - -+ printk("kpatch-test: testing gcc .isra function name mangling\n"); - atomic_inc(&poll->event); - wake_up_interruptible(&poll->wait); - }
  42. Download patch kmod/core/core.c
  43. Download patch test/integration/fedora-27/gcc-static-local-var-4.test

    --- 0.6.0-0.2/test/integration/fedora-27/gcc-static-local-var-4.test 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/fedora-27/gcc-static-local-var-4.test 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -#!/bin/bash - -if $(nm kpatch-gcc-static-local-var-4.ko | grep -q free_ioctx); then - exit 1 -else - exit 0 -fi
  44. Download patch .gitignore

    --- 0.6.0-0.2/.gitignore 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/.gitignore 2019-08-28 17:34:00.000000000 +0000 @@ -7,10 +7,6 @@ *.swp *.d *.so -*.test.out -!*.ORIG.o -!*.PATCHED.o -!*.PATCHED.FAIL.o .tmp_versions Module.symvers kmod/core/.cache.mk
  45. Download patch .git/refs/remotes/origin/HEAD

    --- 0.6.0-0.2/.git/refs/remotes/origin/HEAD 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/.git/refs/remotes/origin/HEAD 2019-08-28 17:34:00.000000000 +0000 @@ -0,0 +1 @@ +ref: refs/remotes/origin/master
  46. Download patch kpatch-build/create-kpatch-module.c

    --- 0.6.0-0.2/kpatch-build/create-kpatch-module.c 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/kpatch-build/create-kpatch-module.c 2019-08-28 17:34:00.000000000 +0000 @@ -231,6 +231,9 @@ int main(int argc, char *argv[]) kpatch_reindex_elements(kelf); symtab = find_section_by_name(&kelf->sections, ".symtab"); + if (!symtab) + ERROR("missing .symtab section"); + list_for_each_entry(sec, &kelf->sections, list) { if (!is_rela_section(sec)) continue;
  47. Download patch debian/patches/Fix-build-err-by-Werror-maybe-uninitialized.patch

    --- 0.6.0-0.2/debian/patches/Fix-build-err-by-Werror-maybe-uninitialized.patch 2018-06-15 22:23:46.000000000 +0000 +++ 0.8.0-0ubuntu2/debian/patches/Fix-build-err-by-Werror-maybe-uninitialized.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -From a25c18eb82c6cd1186b262e4920e6d30d7273a36 Mon Sep 17 00:00:00 2001 -From: Nobuhiro Iwamatsu <iwamatsu@debian.org> -Date: Sun, 17 Jun 2018 06:59:47 +0900 -Subject: [PATCH] Fix build err by '-Werror=maybe-uninitialized' -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - ------ -create-diff-object.c: In function $B!F(Bkpatch_compare_sections$B!G(B: -create-diff-object.c:316:20: error: $B!F(Btoc_data1$B!G(B may be used uninitialized in this function [-Werror=maybe-uninitialized] - return toc_data1 == toc_data2; - ~~~~~~~~~~^~~~~~~~~~~~ -create-diff-object.c:256:16: note: $B!F(Btoc_data1$B!G(B was declared here - unsigned long toc_data1, toc_data2; - ^~~~~~~~~ -cc1: all warnings being treated as errors ------ - -Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@debian.org> ---- - kpatch-build/create-diff-object.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c -index 026ee1d..391171f 100644 ---- a/kpatch-build/create-diff-object.c -+++ b/kpatch-build/create-diff-object.c -@@ -253,7 +253,7 @@ static int kpatch_mangled_strcmp(char *s1, char *s2) - static int rela_equal(struct rela *rela1, struct rela *rela2) - { - struct rela *rela_toc1, *rela_toc2; -- unsigned long toc_data1, toc_data2; -+ unsigned long toc_data1 = 0, toc_data2 = 0; - - if (rela1->type != rela2->type || - rela1->offset != rela2->offset) --- -2.17.1 -
  48. Download patch test/integration/fedora-27/meminfo-cmdline-rebuild-SLOW-LOADED.test.disabled

    --- 0.6.0-0.2/test/integration/fedora-27/meminfo-cmdline-rebuild-SLOW-LOADED.test.disabled 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/fedora-27/meminfo-cmdline-rebuild-SLOW-LOADED.test.disabled 2019-08-28 17:34:00.000000000 +0000 @@ -0,0 +1,3 @@ +#!/bin/bash + +grep VMALLOCCHUNK /proc/meminfo && grep kpatch=1 /proc/cmdline
  49. Download patch debian/patches/kpatch-build-adjust-dirs.patch

    --- 0.6.0-0.2/debian/patches/kpatch-build-adjust-dirs.patch 2018-06-15 22:23:46.000000000 +0000 +++ 0.8.0-0ubuntu2/debian/patches/kpatch-build-adjust-dirs.patch 2019-08-28 17:37:11.000000000 +0000 @@ -3,13 +3,11 @@ Description: adjust kpatch-build directo 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.arges@canonical.com> -Last-Update: 2018-04-14 +Last-Update: 2018-02-07 -Index: kpatch-0.5.0/kpatch-build/kpatch-build -=================================================================== ---- kpatch-0.5.0.orig/kpatch-build/kpatch-build -+++ kpatch-0.5.0/kpatch-build/kpatch-build -@@ -159,9 +159,9 @@ find_dirs() { +--- a/kpatch-build/kpatch-build ++++ b/kpatch-build/kpatch-build +@@ -161,9 +161,9 @@ TOOLSDIR="$SCRIPTDIR" DATADIR="$(readlink -f "$SCRIPTDIR/../kmod")" PLUGINDIR="$(readlink -f "$SCRIPTDIR/gcc-plugins")" @@ -21,7 +19,7 @@ Index: kpatch-0.5.0/kpatch-build/kpatch- DATADIR="$(readlink -f "$SCRIPTDIR/../share/kpatch")" PLUGINDIR="$TOOLSDIR" else -@@ -174,12 +174,12 @@ find_core_symvers() { +@@ -176,12 +176,12 @@ if [[ -e "$SCRIPTDIR/create-diff-object" ]]; then # git repo SYMVERSFILE="$DATADIR/core/Module.symvers" @@ -32,7 +30,7 @@ Index: kpatch-0.5.0/kpatch-build/kpatch- 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 ++ elif [[ -e /lib/modules/$ARCHVERSION/updates/dkms/kpatch.Module.symvers ]]; then + SYMVERSFILE="$(readlink -f "/lib/modules/$ARCHVERSION/updates/dkms/kpatch.Module.symvers")" fi fi
  50. Download patch kpatch-build/kpatch-elf.c

    --- 0.6.0-0.2/kpatch-build/kpatch-elf.c 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/kpatch-build/kpatch-elf.c 2019-08-28 17:34:00.000000000 +0000 @@ -322,7 +322,7 @@ static void kpatch_find_func_profiling_c list_for_each_entry(sym, &kelf->symbols, list) { if (sym->type != STT_FUNC || !sym->sec || !sym->sec->rela) continue; -#ifdef __powerpc__ +#ifdef __powerpc64__ list_for_each_entry(rela, &sym->sec->rela->relas, list) { if (!strcmp(rela->sym->name, "_mcount")) { sym->has_func_profiling = 1; @@ -332,7 +332,9 @@ static void kpatch_find_func_profiling_c #else rela = list_first_entry(&sym->sec->rela->relas, struct rela, list); - if (rela->type != R_X86_64_NONE || + if ((rela->type != R_X86_64_NONE && + rela->type != R_X86_64_PC32 && + rela->type != R_X86_64_PLT32) || strcmp(rela->sym->name, "__fentry__")) continue; @@ -565,6 +567,7 @@ void kpatch_create_strtab(struct kpatch_ void kpatch_create_symtab(struct kpatch_elf *kelf) { struct section *symtab; + struct section *strtab; struct symbol *sym; char *buf; size_t size; @@ -598,7 +601,11 @@ void kpatch_create_symtab(struct kpatch_ symtab->data->d_size = size; /* update symtab section header */ - symtab->sh.sh_link = find_section_by_name(&kelf->sections, ".strtab")->index; + strtab = find_section_by_name(&kelf->sections, ".strtab"); + if (!strtab) + ERROR("missing .strtab section"); + + symtab->sh.sh_link = strtab->index; symtab->sh.sh_info = nr_local; } @@ -647,6 +654,7 @@ struct section *create_section_pair(stru relasec->data = malloc(sizeof(*relasec->data)); if (!relasec->data) ERROR("malloc"); + relasec->data->d_type = ELF_T_RELA; /* set section header */ relasec->sh.sh_type = SHT_RELA; @@ -750,6 +758,7 @@ void kpatch_write_output_elf(struct kpat { int fd; struct section *sec; + struct section *shstrtab; Elf *elfout; GElf_Ehdr eh, ehout; Elf_Scn *scn; @@ -765,7 +774,7 @@ void kpatch_write_output_elf(struct kpat if (!elfout) ERROR("elf_begin"); - if (!gelf_newehdr(elfout, gelf_getclass(kelf->elf))) + if (!gelf_newehdr(elfout, gelf_getclass(elf))) ERROR("gelf_newehdr"); if (!gelf_getehdr(elfout, &ehout)) @@ -779,7 +788,12 @@ void kpatch_write_output_elf(struct kpat ehout.e_machine = eh.e_machine; ehout.e_type = eh.e_type; ehout.e_version = EV_CURRENT; - ehout.e_shstrndx = find_section_by_name(&kelf->sections, ".shstrtab")->index; + + shstrtab = find_section_by_name(&kelf->sections, ".shstrtab"); + if (!shstrtab) + ERROR("missing .shstrtab section"); + + ehout.e_shstrndx = shstrtab->index; /* add changed sections */ list_for_each_entry(sec, &kelf->sections, list) { @@ -814,6 +828,9 @@ void kpatch_write_output_elf(struct kpat printf("%s\n",elf_errmsg(-1)); ERROR("elf_update"); } + + elf_end(elfout); + close(fd); } /*
  51. Download patch .git/HEAD

    --- 0.6.0-0.2/.git/HEAD 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/.git/HEAD 2019-08-28 17:34:00.000000000 +0000 @@ -0,0 +1 @@ +ref: refs/heads/master
  52. Download patch debian/patches/remove-dkms.patch

    --- 0.6.0-0.2/debian/patches/remove-dkms.patch 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/debian/patches/remove-dkms.patch 2019-08-28 17:37:11.000000000 +0000 @@ -0,0 +1,13 @@ +--- a/Makefile.inc ++++ b/Makefile.inc +@@ -17,10 +17,5 @@ + SYSTEMDDIR = $(DESTDIR)$(PREFIX)/lib/systemd/system + UPSTARTDIR = $(DESTDIR)/etc/init + +-# The core module is only supported on x86_64 +-ifeq ($(ARCH),x86_64) +-BUILDMOD ?= yes +-endif +- + .PHONY: all install clean + .DEFAULT: all
  53. Download patch kpatch-build/kpatch-elf.h

    --- 0.6.0-0.2/kpatch-build/kpatch-elf.h 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/kpatch-build/kpatch-elf.h 2019-08-28 17:34:00.000000000 +0000 @@ -70,6 +70,8 @@ struct section { struct symbol { struct list_head list; struct symbol *twin; + struct symbol *parent; + struct symbol *child; struct section *sec; GElf_Sym sym; char *name; @@ -128,7 +130,8 @@ struct rela *find_rela_by_offset(struct ERROR("malloc"); \ memset((_new), 0, sizeof(*(_new))); \ INIT_LIST_HEAD(&(_new)->list); \ - list_add_tail(&(_new)->list, (_list)); \ + if (_list) \ + list_add_tail(&(_new)->list, (_list)); \ } int offset_of_string(struct list_head *list, char *name);
  54. Download patch test/integration/fedora-27/meminfo-init-FAIL.patch

    --- 0.6.0-0.2/test/integration/fedora-27/meminfo-init-FAIL.patch 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/fedora-27/meminfo-init-FAIL.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -diff -Nupr src.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c ---- src.orig/fs/proc/meminfo.c 2017-11-17 15:58:41.113211972 -0500 -+++ src/fs/proc/meminfo.c 2017-11-17 15:59:23.081211972 -0500 -@@ -175,6 +175,7 @@ static const struct file_operations memi - - static int __init proc_meminfo_init(void) - { -+ printk("a\n"); - proc_create("meminfo", 0, NULL, &meminfo_proc_fops); - return 0; - }
  55. Download patch test/integration/fedora-27/convert-global-local.patch

    --- 0.6.0-0.2/test/integration/fedora-27/convert-global-local.patch 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/fedora-27/convert-global-local.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -This is a test for #658: a kernel panic seen when patching an exported -function (e.g., kmalloc) which is used by patch_init(). ---- -diff -Nupr src.orig/mm/slub.c src/mm/slub.c ---- src.orig/mm/slub.c 2017-11-17 15:58:51.157211972 -0500 -+++ src/mm/slub.c 2017-11-17 15:58:56.808211972 -0500 -@@ -3731,6 +3731,9 @@ void *__kmalloc(size_t size, gfp_t flags - struct kmem_cache *s; - void *ret; - -+ if (!jiffies) -+ printk("kpatch kmalloc\n"); -+ - if (unlikely(size > KMALLOC_MAX_CACHE_SIZE)) - return kmalloc_large(size, flags); -
  56. Download patch test/integration/centos-7/gcc-static-local-var-4.test

    --- 0.6.0-0.2/test/integration/centos-7/gcc-static-local-var-4.test 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/centos-7/gcc-static-local-var-4.test 2019-08-28 17:34:00.000000000 +0000 @@ -1,6 +1,6 @@ #!/bin/bash -if $(nm kpatch-gcc-static-local-var-4.ko | grep -q free_ioctx); then +if $(nm test-gcc-static-local-var-4.ko | grep -q free_ioctx); then exit 1 else exit 0
  57. Download patch .gitattributes

    --- 0.6.0-0.2/.gitattributes 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/.gitattributes 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -*.ORIG.o filter=lfs diff=lfs merge=lfs -text -*.PATCHED.o filter=lfs diff=lfs merge=lfs -text -*.PATCHED.FAIL.o filter=lfs diff=lfs merge=lfs -text
  58. Download patch debian/patches/kmod-core-use-save_stack_trace_tsk-backport.patch
  59. Download patch .git/hooks/commit-msg.sample

    --- 0.6.0-0.2/.git/hooks/commit-msg.sample 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/.git/hooks/commit-msg.sample 2019-08-28 17:33:59.000000000 +0000 @@ -0,0 +1,24 @@ +#!/bin/sh +# +# An example hook script to check the commit log message. +# Called by "git commit" with one argument, the name of the file +# that has the commit message. The hook should exit with non-zero +# status after issuing an appropriate message if it wants to stop the +# commit. The hook is allowed to edit the commit message file. +# +# To enable this hook, rename this file to "commit-msg". + +# Uncomment the below to add a Signed-off-by line to the message. +# Doing this in a hook is a bad idea in general, but the prepare-commit-msg +# hook is more suited to it. +# +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" + +# This example catches duplicate Signed-off-by lines. + +test "" = "$(grep '^Signed-off-by: ' "$1" | + sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { + echo >&2 Duplicate Signed-off-by lines. + exit 1 +}
  60. Download patch debian/patches/series

    --- 0.6.0-0.2/debian/patches/series 2019-01-07 19:38:32.000000000 +0000 +++ 0.8.0-0ubuntu2/debian/patches/series 2019-08-28 17:37:11.000000000 +0000 @@ -1,4 +1,5 @@ +remove-dkms.patch kpatch-build-adjust-dirs.patch -Fix-build-err-by-Werror-maybe-uninitialized.patch -kmod-fix-symbol-lookup-on-linux-4.19.patch -kpatch-build-fix-clean-target.patch +use-debian-rules-for-ubuntu-builds.patch +ubuntu-kernel-variants.patch +xenial-shellcheck-fixes.patch
  61. Download patch debian/kpatch-dkms.dkms

    --- 0.6.0-0.2/debian/kpatch-dkms.dkms 2019-01-07 19:24:43.000000000 +0000 +++ 0.8.0-0ubuntu2/debian/kpatch-dkms.dkms 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -MAKE="make -C kmod/ KPATCH_BUILD=/lib/modules/${kernelver}/build" -BUILT_MODULE_NAME="kpatch" -BUILT_MODULE_LOCATION="kmod/core" -DEST_MODULE_LOCATION="/updates/dkms" -CLEAN="make -C kmod/ KPATCH_BUILD=/lib/modules/${kernelver}/build clean" -PACKAGE_NAME="kpatch" -PACKAGE_VERSION=#MODULE_VERSION# -REMAKE_INITRD="no" -STRIP="no" -AUTOINSTALL="yes" -POST_BUILD="post-dkms.sh #MODULE_VERSION# ${kernelver}"
  62. Download patch kpatch-build/kpatch-gcc

    --- 0.6.0-0.2/kpatch-build/kpatch-gcc 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/kpatch-build/kpatch-gcc 2019-08-28 17:34:00.000000000 +0000 @@ -13,7 +13,7 @@ fi declare -a args=("$@") -if [[ "$TOOLCHAINCMD" = "gcc" ]] ; then +if [[ "$TOOLCHAINCMD" =~ "gcc" ]] ; then while [ "$#" -gt 0 ]; do if [ "$1" = "-o" ]; then obj="$2" @@ -23,7 +23,8 @@ if [[ "$TOOLCHAINCMD" = "gcc" ]] ; then [[ "$obj" = */.tmp_mc_*.o ]] && break; [[ "$obj" = */.tmp_*.o ]] && obj="${obj/.tmp_/}" - case "$obj" in + relobj=${obj//$KPATCH_GCC_SRCDIR\//} + case "$relobj" in *.mod.o|\ *built-in.o|\ *built-in.a|\ @@ -41,14 +42,15 @@ if [[ "$TOOLCHAINCMD" = "gcc" ]] ; then arch/x86/entry/vdso/*|\ drivers/firmware/efi/libstub/*|\ arch/powerpc/kernel/prom_init.o|\ + lib/*|\ .*.o|\ */.lib_exports.o) break ;; *.o) - mkdir -p "$KPATCH_GCC_TEMPDIR/orig/$(dirname "$obj")" - [[ -e "$obj" ]] && cp -f "$obj" "$KPATCH_GCC_TEMPDIR/orig/$obj" - echo "$obj" >> "$KPATCH_GCC_TEMPDIR/changed_objs" + mkdir -p "$KPATCH_GCC_TEMPDIR/orig/$(dirname "$relobj")" + [[ -e "$obj" ]] && cp -f "$obj" "$KPATCH_GCC_TEMPDIR/orig/$relobj" + echo "$relobj" >> "$KPATCH_GCC_TEMPDIR/changed_objs" break ;; *) @@ -62,10 +64,11 @@ elif [[ "$TOOLCHAINCMD" = "ld" ]] ; then while [ "$#" -gt 0 ]; do if [ "$1" = "-o" ]; then obj="$2" + relobj=${obj//$KPATCH_GCC_SRCDIR\//} case "$obj" in *.ko) - mkdir -p "$KPATCH_GCC_TEMPDIR/module/$(dirname "$obj")" - cp -f "$obj" "$KPATCH_GCC_TEMPDIR/module/$obj" + mkdir -p "$KPATCH_GCC_TEMPDIR/module/$(dirname "$relobj")" + cp -f "$obj" "$KPATCH_GCC_TEMPDIR/module/$relobj" break ;; .tmp_vmlinux*|vmlinux)
  63. Download patch debian/patches/use-debian-rules-for-ubuntu-builds.patch
  64. Download patch test/integration/fedora-27/gcc-static-local-var-2.patch

    --- 0.6.0-0.2/test/integration/fedora-27/gcc-static-local-var-2.patch 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/fedora-27/gcc-static-local-var-2.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -diff -Nupr src.orig/mm/mmap.c src/mm/mmap.c ---- src.orig/mm/mmap.c 2017-11-17 15:58:51.131211972 -0500 -+++ src/mm/mmap.c 2017-11-17 15:59:09.094211972 -0500 -@@ -1609,6 +1610,9 @@ unsigned long mmap_region(struct file *f - struct rb_node **rb_link, *rb_parent; - unsigned long charged = 0; - -+ if (!jiffies) -+ printk("kpatch mmap foo\n"); -+ - /* Check against address space limit. */ - if (!may_expand_vm(mm, vm_flags, len >> PAGE_SHIFT)) { - unsigned long nr_pages;
  65. Download patch debian/patches/kpatch-build-fix-clean-target.patch

    --- 0.6.0-0.2/debian/patches/kpatch-build-fix-clean-target.patch 2019-01-07 19:38:19.000000000 +0000 +++ 0.8.0-0ubuntu2/debian/patches/kpatch-build-fix-clean-target.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -From: Ben Hutchings <ben@decadent.org.uk> -Date: Mon, 07 Jan 2019 19:37:04 +0000 -Subject: kpatch-build: Fix clean target - -The clean target uses brace-expansion which is a bash extension not -supported by e.g. dash. Force use of bash for this target. - ---- ---- a/kpatch-build/Makefile -+++ b/kpatch-build/Makefile -@@ -43,5 +43,6 @@ uninstall: - $(RM) -R $(LIBEXECDIR) - $(RM) $(BINDIR)/kpatch-build - -+clean: SHELL = /bin/bash - clean: - $(RM) $(TARGETS) *.{o,d} insn/*.{o,d} gcc-plugins/*.{so,d}
  66. Download patch test/integration/fedora-27/gcc-static-local-var.patch

    --- 0.6.0-0.2/test/integration/fedora-27/gcc-static-local-var.patch 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/fedora-27/gcc-static-local-var.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -diff -Nupr src.orig/arch/x86/kernel/ldt.c src/arch/x86/kernel/ldt.c ---- src.orig/arch/x86/kernel/ldt.c 2017-11-17 15:58:09.662211972 -0500 -+++ src/arch/x86/kernel/ldt.c 2017-11-17 15:59:16.084211972 -0500 -@@ -100,6 +100,12 @@ static void free_ldt_struct(struct ldt_s - kfree(ldt); - } - -+void hi_there(void) -+{ -+ if (!jiffies) -+ printk("hi there\n"); -+} -+ - /* - * we do not have to muck with descriptors here, that is - * done in switch_mm() as needed. -@@ -110,6 +116,8 @@ int init_new_context_ldt(struct task_str - struct mm_struct *old_mm; - int retval = 0; - -+ hi_there(); -+ - mutex_init(&mm->context.lock); - old_mm = current->mm; - if (!old_mm) {
  67. Download patch kpatch/kpatch

    --- 0.6.0-0.2/kpatch/kpatch 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/kpatch/kpatch 2019-08-28 17:34:00.000000000 +0000 @@ -25,8 +25,8 @@ INSTALLDIR=/var/lib/kpatch SCRIPTDIR="$(readlink -f "$(dirname "$(type -p "$0")")")" -VERSION="0.6.0" -POST_ENABLE_WAIT=5 # seconds +VERSION="0.8.0" +POST_ENABLE_WAIT=15 # seconds POST_SIGNAL_WAIT=60 # seconds # How many times to try loading the patch if activeness safety check fails. @@ -126,7 +126,7 @@ find_core_module() { } core_loaded () { - grep -q -e "T klp_register_patch" -e "T kpatch_register" /proc/kallsyms + grep -q -e "T klp_enable_patch" -e "T kpatch_register" /proc/kallsyms } get_module_name () { @@ -157,7 +157,7 @@ verify_module_checksum () { checksum="$(readelf -p .kpatch.checksum "$1" 2>&1 | grep '\[.*\]' | awk '{print $3}')" # Fail checksum match only if both exist and diverge - if [[ ! -z "$checksum" ]] && [[ -e "$SYSFS/${modname}/checksum" ]] ; then + if [[ -n "$checksum" ]] && [[ -e "$SYSFS/${modname}/checksum" ]] ; then sysfs_checksum="$(cat "$SYSFS/${modname}/checksum")" [[ "$checksum" == "$sysfs_checksum" ]] || return 1 fi @@ -230,21 +230,8 @@ signal_stalled_processes() { [[ -z "$module" ]] && return if [[ -e "/sys/kernel/livepatch/$module/signal" ]] ; then + echo "signaling stalled process(es):" echo 1 > "/sys/kernel/livepatch/$module/signal" - else - for proc_task in /proc/[0-9]*/task/[0-9]*; do - tid=${proc_task#*/task/} - if is_stalled "$module" "$tid" ; then - if [[ "$tid" -eq "$$" ]] ; then - echo "skipping pid $tid $(cat "$proc_task"/comm 2>/dev/null)" - else - echo "signaling pid $tid $(cat "$proc_task"/comm 2>/dev/null)" - kill -SIGSTOP "$tid" - sleep .1 - kill -SIGCONT "$tid" - fi - fi - done fi } @@ -263,7 +250,7 @@ wait_for_patch_transition() { sleep 1s done - echo "patch transition has stalled, signaling stalled process(es):" + echo "patch transition has stalled!" signal_stalled_processes echo "waiting (up to $POST_SIGNAL_WAIT seconds) for patch transition to complete..." @@ -314,30 +301,30 @@ load_module () { die "error: cannot re-enable patch module $modname, cannot verify checksum match" fi else - die "error: module named $modname already loaded and enabled" + echo "module named $modname already loaded and enabled" fi - fi + else + echo "loading patch module: $module" + local i=0 + while true; do + out="$(LC_ALL=C insmod "$module" 2>&1)" + [[ -z "$out" ]] && break + echo "$out" 1>&2 + [[ ! "$out" =~ "Device or resource busy" ]] && + die "failed to load module $module" - echo "loading patch module: $module" - local i=0 - while true; do - out="$(LC_ALL=C insmod "$module" 2>&1)" - [[ -z "$out" ]] && break - echo "$out" 1>&2 - [[ ! "$out" =~ "Device or resource busy" ]] && - die "failed to load module $module" - - # "Device or resource busy" means the activeness safety check - # failed. Retry in a few seconds. - i=$((i+1)) - if [[ $i -eq $MAX_LOAD_ATTEMPTS ]]; then - die "failed to load module $module" - break - else - warn "retrying..." - sleep $RETRY_INTERVAL - fi - done + # "Device or resource busy" means the activeness safety check + # failed. Retry in a few seconds. + i=$((i+1)) + if [[ $i -eq $MAX_LOAD_ATTEMPTS ]]; then + die "failed to load module $module" + break + else + warn "retrying..." + sleep $RETRY_INTERVAL + fi + done + fi if ! wait_for_patch_transition "$modname" ; then echo "module $modname did not complete its transition, unloading..." @@ -469,7 +456,7 @@ case "$1" in echo "installing $PATCH ($KVER)" mkdir -p "$INSTALLDIR/$KVER" || die "failed to create install directory" cp -f "$PATCH" "$INSTALLDIR/$KVER" || die "failed to install module $PATCH" - systemctl enable kpatch.service + command -v systemctl > /dev/null 2>&1 && systemctl enable kpatch.service ;; "uninstall") @@ -533,7 +520,7 @@ case "$1" in echo "Installed patch modules:" for kdir in "$INSTALLDIR"/*; do [[ -e "$kdir" ]] || continue - for module in "$kdir"/*; do + for module in "$kdir"/*.ko; do [[ -e "$module" ]] || continue mod_name "$module" echo "$MODNAME ($(basename "$kdir"))"
  68. Download patch .gitmodules

    --- 0.6.0-0.2/.gitmodules 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/.gitmodules 2019-08-28 17:34:00.000000000 +0000 @@ -0,0 +1,3 @@ +[submodule "test/unit/objs"] + path = test/unit/objs + url = https://github.com/dynup/kpatch-unit-test-objs.git
  69. Download patch test/integration/fedora-27/gcc-static-local-var-3.patch

    --- 0.6.0-0.2/test/integration/fedora-27/gcc-static-local-var-3.patch 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/fedora-27/gcc-static-local-var-3.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -diff -Nupr src.orig/kernel/reboot.c src/kernel/reboot.c ---- src.orig/kernel/reboot.c 2017-11-17 15:58:51.558211972 -0500 -+++ src/kernel/reboot.c 2017-11-17 15:59:10.774211972 -0500 -@@ -366,8 +366,15 @@ SYSCALL_DEFINE4(reboot, int, magic1, int - return ret; - } - -+void kpatch_bar(void) -+{ -+ if (!jiffies) -+ printk("kpatch_foo\n"); -+} -+ - static void deferred_cad(struct work_struct *dummy) - { -+ kpatch_bar(); - kernel_restart(NULL); - } -
  70. Download patch .git/logs/refs/remotes/origin/HEAD

    --- 0.6.0-0.2/.git/logs/refs/remotes/origin/HEAD 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/.git/logs/refs/remotes/origin/HEAD 2019-08-28 17:34:00.000000000 +0000 @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 30a7dd677bcc25bd70070f7f9d16a88c190b8b0b Benjamin M Romer <benjamin.romer@canonical.com> 1567013640 -0400 clone: from https://github.com/dynup/kpatch.git Binary files 0.6.0-0.2/.git/objects/pack/pack-222482408f1d0647adf58c83080fb8ab67c7d423.idx and 0.8.0-0ubuntu2/.git/objects/pack/pack-222482408f1d0647adf58c83080fb8ab67c7d423.idx differ Binary files 0.6.0-0.2/.git/objects/pack/pack-222482408f1d0647adf58c83080fb8ab67c7d423.pack and 0.8.0-0ubuntu2/.git/objects/pack/pack-222482408f1d0647adf58c83080fb8ab67c7d423.pack differ
  71. Download patch test/integration/fedora-27/gcc-static-local-var-4.patch

    --- 0.6.0-0.2/test/integration/fedora-27/gcc-static-local-var-4.patch 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/fedora-27/gcc-static-local-var-4.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -diff -Nupr src.orig/fs/aio.c src/fs/aio.c ---- src.orig/fs/aio.c 2017-11-17 15:58:38.111211972 -0500 -+++ src/fs/aio.c 2017-11-17 15:59:12.467211972 -0500 -@@ -271,10 +271,17 @@ static int __init aio_setup(void) - } - __initcall(aio_setup); - -+void kpatch_aio_foo(void) -+{ -+ if (!jiffies) -+ printk("kpatch aio foo\n"); -+} -+ - static void put_aio_ring_file(struct kioctx *ctx) - { - struct file *aio_ring_file = ctx->aio_ring_file; - struct address_space *i_mapping; -+ kpatch_aio_foo(); - - if (aio_ring_file) { - truncate_setsize(file_inode(aio_ring_file), 0);
  72. Download patch contrib/kpatch.spec

    --- 0.6.0-0.2/contrib/kpatch.spec 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/contrib/kpatch.spec 2019-08-28 17:34:00.000000000 +0000 @@ -1,7 +1,7 @@ Name: kpatch Summary: Dynamic kernel patching -Version: 0.6.0 -License: GPLv2 +Version: 0.8.0 +License: GPLv2 Group: System Environment/Kernel URL: http://github.com/dynup/kpatch Release: 1%{?dist} @@ -14,7 +14,7 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{na # needed for the kernel specific module %define KVER %(uname -r) -%description +%description kpatch is a Linux dynamic kernel patching tool which allows you to patch a running kernel without rebooting or restarting any processes. It enables sysadmins to apply critical security patches to the kernel immediately, without @@ -60,10 +60,10 @@ sacrificing security or stability. %prep -%setup -q +%setup -q %build -make %{_smp_mflags} +make %{_smp_mflags} %install rm -rf %{buildroot} @@ -93,6 +93,101 @@ rm -rf %{buildroot} %{_mandir}/man1/kpatch-build.1* %changelog +* Wed Aug 21 2019 Artem Savkov <asavkov@redhat.com> - 0.8.0 +- kpatch.ko atomic replace fixes +- Fixes for potential problems found by covscan +- Remove manual signaling logic from kpatch utility +- Don't strip callback symbols +- Allow dynamic debug static keys + +* Wed Jul 24 2019 Josh Poimboeuf <jpoimboe@redhat.com> - 0.7.1 +- Fix several powerpc-specific bugs, including two which can result in kernel + panics +- Use rpmbuild --nodeps for installing srpm on Fedora/RHEL +- Fix inconsistent unit test failures for FAIL tests + +* Thu Jul 18 2019 Artem Savkov <asavkov@redhat.com> - 0.7.0 +- Multiple memory leak fixes in kpatch-build +- livepatch-patch-hook compatability fixes for kernels 5.1+ +- Making kpatch-build compatible with custom gcc names +- Added rhel-rebased integration tests +- kpatch.service will no longer unload modules on stop +- kpatch load will no longer fail if a module is already loaded and enabled +- kpatch-build will now check for *_fixup section changes on ppc64le and will + fail on such changes +- Add support for R_X86_64_PLT32 +- don't allow jump labels +- ppc64le-specific kpatch-build fixes + +* Fri Apr 12 2019 Joe Lawrence <joe.lawrence@redhat.com> - 0.6.3 +- Lots of integration test work +- Better support for building out-of-tree modules +- Updated manpage options, drop deprecated distro specific mentions +- README.md updates for shadow variables, out-of-tree modules +- Fix core module compilation with CONFIG_HAVE_ARCH_PREL32_RELOCATIONS +- kpatch-build detects and abort on unsupported options + GCC_PLUGIN_LATENT_ENTROPY, GCC_PLUGIN_RANDSTRUCT +- Fix patch linking with 4.20+ +- Other minor shellcheck and kpatch-build fixups + +* Tue Oct 2 2018 Joe Lawrence <joe.lawrence@redhat.com> - 0.6.2 +- ppc64le: relax .text section addralign value check +- gcc8: unit-tests +- gcc8: support parent/child symbol relations +- gcc8: handle functions changing subsection +- gcc8: consider ".text.hot" sections bundleable +- kpatch-build: bugfix for less aggressive clean build-cache +- ubuntu: remove "-signed" substring from the kernel source package name +- ubuntu: explicitly note elfutils dependency +- upstream 4.18: unit-tests +- upstream 4.18: KCFLAGS -mcount-record support support +- RHEL-8: don't care who provides yumdownloader +- RHEL-8: account for quirky SRPM / release name conventions + +* Tue May 29 2018 Joe Lawrence <joe.lawrence@redhat.com> - 0.6.1 +- Increase the transition timeout, helpful for large CPU count systems +- Miscellaneous unit testing, ppc64, etc. fixes + +* Mon Apr 22 2018 Josh Poimboeuf <jpoimboe@redhat.com> - 0.6.0 +- Support and converted to livepatch-style hooks. +- Lots of misc bugfixes and cleanups +- Manpage, README.md fixups +- More PPC64 work +- "Undefined reference" build failure rework +- Livepatch disable retries +- New unit testing framework + +* Thu Dec 21 2017 Josh Poimboeuf <jpoimboe@redhat.com> - 0.5.0 +- Basic ppc64le support +- kpatch: load automatically signals stalled processes after a timeout +- kpatch: list shows stalled processes +- kpatch: signal signals stalled processes +- kpatch-build: multiple source patches can be combined into a single binary patch module +- kpatch-build: -n|--name option for giving a custom name to the patch module +- kpatch-build: additional -d options for more verbose debug modes +- The module prefix is now either livepatch- or kpatch- depending on the underlying patching technology + +* Mon Mar 13 2017 Josh Poimboeuf <jpoimboe@redhat.com> - 0.4.0 +- The tools underlying kpatch-build have been made more modular, in preparation for making create-diff-object more generally useful to other use cases (kernel livepatch, Xen live patching, user space patching). +- Support for all new upstream kernels up to 4.10. +- KASLR support. +- Many other bug fixes and improvements. + +* Thu Oct 11 2016 Jessica Yu - 0.3.4 +- bump version to 0.3.4 + +* Fri Aug 19 2016 Josh Poimboeuf <jpoimboe@redhat.com> - 0.3.3 +- bump version to 0.3.3 + +* Thu Feb 18 2016 Josh Poimboeuf <jpoimboe@redhat.com> - 0.3.2 +- bump version to 0.3.2 + +* Thu Nov 19 2015 Josh Poimboeuf <jpoimboe@redhat.com> - 0.3.1 +- Get kernel version from vmlinux if the kernel source tree is used + +* Wed Nov 18 2015 Josh Poimboeuf <jpoimboe@redhat.com> - 0.3.0 +- kpatch-build: fix gcc_version_check: both "GNU" and "GCC" are possible + * Wed Dec 3 2014 Josh Poimboeuf <jpoimboe@redhat.com> - 0.2.2-1 - rebased to current version
  73. Download patch test/integration/fedora-27/fixup-section.patch

    --- 0.6.0-0.2/test/integration/fedora-27/fixup-section.patch 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/fedora-27/fixup-section.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -diff -Nupr src.orig/fs/readdir.c src/fs/readdir.c ---- src.orig/fs/readdir.c 2017-11-17 15:58:39.457211972 -0500 -+++ src/fs/readdir.c 2017-11-17 15:59:02.078211972 -0500 -@@ -189,6 +189,8 @@ static int filldir(struct dir_context *c - goto efault; - } - dirent = buf->current_dir; -+ if (dirent->d_ino == 12345678) -+ printk("kpatch-test: testing .fixup section changes\n"); - if (__put_user(d_ino, &dirent->d_ino)) - goto efault; - if (__put_user(reclen, &dirent->d_reclen))
  74. Download patch test/integration/fedora-27/gcc-static-local-var-5.patch

    --- 0.6.0-0.2/test/integration/fedora-27/gcc-static-local-var-5.patch 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/fedora-27/gcc-static-local-var-5.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -diff -Nupr src.orig/kernel/audit.c src/kernel/audit.c ---- src.orig/kernel/audit.c 2017-11-17 15:58:51.516211972 -0500 -+++ src/kernel/audit.c 2017-11-17 15:59:14.324211972 -0500 -@@ -282,6 +282,12 @@ void audit_panic(const char *message) - } - } - -+void kpatch_audit_foo(void) -+{ -+ if (!jiffies) -+ printk("kpatch audit foo\n"); -+} -+ - static inline int audit_rate_check(void) - { - static unsigned long last_check = 0; -@@ -292,6 +298,7 @@ static inline int audit_rate_check(void) - unsigned long elapsed; - int retval = 0; - -+ kpatch_audit_foo(); - if (!audit_rate_limit) return 1; - - spin_lock_irqsave(&lock, flags); -@@ -311,6 +318,11 @@ static inline int audit_rate_check(void) - return retval; - } - -+noinline void kpatch_audit_check(void) -+{ -+ audit_rate_check(); -+} -+ - /** - * audit_log_lost - conditionally log lost audit message event - * @message: the message stating reason for lost audit message -@@ -357,6 +369,8 @@ static int audit_log_config_change(char - struct audit_buffer *ab; - int rc = 0; - -+ kpatch_audit_check(); -+ - ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE); - if (unlikely(!ab)) - return rc;
  75. Download patch test/integration/centos-7/shadow-newpid.patch

    --- 0.6.0-0.2/test/integration/centos-7/shadow-newpid.patch 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/centos-7/shadow-newpid.patch 2019-08-28 17:34:00.000000000 +0000 @@ -1,11 +1,12 @@ -diff -Nupr src.orig/fs/proc/array.c src/fs/proc/array.c ---- src.orig/fs/proc/array.c 2017-09-22 16:52:10.597110096 -0400 -+++ src/fs/proc/array.c 2017-09-22 16:59:40.799972178 -0400 -@@ -359,13 +359,20 @@ static inline void task_seccomp(struct s - #endif +Index: src/fs/proc/array.c +=================================================================== +--- src.orig/fs/proc/array.c ++++ src/fs/proc/array.c +@@ -394,13 +394,20 @@ static inline void task_seccomp(struct s + seq_putc(m, '\n'); } -+#include "kpatch.h" ++#include <linux/livepatch.h> static inline void task_context_switch_counts(struct seq_file *m, struct task_struct *p) { @@ -16,52 +17,54 @@ diff -Nupr src.orig/fs/proc/array.c src/ p->nvcsw, p->nivcsw); + -+ newpid = kpatch_shadow_get(p, "newpid"); ++ newpid = klp_shadow_get(p, 0); + if (newpid) + seq_printf(m, "newpid:\t%d\n", *newpid); } static void task_cpus_allowed(struct seq_file *m, struct task_struct *task) -diff -Nupr src.orig/kernel/exit.c src/kernel/exit.c ---- src.orig/kernel/exit.c 2017-09-22 16:52:10.506109720 -0400 -+++ src/kernel/exit.c 2017-09-22 16:59:40.799972178 -0400 -@@ -715,6 +715,7 @@ static void check_stack_usage(void) +Index: src/kernel/exit.c +=================================================================== +--- src.orig/kernel/exit.c ++++ src/kernel/exit.c +@@ -791,6 +791,7 @@ static void check_stack_usage(void) static inline void check_stack_usage(void) {} #endif -+#include "kpatch.h" ++#include <linux/livepatch.h> void do_exit(long code) { struct task_struct *tsk = current; -@@ -812,6 +813,8 @@ void do_exit(long code) +@@ -888,6 +889,8 @@ void do_exit(long code) check_stack_usage(); exit_thread(); -+ kpatch_shadow_free(tsk, "newpid"); ++ klp_shadow_free(tsk, 0, NULL); + /* * Flush inherited counters to the parent - before the parent * gets woken up by child-exit notifications. -diff -Nupr src.orig/kernel/fork.c src/kernel/fork.c ---- src.orig/kernel/fork.c 2017-09-22 16:52:10.504109711 -0400 -+++ src/kernel/fork.c 2017-09-22 17:00:44.938237460 -0400 -@@ -1700,6 +1700,7 @@ struct task_struct *fork_idle(int cpu) +Index: src/kernel/fork.c +=================================================================== +--- src.orig/kernel/fork.c ++++ src/kernel/fork.c +@@ -1757,6 +1757,7 @@ struct task_struct *fork_idle(int cpu) * It copies the process, and if successful kick-starts * it and waits for it to finish using the VM if required. */ -+#include "kpatch.h" ++#include <linux/livepatch.h> long do_fork(unsigned long clone_flags, unsigned long stack_start, unsigned long stack_size, -@@ -1737,6 +1738,13 @@ long do_fork(unsigned long clone_flags, +@@ -1794,6 +1795,13 @@ long do_fork(unsigned long clone_flags, if (!IS_ERR(p)) { struct completion vfork; struct pid *pid; + int *newpid; + static int ctr = 0; + -+ newpid = kpatch_shadow_alloc(p, "newpid", sizeof(*newpid), -+ GFP_KERNEL); ++ newpid = klp_shadow_get_or_alloc(p, 0, sizeof(*newpid), ++ GFP_KERNEL, NULL, NULL); + if (newpid) + *newpid = ctr++;
  76. Download patch Makefile

    --- 0.6.0-0.2/Makefile 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/Makefile 2019-08-28 17:34:00.000000000 +0000 @@ -7,10 +7,14 @@ UNINSTALL_DIRS = $(SUBDIRS:%=uninstall-% CLEAN_DIRS = $(SUBDIRS:%=clean-%) UNITTEST_DIR = test/unit +INTEGRATION_DIR = test/integration CLEAN_DIRS += clean-$(UNITTEST_DIR) .PHONY: all install uninstall clean check unit .PHONY: $(SUBDIRS) $(BUILD_DIRS) $(INSTALL_DIRS) $(CLEAN_DIRS) +.PHONY: integration integration-slow integration-quick +.PHONY: vagrant-integration-slow vagrant-integration-quick vagrant-integration +.PHONY: vagrant-install all: $(BUILD_DIRS) @@ -32,5 +36,30 @@ $(CLEAN_DIRS): unit: $(UNITTEST_DIR)/Makefile build-kpatch-build $(MAKE) -C $(UNITTEST_DIR) +integration: integration-quick + +integration-slow: $(INTEGRATION_DIR)/Makefile build-kpatch-build build-kpatch build-kmod + $(MAKE) -C $(INTEGRATION_DIR) slow + +integration-quick: $(INTEGRATION_DIR)/Makefile build-kpatch-build build-kpatch build-kmod + $(MAKE) -C $(INTEGRATION_DIR) quick + +vagrant-install: $(INTEGRATION_DIR)/lib.sh +ifneq ($(shell id -u), 0) + @echo "WARNING: This target is intended for use on freshly-installed machines/vms only." && \ + echo "Do not proceed unless you read $(INTEGRATION_DIR)/lib.sh and realise what this target does." && \ + echo "Press ctrl-c to abort, return to proceed." && \ + read +endif + source $(INTEGRATION_DIR)/lib.sh && kpatch_check_install_vagrant + +vagrant-integration: vagrant-integration-quick + +vagrant-integration-slow: + $(MAKE) -C $(INTEGRATION_DIR) vagrant-slow + +vagrant-integration-quick: + $(MAKE) -C $(INTEGRATION_DIR) vagrant-quick + check: shellcheck kpatch/kpatch kpatch-build/kpatch-build kpatch-build/kpatch-gcc
  77. Download patch kpatch-build/kpatch.h

    --- 0.6.0-0.2/kpatch-build/kpatch.h 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/kpatch-build/kpatch.h 2019-08-28 17:34:00.000000000 +0000 @@ -0,0 +1,11 @@ +#ifndef _KPATCH_H_ +#define _KPATCH_H_ + +enum exit_status { + EXIT_STATUS_SUCCESS = 0, + EXIT_STATUS_ERROR = 1, + EXIT_STATUS_DIFF_FATAL = 2, + EXIT_STATUS_NO_CHANGE = 3, +}; + +#endif /* _KPATCH_H_ */
  78. Download patch .git/logs/HEAD

    --- 0.6.0-0.2/.git/logs/HEAD 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/.git/logs/HEAD 2019-08-28 17:34:00.000000000 +0000 @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 30a7dd677bcc25bd70070f7f9d16a88c190b8b0b Benjamin M Romer <benjamin.romer@canonical.com> 1567013640 -0400 clone: from https://github.com/dynup/kpatch.git
  79. Download patch .git/hooks/prepare-commit-msg.sample

    --- 0.6.0-0.2/.git/hooks/prepare-commit-msg.sample 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/.git/hooks/prepare-commit-msg.sample 2019-08-28 17:33:59.000000000 +0000 @@ -0,0 +1,42 @@ +#!/bin/sh +# +# An example hook script to prepare the commit log message. +# Called by "git commit" with the name of the file that has the +# commit message, followed by the description of the commit +# message's source. The hook's purpose is to edit the commit +# message file. If the hook fails with a non-zero status, +# the commit is aborted. +# +# To enable this hook, rename this file to "prepare-commit-msg". + +# This hook includes three examples. The first one removes the +# "# Please enter the commit message..." help message. +# +# The second includes the output of "git diff --name-status -r" +# into the message, just before the "git status" output. It is +# commented because it doesn't cope with --amend or with squashed +# commits. +# +# The third example adds a Signed-off-by line to the message, that can +# still be edited. This is rarely a good idea. + +COMMIT_MSG_FILE=$1 +COMMIT_SOURCE=$2 +SHA1=$3 + +/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE" + +# case "$COMMIT_SOURCE,$SHA1" in +# ,|template,) +# /usr/bin/perl -i.bak -pe ' +# print "\n" . `git diff --cached --name-status -r` +# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;; +# *) ;; +# esac + +# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE" +# if test -z "$COMMIT_SOURCE" +# then +# /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE" +# fi
  80. Download patch man/kpatch-build.1

    --- 0.6.0-0.2/man/kpatch-build.1 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/man/kpatch-build.1 2019-08-28 17:34:00.000000000 +0000 @@ -11,9 +11,6 @@ currently running and creates a kernel m modified functions in the kernel such that the patched code takes effect. -This script currently only works on Fedora and will need to be adapted -to work on other distros. - .SH OPTIONS -h|--help @@ -50,6 +47,10 @@ to work on other distros. Keep scratch files in /tmp (can be specified multiple times) +-e|--oot-module + Enable patching out-of-tree module, + specify current version of module + --skip-cleanup Skip post-build cleanup
  81. Download patch .git/hooks/update.sample

    --- 0.6.0-0.2/.git/hooks/update.sample 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/.git/hooks/update.sample 2019-08-28 17:33:59.000000000 +0000 @@ -0,0 +1,128 @@ +#!/bin/sh +# +# An example hook script to block unannotated tags from entering. +# Called by "git receive-pack" with arguments: refname sha1-old sha1-new +# +# To enable this hook, rename this file to "update". +# +# Config +# ------ +# hooks.allowunannotated +# This boolean sets whether unannotated tags will be allowed into the +# repository. By default they won't be. +# hooks.allowdeletetag +# This boolean sets whether deleting tags will be allowed in the +# repository. By default they won't be. +# hooks.allowmodifytag +# This boolean sets whether a tag may be modified after creation. By default +# it won't be. +# hooks.allowdeletebranch +# This boolean sets whether deleting branches will be allowed in the +# repository. By default they won't be. +# hooks.denycreatebranch +# This boolean sets whether remotely creating branches will be denied +# in the repository. By default this is allowed. +# + +# --- Command line +refname="$1" +oldrev="$2" +newrev="$3" + +# --- Safety check +if [ -z "$GIT_DIR" ]; then + echo "Don't run this script from the command line." >&2 + echo " (if you want, you could supply GIT_DIR then run" >&2 + echo " $0 <ref> <oldrev> <newrev>)" >&2 + exit 1 +fi + +if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then + echo "usage: $0 <ref> <oldrev> <newrev>" >&2 + exit 1 +fi + +# --- Config +allowunannotated=$(git config --bool hooks.allowunannotated) +allowdeletebranch=$(git config --bool hooks.allowdeletebranch) +denycreatebranch=$(git config --bool hooks.denycreatebranch) +allowdeletetag=$(git config --bool hooks.allowdeletetag) +allowmodifytag=$(git config --bool hooks.allowmodifytag) + +# check for no description +projectdesc=$(sed -e '1q' "$GIT_DIR/description") +case "$projectdesc" in +"Unnamed repository"* | "") + echo "*** Project description file hasn't been set" >&2 + exit 1 + ;; +esac + +# --- Check types +# if $newrev is 0000...0000, it's a commit to delete a ref. +zero="0000000000000000000000000000000000000000" +if [ "$newrev" = "$zero" ]; then + newrev_type=delete +else + newrev_type=$(git cat-file -t $newrev) +fi + +case "$refname","$newrev_type" in + refs/tags/*,commit) + # un-annotated tag + short_refname=${refname##refs/tags/} + if [ "$allowunannotated" != "true" ]; then + echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2 + echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 + exit 1 + fi + ;; + refs/tags/*,delete) + # delete tag + if [ "$allowdeletetag" != "true" ]; then + echo "*** Deleting a tag is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/tags/*,tag) + # annotated tag + if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 + then + echo "*** Tag '$refname' already exists." >&2 + echo "*** Modifying a tag is not allowed in this repository." >&2 + exit 1 + fi + ;; + refs/heads/*,commit) + # branch + if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then + echo "*** Creating a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/heads/*,delete) + # delete branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/remotes/*,commit) + # tracking branch + ;; + refs/remotes/*,delete) + # delete tracking branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a tracking branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + *) + # Anything else (is there anything else?) + echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 + exit 1 + ;; +esac + +# --- Finished +exit 0 Binary files 0.6.0-0.2/.git/index and 0.8.0-0ubuntu2/.git/index differ
  82. Download patch .git/hooks/pre-applypatch.sample

    --- 0.6.0-0.2/.git/hooks/pre-applypatch.sample 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/.git/hooks/pre-applypatch.sample 2019-08-28 17:33:59.000000000 +0000 @@ -0,0 +1,14 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed +# by applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-applypatch". + +. git-sh-setup +precommit="$(git rev-parse --git-path hooks/pre-commit)" +test -x "$precommit" && exec "$precommit" ${1+"$@"} +:
  83. Download patch debian/post-dkms.sh

    --- 0.6.0-0.2/debian/post-dkms.sh 2018-06-15 22:23:46.000000000 +0000 +++ 0.8.0-0ubuntu2/debian/post-dkms.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -#!/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
  84. Download patch test/integration/fedora-27/meminfo-string.patch

    --- 0.6.0-0.2/test/integration/fedora-27/meminfo-string.patch 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/fedora-27/meminfo-string.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -diff -Nupr src.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c ---- src.orig/fs/proc/meminfo.c 2017-11-17 15:59:24.724211972 -0500 -+++ src/fs/proc/meminfo.c 2017-11-17 15:59:24.721211972 -0500 -@@ -132,7 +132,7 @@ static int meminfo_proc_show(struct seq_ - seq_printf(m, "VmallocTotal: %8lu kB\n", - (unsigned long)VMALLOC_TOTAL >> 10); - show_val_kb(m, "VmallocUsed: ", 0ul); -- show_val_kb(m, "VmallocChunk: ", 0ul); -+ show_val_kb(m, "VMALLOCCHUNK: ", 0ul); - - #ifdef CONFIG_MEMORY_FAILURE - seq_printf(m, "HardwareCorrupted: %5lu kB\n",
  85. Download patch test/integration/centos-7/meminfo-cmdline-rebuild-SLOW.patch

    --- 0.6.0-0.2/test/integration/centos-7/meminfo-cmdline-rebuild-SLOW.patch 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/centos-7/meminfo-cmdline-rebuild-SLOW.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ -diff -Nupr src.orig/fs/proc/cmdline.c src/fs/proc/cmdline.c ---- src.orig/fs/proc/cmdline.c 2017-09-22 15:27:21.698056175 -0400 -+++ src/fs/proc/cmdline.c 2017-09-22 15:27:37.842123028 -0400 -@@ -5,7 +5,7 @@ - - static int cmdline_proc_show(struct seq_file *m, void *v) - { -- seq_printf(m, "%s\n", saved_command_line); -+ seq_printf(m, "%s kpatch=1\n", saved_command_line); - return 0; - } - -diff -Nupr src.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c ---- src.orig/fs/proc/meminfo.c 2017-09-22 15:27:21.699056179 -0400 -+++ src/fs/proc/meminfo.c 2017-09-22 15:27:37.843123032 -0400 -@@ -99,7 +99,7 @@ static int meminfo_proc_show(struct seq_ - "Committed_AS: %8lu kB\n" - "VmallocTotal: %8lu kB\n" - "VmallocUsed: %8lu kB\n" -- "VmallocChunk: %8lu kB\n" -+ "VMALLOCCHUNK: %8lu kB\n" - #ifdef CONFIG_MEMORY_FAILURE - "HardwareCorrupted: %5lu kB\n" - #endif -diff -Nupr src.orig/include/linux/kernel.h src/include/linux/kernel.h ---- src.orig/include/linux/kernel.h 2017-09-22 15:27:20.379050713 -0400 -+++ src/include/linux/kernel.h 2017-09-22 15:27:37.843123032 -0400 -@@ -2,6 +2,7 @@ - #define _LINUX_KERNEL_H - - -+ - #include <stdarg.h> - #include <linux/linkage.h> - #include <linux/stddef.h>
  86. Download patch test/integration/centos-7/meminfo-cmdline-rebuild-SLOW-LOADED.test

    --- 0.6.0-0.2/test/integration/centos-7/meminfo-cmdline-rebuild-SLOW-LOADED.test 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/centos-7/meminfo-cmdline-rebuild-SLOW-LOADED.test 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -#!/bin/bash - -grep VMALLOCCHUNK /proc/meminfo && grep kpatch=1 /proc/cmdline
  87. Download patch test/difftree.sh

    --- 0.6.0-0.2/test/difftree.sh 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/difftree.sh 2019-08-28 17:34:00.000000000 +0000 @@ -46,7 +46,7 @@ do ;; esac # skip objects that are the linked product of more than one object file - [[ $(eu-readelf -s $i | grep FILE | wc -l) -ne 1 ]] && continue + [[ $(readelf -s $i | awk '$4=="FILE" {n++} END {print n}') -ne 1 ]] && continue $SCRIPTDIR/../kpatch-build/create-diff-object $i $i /usr/lib/debug/lib/modules/$(uname -r)/vmlinux "$TEMPDIR/output.o" > "$TEMPDIR/log.txt" 2>&1 RETCODE=$? # expect RETCODE to be 3 indicating no change
  88. Download patch .git/hooks/applypatch-msg.sample

    --- 0.6.0-0.2/.git/hooks/applypatch-msg.sample 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/.git/hooks/applypatch-msg.sample 2019-08-28 17:33:59.000000000 +0000 @@ -0,0 +1,15 @@ +#!/bin/sh +# +# An example hook script to check the commit log message taken by +# applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. The hook is +# allowed to edit the commit message file. +# +# To enable this hook, rename this file to "applypatch-msg". + +. git-sh-setup +commitmsg="$(git rev-parse --git-path hooks/commit-msg)" +test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"} +:
  89. Download patch test/integration/fedora-27/data-read-mostly.patch

    --- 0.6.0-0.2/test/integration/fedora-27/data-read-mostly.patch 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/fedora-27/data-read-mostly.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -diff -Nupr src.orig/net/core/dev.c src/net/core/dev.c ---- src.orig/net/core/dev.c 2017-11-17 15:58:50.569211972 -0500 -+++ src/net/core/dev.c 2017-11-17 15:59:00.286211972 -0500 -@@ -4260,6 +4260,7 @@ skip_classify: - case RX_HANDLER_PASS: - break; - default: -+ printk("BUG!\n"); - BUG(); - } - }
  90. Download patch debian/patches/create-diff-object-fix-WARN-_ONCE-detection-on-newer.patch

    --- 0.6.0-0.2/debian/patches/create-diff-object-fix-WARN-_ONCE-detection-on-newer.patch 2018-06-15 22:23:46.000000000 +0000 +++ 0.8.0-0ubuntu2/debian/patches/create-diff-object-fix-WARN-_ONCE-detection-on-newer.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ -From 6b03bc8ec08106fd9070885c9fbd1fcb2bb7cb39 Mon Sep 17 00:00:00 2001 -From: Josh Poimboeuf <jpoimboe@redhat.com> -Date: Wed, 13 Jul 2016 16:44:14 -0500 -Subject: [PATCH] create-diff-object: fix WARN*_ONCE detection on newer kernels - -This fixes the detection of WARN_ON_ONCE, WARN_ONCE, and WARN_TAINT_ONCE -on Linux 4.6 and newer. - -The signature for those macros changed with upstream Linux commit -dfbf2897d004 ("bug: set warn variable before calling WARN()"). - -Fixes #602. ---- - kpatch-build/create-diff-object.c | 29 +++++++++++++++-------------- - 1 file changed, 15 insertions(+), 14 deletions(-) - ---- a/kpatch-build/create-diff-object.c -+++ b/kpatch-build/create-diff-object.c -@@ -690,22 +690,21 @@ - * Warning: Hackery lies herein. It's hopefully justified by the fact that - * this issue is very common. - * -- * base object: -- * -- * be 5e 04 00 00 mov $0x45e,%esi -- * 48 c7 c7 ff 5a a1 81 mov $0xffffffff81a15aff,%rdi -- * e8 26 13 08 00 callq ffffffff8108d0d0 <warn_slowpath_fmt> -- * -- * patched object: -- * -- * be 5e 04 00 00 mov $0x45f,%esi -- * 48 c7 c7 ff 5a a1 81 mov $0xffffffff81a15aff,%rdi -- * e8 26 13 08 00 callq ffffffff8108d0d0 <warn_slowpath_fmt> -- * -- * The above is the most common case. The pattern which applies to all cases -- * is an immediate move of the line number to %esi followed by zero or more -- * relas to a string section followed by a rela to warn_slowpath_*. -+ * Example: - * -+ * 938: be 70 00 00 00 mov $0x70,%esi -+ * 93d: 48 c7 c7 00 00 00 00 mov $0x0,%rdi -+ * 940: R_X86_64_32S .rodata.tcp_conn_request.str1.8+0x88 -+ * 944: c6 05 00 00 00 00 01 movb $0x1,0x0(%rip) # 94b <tcp_conn_request+0x94b> -+ * 946: R_X86_64_PC32 .data.unlikely-0x1 -+ * 94b: e8 00 00 00 00 callq 950 <tcp_conn_request+0x950> -+ * 94c: R_X86_64_PC32 warn_slowpath_null-0x4 -+ * -+ * The pattern which applies to all cases: -+ * 1) immediate move of the line number to %esi -+ * 2) (optional) string section rela -+ * 3) (optional) __warned.xxxxx static local rela -+ * 4) warn_slowpath_* rela - */ - static int kpatch_warn_only_change(struct section *sec) - { -@@ -759,6 +758,8 @@ - continue; - if (rela->string) - continue; -+ if (!strncmp(rela->sym->name, "__warned.", 9)) -+ continue; - if (!strncmp(rela->sym->name, "warn_slowpath_", 14)) { - found = 1; - break;
  91. Download patch kmod/patch/livepatch-patch-hook.c

    --- 0.6.0-0.2/kmod/patch/livepatch-patch-hook.c 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/kmod/patch/livepatch-patch-hook.c 2019-08-28 17:34:00.000000000 +0000 @@ -47,10 +47,13 @@ #define HAVE_SYMPOS #endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) && \ - LINUX_VERSION_CODE <= KERNEL_VERSION(4, 15, 0)) || \ - defined(RHEL_RELEASE_CODE) -#define HAVE_IMMEDIATE +#ifdef RHEL_RELEASE_CODE +# if RHEL_RELEASE_CODE <= RHEL_RELEASE_VERSION(7, 5) +# define HAVE_IMMEDIATE +# endif +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) && \ + LINUX_VERSION_CODE <= KERNEL_VERSION(4, 15, 0)) +# define HAVE_IMMEDIATE #endif #ifdef RHEL_RELEASE_CODE @@ -61,6 +64,16 @@ # define HAVE_CALLBACKS #endif +#ifdef RHEL_RELEASE_CODE +# if (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7, 8) && \ + RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(8, 0)) || \ + RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(8, 2) +# define HAVE_SIMPLE_ENABLE +# endif +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0) +# define HAVE_SIMPLE_ENABLE +#endif + /* * There are quite a few similar structures at play in this file: * - livepatch.h structs prefixed with klp_* @@ -372,7 +385,7 @@ static int __init patch_init(void) goto out; lpatch->mod = THIS_MODULE; lpatch->objs = lobjects; -#if defined(__powerpc__) && defined(HAVE_IMMEDIATE) +#if defined(__powerpc64__) && defined(HAVE_IMMEDIATE) lpatch->immediate = true; #endif @@ -434,15 +447,19 @@ static int __init patch_init(void) */ patch_free_scaffold(); +#ifndef HAVE_SIMPLE_ENABLE ret = klp_register_patch(lpatch); if (ret) { patch_free_livepatch(lpatch); return ret; } +#endif ret = klp_enable_patch(lpatch); if (ret) { +#ifndef HAVE_SIMPLE_ENABLE WARN_ON(klp_unregister_patch(lpatch)); +#endif patch_free_livepatch(lpatch); return ret; } @@ -456,7 +473,10 @@ out: static void __exit patch_exit(void) { +#ifndef HAVE_SIMPLE_ENABLE WARN_ON(klp_unregister_patch(lpatch)); +#endif + patch_free_livepatch(lpatch); } module_init(patch_init);
  92. Download patch .git/hooks/fsmonitor-watchman.sample

    --- 0.6.0-0.2/.git/hooks/fsmonitor-watchman.sample 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/.git/hooks/fsmonitor-watchman.sample 2019-08-28 17:33:59.000000000 +0000 @@ -0,0 +1,114 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use IPC::Open2; + +# An example hook script to integrate Watchman +# (https://facebook.github.io/watchman/) with git to speed up detecting +# new and modified files. +# +# The hook is passed a version (currently 1) and a time in nanoseconds +# formatted as a string and outputs to stdout all files that have been +# modified since the given time. Paths must be relative to the root of +# the working tree and separated by a single NUL. +# +# To enable this hook, rename this file to "query-watchman" and set +# 'git config core.fsmonitor .git/hooks/query-watchman' +# +my ($version, $time) = @ARGV; + +# Check the hook interface version + +if ($version == 1) { + # convert nanoseconds to seconds + $time = int $time / 1000000000; +} else { + die "Unsupported query-fsmonitor hook version '$version'.\n" . + "Falling back to scanning...\n"; +} + +my $git_work_tree; +if ($^O =~ 'msys' || $^O =~ 'cygwin') { + $git_work_tree = Win32::GetCwd(); + $git_work_tree =~ tr/\\/\//; +} else { + require Cwd; + $git_work_tree = Cwd::cwd(); +} + +my $retry = 1; + +launch_watchman(); + +sub launch_watchman { + + my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty') + or die "open2() failed: $!\n" . + "Falling back to scanning...\n"; + + # In the query expression below we're asking for names of files that + # changed since $time but were not transient (ie created after + # $time but no longer exist). + # + # To accomplish this, we're using the "since" generator to use the + # recency index to select candidate nodes and "fields" to limit the + # output to file names only. Then we're using the "expression" term to + # further constrain the results. + # + # The category of transient files that we want to ignore will have a + # creation clock (cclock) newer than $time_t value and will also not + # currently exist. + + my $query = <<" END"; + ["query", "$git_work_tree", { + "since": $time, + "fields": ["name"], + "expression": ["not", ["allof", ["since", $time, "cclock"], ["not", "exists"]]] + }] + END + + print CHLD_IN $query; + close CHLD_IN; + my $response = do {local $/; <CHLD_OUT>}; + + die "Watchman: command returned no output.\n" . + "Falling back to scanning...\n" if $response eq ""; + die "Watchman: command returned invalid output: $response\n" . + "Falling back to scanning...\n" unless $response =~ /^\{/; + + my $json_pkg; + eval { + require JSON::XS; + $json_pkg = "JSON::XS"; + 1; + } or do { + require JSON::PP; + $json_pkg = "JSON::PP"; + }; + + my $o = $json_pkg->new->utf8->decode($response); + + if ($retry > 0 and $o->{error} and $o->{error} =~ m/unable to resolve root .* directory (.*) is not watched/) { + print STDERR "Adding '$git_work_tree' to watchman's watch list.\n"; + $retry--; + qx/watchman watch "$git_work_tree"/; + die "Failed to make watchman watch '$git_work_tree'.\n" . + "Falling back to scanning...\n" if $? != 0; + + # Watchman will always return all files on the first query so + # return the fast "everything is dirty" flag to git and do the + # Watchman query just to get it over with now so we won't pay + # the cost in git to look up each individual file. + print "/\0"; + eval { launch_watchman() }; + exit 0; + } + + die "Watchman: $o->{error}.\n" . + "Falling back to scanning...\n" if $o->{error}; + + binmode STDOUT, ":utf8"; + local $, = "\0"; + print @{$o->{files}}; +}
  93. Download patch .git/packed-refs

    --- 0.6.0-0.2/.git/packed-refs 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/.git/packed-refs 2019-08-28 17:34:00.000000000 +0000 @@ -0,0 +1,31 @@ +# pack-refs with: peeled fully-peeled sorted +30a7dd677bcc25bd70070f7f9d16a88c190b8b0b refs/remotes/origin/master +258ac3f39a14d52d73868d24770b5b6f5786eca2 refs/tags/0.5.0 +135b438af0b9c9d903b01b3386c74add1401dda1 refs/tags/v0.1.0 +0f3f8ae3369cec5be61c73bf559a8df0c82f9df4 refs/tags/v0.1.1 +6ed046f1c2a770099ae984e305fc2260480749f0 refs/tags/v0.1.10 +2601b154d3351b3411043fcff4ccd71fbb039e1d refs/tags/v0.1.2 +a705c223fc6efa87a8d7521c791e9515ad6d981c refs/tags/v0.1.3 +3ca8106987bad32dcc60ff9c54d687b92033c0c1 refs/tags/v0.1.4 +f4bba70412801a475eed21087e2dd8cae6b94996 refs/tags/v0.1.5 +92fb49e6f2ec98684b35df6f50976e25fa8eced8 refs/tags/v0.1.6 +44ad2ba733063438616ecbf4222da5caebd62a6e refs/tags/v0.1.7 +576ee094420918c6d431d9d97b135046f138e919 refs/tags/v0.1.8 +ce8bb40fc06cc2cd6c4d02199ee3a895bfadb551 refs/tags/v0.1.9 +688a03d8b629287a5ffb501bfa28dd9a3781e10f refs/tags/v0.2.0 +0fd7f7f0be4287e95af4d2c69e57865fea63dcb1 refs/tags/v0.2.1 +f817265c5adbc11b71f853b804cfacd6ab85db7c refs/tags/v0.2.2 +f4b5eded0c14ef4f2d6b6d801f1519659e84e217 refs/tags/v0.3.0 +b60d3acddb7b96b3b6dd7a4c519189a05b0a4d18 refs/tags/v0.3.1 +706b63ad99cc00c539970961b1950da303cb1f3b refs/tags/v0.3.2 +fa557bd11da59a9a4aea20f3a74125ead2477792 refs/tags/v0.3.3 +4e1a5962dabf08b6aefe2584c28d26fc594e8fb6 refs/tags/v0.3.4 +810f9243826219cca9276d364512bb88411aa863 refs/tags/v0.4.0 +258ac3f39a14d52d73868d24770b5b6f5786eca2 refs/tags/v0.5.0 +d5eb921af14b707079ce70809ad64eddfdb1f00f refs/tags/v0.6.0 +7f550f01bd308cf058ae782327d29c8916cc5602 refs/tags/v0.6.1 +7305d6c29a45594c44036601e42909b5e5132bdc refs/tags/v0.6.2 +f4ed9ff76997114ed838a3b964508d721f19f293 refs/tags/v0.6.3 +535e91767900c12ccd49eb5c9fe1732a0c1d85bb refs/tags/v0.7.0 +d7c5810e2a6acacfa5fec1e38d2f75af8e8c818c refs/tags/v0.7.1 +2a29bc7dea9a7da12705c7b50315eee1acdd9156 refs/tags/v0.8.0
  94. Download patch .git/info/exclude

    --- 0.6.0-0.2/.git/info/exclude 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/.git/info/exclude 2019-08-28 17:33:59.000000000 +0000 @@ -0,0 +1,6 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~
  95. Download patch .git/hooks/post-update.sample

    --- 0.6.0-0.2/.git/hooks/post-update.sample 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/.git/hooks/post-update.sample 2019-08-28 17:33:59.000000000 +0000 @@ -0,0 +1,8 @@ +#!/bin/sh +# +# An example hook script to prepare a packed repository for use over +# dumb transports. +# +# To enable this hook, rename this file to "post-update". + +exec git update-server-info
  96. Download patch test/integration/centos-7/fixup-section.patch

    --- 0.6.0-0.2/test/integration/centos-7/fixup-section.patch 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/test/integration/centos-7/fixup-section.patch 2019-08-28 17:34:00.000000000 +0000 @@ -1,12 +1,12 @@ -diff -Nupr src.orig/fs/readdir.c src/fs/readdir.c ---- src.orig/fs/readdir.c 2017-09-22 15:27:21.658056010 -0400 -+++ src/fs/readdir.c 2017-09-22 15:27:26.378075555 -0400 -@@ -166,6 +166,8 @@ static int filldir(void * __buf, const c +diff --git a/fs/readdir.c b/fs/readdir.c +index febd02dfbe2d..064db7bd70d0 100644 +--- a/fs/readdir.c ++++ b/fs/readdir.c +@@ -176,6 +176,7 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset, goto efault; } dirent = buf->current_dir; -+ if (dirent->d_ino == 12345678) -+ printk("kpatch-test: testing .fixup section changes\n"); ++ asm("nop"); if (__put_user(d_ino, &dirent->d_ino)) goto efault; if (__put_user(reclen, &dirent->d_reclen))
  97. Download patch man/kpatch.1

    --- 0.6.0-0.2/man/kpatch.1 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/man/kpatch.1 2019-08-28 17:34:00.000000000 +0000 @@ -35,6 +35,9 @@ info <module> list list installed patch modules +signal + signal/poke any process stalling the current patch transition + version display the kpatch version
  98. Download patch debian/patches/ubuntu-kernel-variants.patch

    --- 0.6.0-0.2/debian/patches/ubuntu-kernel-variants.patch 1970-01-01 00:00:00.000000000 +0000 +++ 0.8.0-0ubuntu2/debian/patches/ubuntu-kernel-variants.patch 2019-08-28 17:37:11.000000000 +0000 @@ -0,0 +1,139 @@ +Description: support ubuntu kernel flavors + Add support for kernel flavors (generic, lowlatency, aws, etc...) the flavor + may contain dashes and/or tildes, so handle these cases. + +Author: Benjamin M Romer <benjamin.romer@canonical.com> +Last-Update: 2018-10-22 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/kpatch-build/kpatch-build ++++ b/kpatch-build/kpatch-build +@@ -423,7 +423,7 @@ + echo " (not recommended)" >&2 + } + +-options="$(getopt -o ha:r:s:c:v:j:t:n:o:de: -l "help,archversion:,sourcerpm:,sourcedir:,config:,vmlinux:,jobs:,target:,name:,output:,oot-module:,debug,skip-gcc-check,skip-cleanup" -- "$@")" || die "getopt failed" ++options="$(getopt -o ha:r:s:c:v:j:t:n:o:def: -l "help,archversion:,sourcerpm:,sourcedir:,config:,vmlinux:,jobs:,target:,name:,output:,oot-module:,debug,skip-gcc-check,skip-cleanup,flavor:" -- "$@")" || die "getopt failed" + + eval set -- "$options" + +@@ -494,6 +494,10 @@ + echo "WARNING: Skipping gcc version matching check (not recommended)" + SKIPGCCCHECK=1 + ;; ++ -f|--flavor) ++ FLAVOR="$2" ++ shift ++ ;; + *) + [[ "$1" = "--" ]] && shift && continue + [[ ! -f "$1" ]] && die "patch file '$1' not found" +@@ -551,11 +555,23 @@ + + # Extract the target kernel version from vmlinux in this case. + ARCHVERSION="$(strings "$VMLINUX" | grep -m 1 -e "^Linux version" | awk '{ print($3); }')" ++ FLAV=${ARCHVERSION#*-*-} ++ if [[ -n "$FLAVOR" ]]; then ++ if [[ "$FLAVOR" != "$FLAV" ]]; then ++ die "specified flavor $FLAVOR does not match vmlinux ($FLAV)" ++ fi ++ else ++ FLAVOR=$FLAV ++ fi + else + ARCHVERSION="$(modinfo -F vermagic "$OOT_MODULE" | awk '{print $1}')" + fi + fi + ++if [[ -z "$FLAVOR" ]]; then ++ FLAVOR=$(uname -r | cut -d - -f 3) ++fi ++ + [[ -z "$ARCHVERSION" ]] && ARCHVERSION="$(uname -r)" + + [[ "$SKIPCLEANUP" -eq 0 ]] && trap cleanup EXIT INT TERM HUP +@@ -775,7 +791,7 @@ + fakeroot debian/rules clean 2>&1 | logger || die + # shellcheck disable=SC1117 + MAKEFLAGS="--no-print-directory" fakeroot \ +- debian/rules -j "$CPUS" build-generic build_image=vmlinux \ ++ debian/rules -j "$CPUS" "build-$FLAVOR" build_image=vmlinux \ + builddir="$TEMPDIR" enable_zfs=false \ + CROSS_COMPILE="$TOOLSDIR/kpatch-gcc\ " 2>&1 | logger \ + || die +@@ -794,10 +810,10 @@ + KPATCH_GCC_SRCDIR="$SRCDIR" + export KPATCH_GCC_SRCDIR + if [[ $DISTRO = ubuntu ]]; then +- rm -f debian/stamps/stamp-build-generic ++ rm -f "debian/stamps/stamp-build-$FLAVOR" + # shellcheck disable=SC1117 + MAKEFLAGS="--no-print-directory" fakeroot \ +- debian/rules -j "$CPUS" build-generic build_image=vmlinux \ ++ debian/rules -j "$CPUS" "build-$FLAVOR" build_image=vmlinux \ + CROSS_COMPILE="$TOOLSDIR/kpatch-gcc\ " enable_zfs=false \ + LDFLAGS_vmlinux="--warn-unresolved-symbols" \ + KBUILD_MODPOST_WARN=1 builddir="$TEMPDIR" 2>&1 | logger || die +@@ -821,7 +837,7 @@ + fi + + if [[ $DISTRO = ubuntu ]]; then +- [[ -n "$OOT_MODULE" ]] || grep -q vmlinux "$TEMPDIR/build-generic/Module.symvers" || die "truncated $TEMPDIR/build-generic/Module.symvers file" ++ [[ -n "$OOT_MODULE" ]] || grep -q vmlinux "$TEMPDIR/build-$FLAVOR/Module.symvers" || die "truncated $TEMPDIR/build-$FLAVOR/Module.symvers file" + else + [[ -n "$OOT_MODULE" ]] ||grep -q vmlinux "$SRCDIR/Module.symvers" || die "truncated $SRCDIR/Module.symvers file" + fi +@@ -832,7 +848,7 @@ + do + mkdir -p "$TEMPDIR/patched/$(dirname "$i")" || die + if [[ $DISTRO = ubuntu ]]; then +- cp -f "$TEMPDIR/build-generic/$i" "$TEMPDIR/patched/$i" || die ++ cp -f "$TEMPDIR/build-$FLAVOR/$i" "$TEMPDIR/patched/$i" || die + else + cp -f "$SRCDIR/$i" "$TEMPDIR/patched/$i" || die + fi +@@ -878,7 +894,7 @@ + + mkdir -p "output/$(dirname "$i")" + if [[ "$DISTRO" = ubuntu ]]; then +- cd "$TEMPDIR/build-generic" || die ++ cd "$TEMPDIR/build-$FLAVOR" || die + else + cd "$SRCDIR" || die + fi +@@ -890,7 +906,7 @@ + KOBJFILE_PATH="$VMLINUX" + SYMTAB="${TEMPDIR}/${KOBJFILE_NAME}.symtab" + if [[ "$DISTRO" = ubuntu ]]; then +- SYMVERS_FILE="$TEMPDIR/build-generic/Module.symvers" ++ SYMVERS_FILE="$TEMPDIR/build-$FLAVOR/Module.symvers" + else + SYMVERS_FILE="$SRCDIR/Module.symvers" + fi +@@ -899,7 +915,7 @@ + KOBJFILE_PATH="$OOT_MODULE" + SYMTAB="${TEMPDIR}/module/${KOBJFILE_NAME}.symtab" + if [[ "$DISTRO" = ubuntu ]]; then +- SYMVERS_FILE="$TEMPDIR/build-generic/Module.symvers" ++ SYMVERS_FILE="$TEMPDIR/build-$FLAVOR/Module.symvers" + else + SYMVERS_FILE="$SRCDIR/Module.symvers" + fi +@@ -912,7 +928,7 @@ + KOBJFILE_PATH="${TEMPDIR}/module/$KOBJFILE" + SYMTAB="${KOBJFILE_PATH}.symtab" + if [[ "$DISTRO" = ubuntu ]]; then +- SYMVERS_FILE="$TEMPDIR/build-generic/Module.symvers" ++ SYMVERS_FILE="$TEMPDIR/build-$FLAVOR/Module.symvers" + else + SYMVERS_FILE="$SRCDIR/Module.symvers" + fi +@@ -983,7 +999,7 @@ + cd "$TEMPDIR/patch" || die + if [[ -z "$OOT_MODULE" ]]; then + if [[ "$DISTRO" == ubuntu ]]; then +- KPATCH_BUILD="$TEMPDIR/build-generic" ++ KPATCH_BUILD="$TEMPDIR/build-$FLAVOR" + else + KPATCH_BUILD="$SRCDIR" + fi
  99. Download patch contrib/kpatch.service

    --- 0.6.0-0.2/contrib/kpatch.service 2018-04-22 20:04:27.000000000 +0000 +++ 0.8.0-0ubuntu2/contrib/kpatch.service 2019-08-28 17:34:00.000000000 +0000 @@ -6,7 +6,6 @@ ConditionKernelCommandLine=!kpatch.enabl Type=oneshot RemainAfterExit=yes ExecStart=PREFIX/sbin/kpatch load --all -ExecStop=PREFIX/sbin/kpatch unload --all [Install] WantedBy=multi-user.target
  100. Download patch debian/patches/kmod-fix-symbol-lookup-on-linux-4.19.patch

    --- 0.6.0-0.2/debian/patches/kmod-fix-symbol-lookup-on-linux-4.19.patch 2019-01-07 19:38:41.000000000 +0000 +++ 0.8.0-0ubuntu2/debian/patches/kmod-fix-symbol-lookup-on-linux-4.19.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ -From: Ben Hutchings <ben@decadent.org.uk> -Date: Mon, 07 Jan 2019 19:19:42 +0000 -Subject: kmod: Fix symbol lookup on Linux 4.19 - -Since Linux 4.19, symbols may contain either an absolute address or a -self-relative offset, depending on -CONFIG_HAVE_ARCH_PREL32_RELOCATIONS. The function to resolve the -address is unfortunately not inline or exported, so copy it here. - -Since the configuration symbol didn't exist before, we don't need to -add an explicit kernel version check. - ---- ---- a/kmod/core/core.c -+++ b/kmod/core/core.c -@@ -636,6 +636,16 @@ static int kpatch_find_object_symbol(con - return -EINVAL; - } - -+/* Copied from kernel/module.c */ -+static unsigned long kernel_symbol_value(const struct kernel_symbol *sym) -+{ -+#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS -+ return (unsigned long)offset_to_ptr(&sym->value_offset); -+#else -+ return sym->value; -+#endif -+} -+ - /* - * External symbols are located outside the parent object (where the parent - * object is either vmlinux or the kmod being patched). -@@ -651,7 +661,7 @@ static int kpatch_find_external_symbol(c - sym = find_symbol(name, NULL, NULL, true, true); - preempt_enable(); - if (sym) { -- *addr = sym->value; -+ *addr = kernel_symbol_value(sym); - return 0; - } -
  101. ...
  1. kpatch