Commit Graph

1755 Commits

Author SHA1 Message Date
Joe Lawrence
05b18e6d0a
Merge pull request #942 from joe-lawrence/oot-fixes
Out of tree module fixes
2019-03-25 15:57:13 -04:00
Joe Lawrence
fff628ca07
Merge pull request #943 from joe-lawrence/unit-test-non-stripped
test/unit: relax stripped object requirement
2019-02-22 10:58:27 -05:00
Joe Lawrence
7dff9b5f6a unit-tests: include oot-issue-928 objects
Add object files that verify kpatch issue #928.

Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
2019-02-22 10:50:55 -05:00
Joe Lawrence
ccd0615407 test/unit: relax stripped object requirement
Some unit tests may need debug symbols to reproduce problems (see
issue #928 for example), so skip the unit-test Makefile.include
check_stripped call for objects that include "NOSTRIP" in their
filename.

Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
2019-02-22 10:49:54 -05:00
Joe Lawrence
37672ef681 manpages: update kpatch-build with --oot-module option
Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
2019-02-21 09:47:47 -05:00
Josh Poimboeuf
2763560367
Merge pull request #944 from jpoimboe/revert-jump-label
Revert "create-diff-object: add jump label support"
2019-02-20 08:05:59 -06:00
Josh Poimboeuf
09ee03f3df Revert "create-diff-object: add jump label support"
This reverts commit 87c64519fc.

The jump label support doesn't work with upstream livepatch.  Joe
Lawrence found the following ordering issue:

load_module

  apply_relocations

    /* Livepatch relocation sections are applied by livepatch */
    if (info->sechdrs[i].sh_flags & SHF_RELA_LIVEPATCH)
            continue;

  post_relocation
    module_finalize
      jump_label_apply_nops        << crash

  ...

  do_init_module
    do_one_initcall(mod->init)
      __init patch_init [kpatch-patch]
        klp_register_patch
          klp_init_patch
            klp_init_object
              klp_init_object_loaded
                klp_write_object_relocations

So jump_label_apply_nops() is called *before*
klp_write_object_relocations() has had a chance to write the klp
relocations (.klp.rela.kvm_intel.__jump_table, for example).

We need to resolve this upstream first.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
2019-02-19 16:10:54 -06:00
Joe Lawrence
b4e6085b6d
Merge pull request #928 from haoren3696/master
kpatch-build: include secsym in kpatch_mark_ignored_sections
2019-02-19 13:24:42 -05:00
Joe Lawrence
fd9806b152 kpatch-gcc: use relative path when filtering objects to ignore
When building out-of-tree modules, gcc may be passed full source
pathnames (like /home/user/testmod/testmod.c).  Adjust the filepath
filtering in kpatch-gcc to match against files relative to the
KPATCH_GCC_SRCDIR / kpatch-build SRCDIR prefix.

Fixes: #941
Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
2019-02-15 10:10:24 -05:00
Joe Lawrence
9863f5fa9b README.md: fix up out-of-tree module command line switches
For consistency, use the long format command line options in the
description and sample invocation.  Also, use "--oot-module" and not
"--out-of-tree" as per kpatch-build sources.

Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
2019-02-15 10:09:46 -05:00
Joe Lawrence
a16c003d88
Merge pull request #937 from jpoimboe/jump-tables
Add jump label support
2019-02-11 13:47:36 -05:00
Josh Poimboeuf
87c64519fc create-diff-object: add jump label support
Add support for jump labels, also known as static jumps, static keys,
static branches, and jump tables.  Luckily,
kpatch_process_special_sections() is already generic enough to make this
an easy fix.

Fixes: #931

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
2019-02-08 13:45:38 -06:00
Joe Lawrence
5a0c0ad944
Merge pull request #938 from sm00th/unitenv
test/unit: add support for .env files
2019-02-08 10:45:21 -05:00
Artem Savkov
e94bba2b94 test/unit: add support for .env files
Add support for optional <test-name>.env files that contain additional
environment variables. This can also be used to override per-arch env
vars we have because last value assigned will be used.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-02-08 15:16:17 +01:00
Josh Poimboeuf
d8a44076f8 create-diff-object: cleanup special section array
Clean up the special section array a bit, to make it a little more
readable.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
2019-01-29 13:04:09 -06:00
Josh Poimboeuf
64fd6a0491
Merge pull request #934 from sm00th/shadow-newpid
integration/centos-7: fix shadow-newpid.patch warnings
2019-01-29 12:41:40 -06:00
Artem Savkov
56be80720a integration/centos-7: fix shadow-newpid.patch warnings
When quickly loading/unloading this patch multiple times it is possible
to hit "Duplicate shadow variable" warnings since the patch doesn't have
any cleanup hooks on unload.
Switch to klp_shadow_get_or_alloc to ignore these.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-01-28 17:19:45 +01:00
Joe Lawrence
9999608062
Merge pull request #932 from sm00th/integration-cleanup
integration tests cleanup
2019-01-22 14:41:54 -05:00
Joe Lawrence
f960b4e6e6
Merge pull request #933 from bsingharora/master
Fix NULL pointer deref in main due to base_locals
2019-01-22 13:51:26 -05:00
Balbir singh
3998784d71 Fix NULL pointer deref in main due to base_locals
For fun I tried to create a livepatch of upstream patch
ad211f3e94b314a910d4af03178a0b52a7d1ee0a for my kernel. This
caused kpatch-build to fail with a NULL pointer derefence because
base_locals was NULL (returned via kpatch_elf_locals(), which
can return a NULL pointer). This patch fixes the SIGSEGV
via a NULL check. The end result is a live patch is created
and loaded.

Signed-off-by: Balbir singh <bsingharora@gmail.com>
2019-01-17 19:53:46 +11:00
Artem Savkov
fb11c794f2 integration: blacklists in multiple.test
Hardcode a blacklist of modules in multiple.test so we can deal
with conflicts while only updating the test when those arise.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-01-17 09:26:35 +01:00
Artem Savkov
70f9221c01 integration: dynamic module list in multiple.test
Dynamically compile module list based on -LOADED.test files in all
multiple.test scripts.
The scripts is now the same across all three directories so it might be
good to deduplicate it somehow along with other common tests.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-01-14 21:29:32 +01:00
Artem Savkov
7c774350fc integration: save dmesg on detected errors
Dump dmesg to dmesg.log when detecting a call trace.
Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-01-14 12:20:43 +01:00
Artem Savkov
a3afc831e2 integration/vm-integration-run: explain src manipulations
Add a comment to explain predownloaded kernel sources manipulations in
vm-integration-run.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-01-14 12:08:45 +01:00
Artem Savkov
992ea01625 integration/centos-7: reverse unload in multiple.test
Livepatch requires modules to be unloaded in reverse order.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-01-11 11:46:08 +01:00
Artem Savkov
c39a48a606 integration: temporary disable ubuntu1604
ubuntu1604's kernel is a 4.4 with backported livepatch witch confuses
kpatch-build and livepatch-patch-hook.c. Integration tests currently
fail on load/unload stage. Disabling all ubuntu integration tests until
this is resolved.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-01-11 10:34:13 +01:00
Artem Savkov
28a18efa21 integration/centos7: update shadow-newpid.patch
Switch to klp shadow-variable API.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-01-11 10:34:13 +01:00
Artem Savkov
31f6b02279 integration/centos7: update module-shadow.patch
Switch to klp shadow-variable API.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-01-11 10:34:13 +01:00
Artem Savkov
abe04af23a integration/centos7: disable rebuild-SLOW patch
It currently hits CSWTITCH issue from https://github.com/dynup/kpatch/issues/876

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-01-11 10:34:06 +01:00
Artem Savkov
f2b226ad37 integration/centos7: update macro-printk.patch
Rebase macro-printk.patch on top of 3.10.0-957.1.3.el7.x86_64 used in
centos7 vagrant image.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-01-11 10:32:49 +01:00
Artem Savkov
3478a85459 integration/centos7: fix module prefixes
Modules were previously prefixed with either 'kpatch-' or 'livepatch-'
depending on which was used. This is no longer true and all modules are
now prefixed with "test-". Update test scripts accordingly.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-01-11 10:32:49 +01:00
Artem Savkov
baa1355447 integration/ubuntu1604: fix module prefixes
Modules were previously prefixed with either 'kpatch-' or 'livepatch-'
depending on which was used. This is no longer true and all modules are
now prefixed with "test-". Update test scripts accordingly.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-01-11 10:32:49 +01:00
Artem Savkov
77304f60ce integration/ubuntu1604: remove shadow-variable patches
The kernel used in ubuntu1604 vagrant image does not have shadow
variable API.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-01-11 10:32:20 +01:00
Artem Savkov
14f7367e45 integration/ubuntu1604: disable module-call-external.patch
Original build includes "kzalloc" in af_netlink.c's symbol list, this
does not happen during kpatch build so create-diff-object fails with
find_local_syms.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-01-11 10:32:04 +01:00
Artem Savkov
9cd7eb224a integration/ubuntu1604: temporary disable -SLOW patch
kpatch-build currently fails with "invalid ancestor" error. This happens
with at least drivers/gpu/drm/i2c/adv7511.o and drivers/hwmon/htu21.o
files. The problem is their .ko counterparts are never built for some
reason, This looks like a kernel bug since in both cases there are files
with same name but in different paths that have .ko module built.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-01-11 10:30:43 +01:00
Artem Savkov
212a3a5a4b integration/ubuntu1604: macro-printk.patch rebase
Rebase macro-printk.patch on top of 4.4.0-133-generic kernel used in
kpatch/ubuntu1604 vagrant image.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-01-11 10:28:10 +01:00
Artem Savkov
36ba4343bb integration/ubuntu1604: replace macro-hooks.patch with macro-callbacks.patch
Macroses used in macro-hoos.patch are deprecated, use updated
macro-callbacs.patch instead.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-01-11 10:28:10 +01:00
Artem Savkov
086f7f6319 integration/ubuntu1604: disable gcc-mangled-3.patch
__flush_cpu_slab() is present in vmlinux.symtab but is optimized out
during kpatch builds.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-01-11 10:27:26 +01:00
Artem Savkov
cef728043e test/integration: don't use generic centos7 image
Use a kpatch-specific snapshot of centos7 image since we are still
running into problems we saw on fedora/ubuntu.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-01-11 10:25:21 +01:00
Artem Savkov
5371253094 test/integration: support in-image kernel sources
Unlike fedora, ubuntu doesn't keep older versions of kernel sources in
their archive so we need to have them predownloaded.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-01-11 10:25:21 +01:00
Artem Savkov
3c2ee0f61f integration: fix prefix in run_custom_test
run_custom_test used global "file" variable instead of local "testprog"
to deduce "prefix", so it would sometimes report wrong name for running
test.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-01-11 10:25:21 +01:00
Artem Savkov
0f54262f7d integration/fedora-27: adjust -LOADED tests module list
multiple.test contains outdated list of modules that have "-LOADED"
tests. Update the list.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-01-11 10:25:21 +01:00
Artem Savkov
519c7b9166 integration/fedora-27: disable meminfo-cmdline-rebuild-SLOW.patch
Temporary disable meminfo-cmdline-rebuild-SLOW.patch, right now it is
hitting https://github.com/dynup/kpatch/issues/767

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-01-11 10:24:55 +01:00
Artem Savkov
8e53b1dc8b integration/fedora-27/meminfo-cmdline-rebuild-SLOW.patch: rebase
Rebase to kernel-4.17.12-100.fc27 used in kpatch's fedora27 vagrant
image.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-01-08 12:10:53 +01:00
Artem Savkov
68db050ec5 integration/fedora-27/shadow-newpid.patch: rebase
Rebase to kernel-4.17.12-100.fc27 used in kpatch's fedora27 vagrant
image.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-01-08 12:10:49 +01:00
Josh Poimboeuf
b29227547d
Merge pull request #930 from sm00th/lds
kmod/patch: more linking fixes
2018-12-14 08:11:48 -06:00
Artem Savkov
b2f40b03ce kmod/patch: more linking fixes
While adding proper linker script option my previous patch left the
linker script in the list of source files (on pre-4.20 kernels) for
ld somehow breaking kpatch callback sections. For this to work
properly kpatch.lds needs to be added to 'extra-y' instead of objs. And
for kbuild to process this option properly we need to call make without
the .ko target, i.e. let kbuild decide what to build.

Fixes: 17a97b4 ("kmod/patch: fix patch linking with 4.20")
Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-12-07 16:57:39 +01:00
Joe Lawrence
1696f5db7b
Merge pull request #927 from sm00th/420upd
4.20 updates
2018-11-26 13:59:33 -05:00
Zhipeng Xie
517e26a6cb kpatch-build: include secsym in kpatch_mark_ignored_sections
kpatch_mark_ignored_sections include .rodata.str1.1 section but does
not include its section symbol, causing its section symbol can not be
included any more in kpatch_include_standard_elements. After the
section symbol is freed in kpatch_elf_teardown, we got a segmentation
fault in kpatch_create_intermediate_sections.

Signed-off-by: Zhipeng Xie <xiezhipeng1@huawei.com>
2018-11-23 10:50:21 +08:00
Joe Lawrence
f06f65666a
Merge pull request #925 from rudis/master
kpatch-build: abort on unsupported options GCC_PLUGIN_LATENT_ENTROPY,…
2018-11-14 11:15:16 -05:00