This fixes the following error with an older version of git
(1.8.3.1):
make -C test/unit
make[1]: Entering directory `/root/kpatch/test/unit'
git submodule update --init --rebase
You need to run this command from the toplevel of the working tree.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
plugin compilation fails on GCC 8:
In file included from gcc-plugins/gcc-common.h:100,
from gcc-plugins/ppc64le-plugin.c:1:
/usr/lib/gcc/powerpc64le-linux-gnu/8/plugin/include/attribs.h: In function ‘tree_node* canonicalize_attr_name(tree)’:
/usr/lib/gcc/powerpc64le-linux-gnu/8/plugin/include/attribs.h:118:11: error: ‘get_identifier_with_length’ was not declared in this scope
return get_identifier_with_length (s + 2, l - 4);
^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/powerpc64le-linux-gnu/8/plugin/include/attribs.h:118:11: note: suggested alternative: ‘get_attr_min_length’
return get_identifier_with_length (s + 2, l - 4);
^~~~~~~~~~~~~~~~~~~~~~~~~~
get_attr_min_length
Makefile:34: recipe for target 'gcc-plugins/ppc64le-plugin.so' failed
get_identifier_with_length() is defined under stringpool.h, include this
header file for GCC 8, before including attribs.h
Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
When I made a patch to the nfsd module on a ppc64le system with a RHEL 7
based kernel, livepatch prevented the target module from loading with:
livepatch: symbol '.TOC.' not found in symbol table
References to this symbol are treated specially by the kernel module
loader, so references to it should never be converted to dynrelas.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
From Oracle's Linker and Libraries Guide [1]:
"The symbols in a symbol table are written in the following order ...
The global symbols immediately follow the local symbols in the symbol
table. The first global symbol is identified by the symbol table sh_info
value. Local and global symbols are always kept separate in this manner,
and cannot be mixed together."
[1] https://docs.oracle.com/cd/E19120-01/open.solaris/819-0690/chapter6-79797/index.htmlFixes#854.
Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
load --all working just for .ko:
for i in "$INSTALLDIR/$(uname -r)"/*.ko; do
USUALLY, all modules have .ko extension
/var/lib/kpatch can have not only modules, in my case (Yes it just my case) I have list with patches included in module.
create-diff-object doesn't really need the full kernel object file as
input. All it requires is a symbol table. Switch to using "eu-readelf -s"'s
output instead of object files. This will enable us to cover more cases
in unit tests.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Artem Savkov <asavkov@redhat.com>
Use named variables instead of cmdline argument indexes so that it is
easier to read create-diff-object.c.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Artem Savkov <asavkov@redhat.com>
ppc64le lacked kpatch_line_macro_change_only() implementation. Add one
based on x86_64 version and available unit tests.
Fixes: #843
Signed-off-by: Artem Savkov <asavkov@redhat.com>
Update submodule to 6774fbc "ppc64le: initial object files"
Remove CDO_ENV since it is moved to per-arch makefiles.
Signed-off-by: Artem Savkov <asavkov@redhat.com>
While convenient git-lfs has too many restrictions for kpatch's needs.
Remove links to the objectfiles and related configs.
Signed-off-by: Artem Savkov <asavkov@redhat.com>
Increment version to 0.6.0 due to 926e4e0c7d ("kmod: add support for
in-kernel livepatch hooks"), which removed the kpatch (un)load hook API
support and converted to livepatch-style hooks.
Additional changes include:
* 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
Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
I loaded a livepatch on an idle 112 CPU system, and it took over three
seconds for the patch transition to complete:
[1561551.584871] livepatch: 'livepatch_foo': starting patching transition
[1561554.867486] livepatch: 'livepatch_foo: patching complete
Presumably this is because more CPUS == more kthreads and idle tasks,
which are more likely to be running at any given time.
Currently the kpatch script will start signaling tasks if the transition
takes more than five seconds. Increase that timeout a bit to 15
seconds, to give big/busy systems more time before we start signaling.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
I placed the library in the top-level test directory, as the same
assertions could also be used by the integration tests once we rework
them a bit.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
As an extra sanity check, ensure the number of patched functions never
changes.
Also added a test for convert-global-local to ensure the global symbol
is converted to a local.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cleaning house a bit. Now that we have unit tests, a lot of these tests
aren't very useful anymore.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Update the `__LINE__` macro detection heuristics based on recent kernel
changes:
- __warn_printk(), used in the WARN macros, which put the line number in
%edx
- __might_fault(), used in the usercopy macros
- lockdep_rcu_suspicious(), used in the RCU_LOCKDEP_WARN macro
- printk(), used in the ASSERT_RTNL macro
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Broaden the impact of the 'clean' target so that output objects will
still get cleaned when when old tests get removed or renamed.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
After doing some research, I've discovered that most of these tests no
longer test what they were originally intended to test.
An exception here is the 'macro-hooks' test, which is probably better
suited as an integration test, so I removed its unit test and kept its
integration test.
Really, most of these tests weren't all that useful to begin with, so
it's not a big loss. The one exception is 'gcc-static-local-var-2',
which was originally meant to test multiple static local variables with
the same name in the name function. That's a good thing, so I'll try to
come up with another test for that which works with Linux 4.16.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
With #755, we started using dynrelas for function pointers. However,
this behavior only makes sense for function pointers to existing
functions. For function pointers to *new* functions, just use a normal
rela.
The 'function-ptr-new' unit test is from the following patch:
https://github.com/dynup/kpatch/files/1927198/new-static-callback.patch.txtFixes#834.
Fixes: 495e619750 ("kpatch-build, x86: do not use the patched functions as callbacks directly")
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>