Commit Graph

1610 Commits

Author SHA1 Message Date
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
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
Josh Poimboeuf
fb2801e4a5
Merge pull request #920 from rudis/master
kpatch-build/kpatch-build: use `command -v` instead of `which`
2018-10-22 15:37:31 -05:00
Simon Ruderich
3cd2e1efd0 kpatch-build/kpatch-build: use command -v instead of which
Prevents the following shellcheck warning:

    In kpatch-build/kpatch-build line 583:
    which yumdownloader &>/dev/null || die "yumdownloader (yum-utils or dnf-utils) not installed"
    ^-- SC2230: which is non-standard. Use builtin 'command -v' instead.

Signed-off-by: Simon Ruderich <simon@ruderich.org>
2018-10-21 08:45:57 +02:00
Joe Lawrence
019c1fb3eb
Merge pull request #919 from jpoimboe/__FUNCTION__-special-static
create-diff-object: add __FUNCTION__ variables to the special static …
2018-10-18 09:46:03 -04:00
Joe Lawrence
3ac8b2e038
Merge pull request #917 from sm00th/addressable
Add "__addressable_" to maybe_discarded_sym().
2018-10-18 09:43:39 -04:00
Joe Lawrence
4e05697e41
Merge pull request #916 from sm00th/issue910
Move lookup_open() call to a later stage.
2018-10-18 09:42:42 -04:00
Joe Lawrence
622e4330d9
Merge pull request #915 from sanskriti-s/kpatch-man-page-correction2
Added option to kpatch man page
2018-10-18 09:34:19 -04:00
Joe Lawrence
3c8e55b013
Merge pull request #914 from sanskriti-s/man-page-correction
Added distros to man page
2018-10-18 09:34:00 -04:00
Josh Poimboeuf
72103a178c create-diff-object: add __FUNCTION__ variables to the special static list
As discovered in #918, the `__FUNCTION__` static local variable is
similar to the `__func__` variable, in that it refers to the current
function name.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
2018-10-17 21:08:30 -05:00
Sanskriti Sharma
138ef899e8 Added option to kpatch man page
Added option signal to man page, under commands, based on usage function in
kpatch/kpatch usage()

Signed-off-by: Sanskriti sharma <sansharm@redhat.com>
2018-10-17 13:43:11 -04:00
Sanskriti Sharma
9e03722bcb Removed distros from kpatch-build man page
The man page earlier said that kpatch-build only works for Fedora, but now it
works for most distros to I deleted that line.

Signed-off-by: Sanskriti Sharma <sansharm@redhat.com>
2018-10-17 11:12:14 -04:00
Artem Savkov
f959edecdb Move lookup_open() call to a later stage
Sometimes due to config-dependency issues or other reasons whole
object-files would get optimized out from final vmlinux/module, in cases
like this create-diff-object would fail during symbol lookup table
creation in lookup_open(). Because lookup_open() call is situated before
we established that objectfile has changed this triggers not only on
real problems, but also during mass-rebulds caused by changes to
header-files. While it usually indicates a real issue with config this
should not prevent kpatch from building.

Move lookup_open() call so that it is called only for changed
object-files.

Fixes #910

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-10-17 10:23:40 +02:00
Artem Savkov
c46191028e strdup symbol names from kelf_base
strdup symbol names in kpatch_elf_locals and when noting down hint
instead of just copying pointers so that they are still usable after
we teardown/free kelf_base.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-10-17 10:21:44 +02:00
Artem Savkov
722d27f6bd Add "__addressable_" to maybe_discarded_sym().
Starting with 1b1eeca7e4c1 "init: allow initcall tables to be emitted using
relative references" [1] __init functions are generating an "__addressable_"
symbol in a ".discarded.addressable" section so it does not show up in final
vmlinux triggering find_local_syms failures. Add "_addressable_" to the list
in maybe_discarded_sym().

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1b1eeca7e4c19fa76d409d4c7b338dba21f2df45

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-10-16 17:26:38 +02:00
Joe Lawrence
7305d6c29a
Merge pull request #913 from joe-lawrence/v0.6.2
Patch release v0.6.2
2018-10-02 10:35:15 -04:00
Joe Lawrence
4208171719 Patch release v0.6.2
Create a minor release that includes fixes for:

- ppc64le: relax .text section addralign value check
- gcc8: unit-tests
- gcc8: support parent/child symbol relations
- gcc8: handle functions changing subsection
- gcc8: consider ".text.hot" sections bundleable
- kpatch-build: bugfix for less aggressive clean build-cache
- ubuntu: remove "-signed" substring from the kernel source package name
- ubuntu: explicitly note elfutils dependency
- upstream 4.18: unit-tests
- upstream 4.18: KCFLAGS -mcount-record support support
- RHEL-8: don't care who provides yumdownloader
- RHEL-8: account for quirky SRPM / release name conventions

Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
2018-10-02 09:51:13 -04:00
Joe Lawrence
b2f5bc577c
Merge pull request #909 from sm00th/symtab_read-fixes
Symtab read fixes
2018-09-21 10:09:25 -04:00
Joe Lawrence
ded02df5a1
Merge pull request #901 from sm00th/tint
Integration test improvements
2018-09-21 10:08:24 -04:00
Artem Savkov
f5679c9780 symtab_read: support entries with blank names
symtab_read() would previously skip entries with blank names resulting
in some of important entries being skipped. For instance vmlinux file
has an STT_FILE entry at the end with a blank name that contains global
offset table. Because it was skipped all of the global entries from this
table were considered a part of previous processed file resulting in
create-diff-object failing in find_local_syms().

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-09-20 16:06:29 +02:00
Joe Lawrence
d95be2f168
Merge pull request #905 from sm00th/unitupd
Unit test submodule update
2018-09-13 17:17:29 -04:00
Artem Savkov
f7cfe25e8a symtab_read(): fix SECTION detection in symtab_read
symtab_read has been checking a wrong field for "SECTION". Switch the
field from "bind" to "type".

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-09-12 16:31:58 +02:00
Artem Savkov
b746182847 Unit test submodule update
Bump unit-test-objs submodule head pointer to include latest test:

f82c458 x86_64: added a test for a function that uses _THIS_IP_
4a097d9 ppc64le: Test const var requiring .data.rel relocation

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-09-12 09:50:29 +02:00
Joe Lawrence
f3ff4043fc
Merge pull request #904 from euspectre/special-vars-ppc-typo
kpatch-build: ppc64le - fix a typo in find_special_section_data_ppc64le
2018-09-11 11:21:13 -04:00
Evgenii Shatokhin
0215587ad1 kpatch-build: ppc64le - fix a typo in find_special_section_data_ppc64le
Nothing critical, but find_special_section_data_ppc64le() could run
longer than needed: the exit condition was not met after all the values
had been found.

Fixes: 77f8fd09 "kpatch-build: ppc64le - Add special section support"
Signed-off-by: Evgenii Shatokhin <eshatokhin@virtuozzo.com>
2018-09-11 13:21:14 +03:00
Artem Savkov
5371d9f972 kpatch-test: remove -SLOW special cases
Treat -SLOW patches the same way as normal ones, i.e. include them
during "quick" testing. Keeping "-SLOW" suffix in patch names to as a
way to distinguish them manually.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-09-10 10:01:16 +02:00
Artem Savkov
80f78c78bb test/integration: skip -SLOW load tests in combined run
We are not including -SLOW patches into combined module, so there is no
reason to expect their -LOADED tests to succeed with combined module.
Skip them in run_combined_test().

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-08-23 09:23:50 +02:00
Artem Savkov
1a91e256ff test/integration: run -FAIL tests when invoked with --quick
Include -FAIL tests as well as combined in 'quick' target.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-08-23 09:23:30 +02:00
Artem Savkov
6cbf55d77b test/integration: include build log on failures
If a patch build fails copy the build log to <prefix>.log file.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-08-23 09:23:03 +02:00
Joe Lawrence
3a45a6ebb3
Merge pull request #900 from kamalesh-babulal/data_rel
create-diff-object.c: Extend is_bundleable()
2018-08-07 09:28:48 -04:00
Joe Lawrence
542ae14676
Merge pull request #898 from joe-lawrence/kpatch-build-rhel8
kpatch-build: update for RHEL / CentOS 8
2018-08-07 09:24:51 -04:00
Kamalesh Babulal
5b690b28bf create-diff-object.c: Extend is_bundleable()
GCC puts the constant variable requiring relocation into .data.rel. or
.data.rel.ro depending upon the bind type of the symbol. Extend
is_bundledable() to check these .data sections too.

Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
2018-08-06 14:09:43 +05:30