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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
This commit adds scripts/make targets to run integration tests on
fedora/ubuntu/centos through vagrant.
Signed-off-by: Artem Savkov <asavkov@redhat.com>
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>
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>
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>
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>