Disabled patches won't trigger a build, but the combined load test
will still attempt to run their associated LOADED.test script. The
combined test will fail due to voluntarily disabled tests.
Do not run tests scripts associated with disabled tests.
Signed-off-by: Julien Thierry <jthierry@redhat.com>
The unload_all() function in kpatch-test script is out dated and
does not unload patches loaded through livepatching.
Luckily, "kpatch unload --all" should support both kpatch unloading
kpatch patches and livepatch patches.
Signed-off-by: Julien Thierry <jthierry@redhat.com>
If an error occurs while loading a module or one of the tests,
multiple.test will exit leaving the working modules loaded. This leaves
the system in an unwanted state and causes the test that previously pass
to fail (succeeding before being loaded for multiple.test's point of
view).
Cleanup the loaded modules before exiting due to errors.
Also take this opportunity to factorize the test for the different
distros.
Signed-off-by: Julien Thierry <jthierry@redhat.com>
The RHEL powerpc kernel is compiled with -O3, which triggers some
"interesting" new optimizations. One of them, which seems to be
relatively common, is the replacing of a function with two separate
"constprop" functions.
Previously we only ever saw a single constprop clone, so we just renamed
the patched version of the function to match the original version. Now
that we can have two such clones, that no longer makes sense.
Instead of renaming functions, just improve the correlation logic such
that they can be correlated despite having slightly different symbol
names. The first clone in the original object is correlated with the
first clone in the patched object; the second clone is correlated with
the second clone; and so on.
This assumes that the order of the symbols and sections doesn't change,
which seems to be a reasonable assumption based on past experience with
the compiler. Otherwise it will just unnecessarily mark the cloned
constprop functions as changed, which is annoying but harmless, and
noticeable by a human anyway.
Fixes#935.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
When these from internal depths of Red Hat upstream paths changed and
now we are one level deeper in directory tree.
The issue probably also exist in rhel8.0 rebase pr #993.
Signed-off-by: Artem Savkov <asavkov@redhat.com>
While static keys (jump labels) are currently broken in livepatch, a
broken dynamic debug static key is harmless since it just disables
dynamically enabled debug printks in the patched code.
Fixes: #1021
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Standard centos7 repos don't contain ccache so we have to install it
from epel just like we do on rhel7.
Signed-off-by: Artem Savkov <asavkov@redhat.com>
Now that sibling calls aren't supported in ppc64le, change the RHEL 7.5
and 7.6 versions of the new-function tests to disable the sibling call
optimization.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Use make's .DELETE_ON_ERROR special target to make sure we don't have
any .OUTPUT.o leftovers for failed tests.
Fixes: #999
Signed-off-by: Artem Savkov <asavkov@redhat.com>
The ppc64le unit tests are failing because the lookup code is getting
confused by the "[<localentry>: 8]" string in the readelf symbol table
output.
Remove the string so the lookup code can parse it correctly.
kpatch-build already uses the same sed, so they should match.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Make 3.8 doesn't support the "file" function, which is used by the unit
test Makefile to output the contents of a custom env file, if one
exists. Use shell instead.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
"make unit" automatically rebases the submodule, which causes a lot of
surprises. Instead, just print a warning if it's out of date.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
This test is no longer needed. I had previously converted it to a unit
test and forgot to remove its integration test counterpart.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
This commit contains centos-7 patches rebased and adjusted to work with
recent rhel minors so that integration tests actually pass on those.
Signed-off-by: Artem Savkov <asavkov@redhat.com>
readelf is more standard, using readelf insteaded
test/difftree.sh: the symbol name may be with "FILE", which may be
get a incorrect count, here add "awk".
test/unit/Makefile.include: use "readelf -s --wide" instead of
"eu-readelf -s".
Signed-off-by: chenzefeng <chenzefeng2@huawei.com>
These patches previously would try to dereference a userspace pointer
directly which can cause issue on some systems. Since the aim of these
patches is to check fixup section changes we can don't need to do any
meaningful changes to the function, so change the patches to just add
asm("nop") instead.
Signed-off-by: Artem Savkov <asavkov@redhat.com>
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>
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>
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>
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>
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>
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>