Commit Graph

1790 Commits

Author SHA1 Message Date
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
Joe Lawrence
f3b3e79f03
Merge pull request #923 from pcd1193182/master
Add support for building out-of-tree modules
2018-11-14 11:14:53 -05:00
Joe Lawrence
be6d20aba5
Merge pull request #922 from sm00th/intupd
Scripts for running integration tests within vagrant vms
2018-11-14 11:14:17 -05:00
Artem Savkov
17a97b48bc kmod/patch: fix patch linking with 4.20
4.20 includes commit 69ea912fda74 "kbuild: remove unneeded link_multi_deps"
which changes kbuild so that only '.o' files are given to ld as targets
for linking, leaving out our linker script. Even before this commit we
were still doing this wrong and were succeeding just because ld is smart
enough to detect the script, it even throws a warning:

ld: warning: kpatch.lds contains output sections; did you forget -T?

The right thing to do is to add the script to ldflags either through
kbuilds 'ldflags-y' or by adding it to LDFLAGS/KPATCH_LDFLAGS directly.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-11-14 15:09:34 +01:00
Artem Savkov
da3eed612d kmod/core: fix compilation with CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
Kernel commit 7290d5809571 "module: use relative references for
__ksymtab entries" changed kernel_symbol structure on some
architectures. Adjust kmod/core/core.c accordingly.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-11-14 12:33:23 +01:00
Paul Dagnelie
51a8fad34f Add support for building out-of-tree modules 2018-11-09 08:22:39 -08:00
Artem Savkov
c08351ec24 Add vagrant-install target
Add a target to install vagrant, make sure the user is given a warning
and a chance to cancel this operation.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-11-08 09:04:38 +01:00
Artem Savkov
f43b061bb4 Integration tests with vagrant
This commit adds scripts/make targets to run integration tests on
fedora/ubuntu/centos through vagrant.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-10-30 10:56:19 +01:00
Artem Savkov
30e943defd integration/lib.sh: add write_vagrantfile* functions
Add vagrantfile generating functions to lib.sh.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-10-30 10:56:19 +01:00
Artem Savkov
e84fe6b14f integration/lib.sh: vagrant installation
Vagrant installation functions for fedora/centos with libvirt plugin.
This is intended to be used in scripts to provision a new test-machine,
human users of vagrant integration test targets are expected to have
working vagrant installation.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-10-30 10:56:19 +01:00
Artem Savkov
3bc5234ef0 integration/lib.sh: add separate_partition/disk_cache functions
Add functions to prepare a separate partition/disk for cache use
(.ccache and .kpatch dirs). This is useful for vagrant images that are
generally not big enough for kpatch build.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-10-30 10:56:19 +01:00
Artem Savkov
b003955257 Add integration/lib.sh with distro dependency functions
Add test/integration/lib.sh for use in other kpatch related scripts
and or directly by end-users. Initial version contains per-distro
dependency functions, so it can be quickly installed as follows:

$ . test/integration/lib.sh
$ kpatch_dependencies

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-10-30 10:56:00 +01:00
Artem Savkov
f34bb2cfd7 Top-level integration test make targets
Add integration_slow and integration_quick make targets to top-level
makefile.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-10-30 09:48:19 +01:00
Simon Ruderich
2441cdd7ba kpatch-build: abort on unsupported options GCC_PLUGIN_LATENT_ENTROPY, GCC_PLUGIN_RANDSTRUCT
Both generate randomly modified object files on each build. This breaks
comparing original and patched object file. See also #924.

Signed-off-by: Simon Ruderich <simon@ruderich.org>
2018-10-27 08:23:24 +02:00
Joe Lawrence
6e5cb0011e
Merge pull request #921 from rudis/readme
README.md: mention callbacks/shadow variables in limitations
2018-10-25 16:40:59 -04:00
Simon Ruderich
ae820f5d19 README.md: mention callbacks/shadow variables in limitations
Signed-off-by: Simon Ruderich <simon@ruderich.org>
2018-10-23 08:37:06 +02:00