Commit Graph

1790 Commits

Author SHA1 Message Date
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
Joe Lawrence
bc268c60e1 kpatch-build: update for RHEL / CentOS 8
- Future releases of RHEL / CentOS will provide the yumdownloader
  program with the 'dnf-utils' package (not 'yum-utils').  Instead of
  looking to see that the package is installed, just look for the
  program itself.

- RHEL / CentOS 8 kernel release names (as returned by 'uname -r') may
  not match the SRPM buildroot release subdirectory name.  Relax the
  wildcard when moving this directory to $SRCDIR.

Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
2018-07-31 16:26:59 -04:00
Joe Lawrence
8eb1d23713
Merge pull request #897 from sm00th/mrecord-mcount
create-diff-object: -mcount-record support
2018-07-27 09:14:53 -04:00
Artem Savkov
41f025d392 Include mrecord-mcount unit tests
Update objs-repo pointer to include new unit tests.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-07-26 16:51:28 +02:00
Artem Savkov
19c4b52105 create-diff-object: -mcount-record support
4.18 adds -mcount-record to KBUILD_FLAGS when supported by the compiler.
This results in most of kpatch_create_mcount_sections()'s work being
already done, so we can at least skip the last part of it that updates
the first instruction in patched functions.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-07-26 16:51:24 +02:00
Joe Lawrence
13d8267a0d
Merge pull request #896 from buytenh/ubuntu-fixes
ubuntu fixes
2018-07-25 13:13:59 -04:00
Lennert Buytenhek
9ce3e3c090 readme: explicitly include elfutils dependency for Ubuntu
Without this, kpatch-build bombs out because it cannot find eu-readelf.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
2018-07-25 14:59:56 +03:00
Lennert Buytenhek
932e0377bd kpatch-build: Ubuntu signed/unsigned kernel image package fix
In Ubuntu 18.04 LTS (but not in 16.04 LTS), the "linux" source package
no longer builds the "linux-image-*" binary kernel image packages
directly, but instead, it produces the "linux-image-unsigned-*" binary
packages, and the "linux-signed" source package then produces the
(signed) "linux-image-*" binary packages from the unsigned binaries.

This means that querying the target kernel's linux-image-* package for
its source package will yield a source package that is just a wrapper,
and does not actually contain the kernel source code.

Deal with this by removing the "-signed" substring from the kernel
source package name if it is present.  This makes kpatch-build work
on Ubuntu 18.04.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
2018-07-25 14:59:56 +03:00
Joe Lawrence
b974770197
Merge pull request #881 from sm00th/gcc8-opts
gcc8 fixes
2018-07-18 08:56:54 -04:00
Joe Lawrence
08cc21025a
Merge pull request #894 from jpoimboe/fix-clean-cache
kpatch-build: fix clean_cache
2018-07-18 08:54:35 -04:00
Josh Poimboeuf
0655ca50b8 kpatch-build: fix clean_cache
Commit d86c1113cc ("kpatch-build: less aggressive clean_cache()")
broke clean_cache().  Instead of expanding the wildcard, it tries to
delete a file named '*'.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
2018-07-17 15:43:43 -05:00
Artem Savkov
7cb5baccde Include gcc8 unit-tests
Update submodule pointer to include new gcc8 unit tests.

This update also includes unit-test for https://github.com/dynup/kpatch/pull/892

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-07-13 09:39:26 +02:00
Artem Savkov
61839832ed create-diff-object: propagate ignore.functions to children
Add child symbols to .kpatch.ignore.functions in case their parents are
added to the list.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-07-13 09:39:26 +02:00
Artem Savkov
2ac1387701 create-diff-object: add .text.hot to the list of bundleable functions
According to gcc8's man pages gcc can put functions into .text.unlikely
or .text.hot subfunctions during optimization. Add ".text.hot" to the
list of bundleable functions in is_bundleable().

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-07-13 09:39:26 +02:00
Artem Savkov
35cc6ff016 create-diff-object: allow changing subsections
gcc8 can place functions to .text.unlikely and .text.hot subsections
during optimizations. Allow symbols to change subsections instead of
failing.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-07-13 09:39:21 +02:00
Artem Savkov
246c6e2ae7 create-diff-object: propagate child symbol changes
Propagate child symbol changes to it's parent.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-07-13 09:38:15 +02:00
Joe Lawrence
cd352cf8a8
Merge pull request #892 from kamalesh-babulal/addr_align
create-diff-object: Relax sh_addralign check for .text sections
2018-07-11 14:31:47 -04:00
Artem Savkov
73a278c2b6 create-diff-object: child symbol skips
Skip profiling calls checks for child symbols and don't include them in
output or .kpatch.funcs.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-07-11 09:57:54 +02:00
Artem Savkov
bd2589530c create-diff-object: add symbol relations
Add a function that would detect parent/child symbol relations. So far
it only supports .cold.* symbols as children.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-07-11 09:57:31 +02:00
Kamalesh Babulal
09fdb0772d create-diff-object: Relax sh_addralign check for .text sections
.text section addralign value might change between original and
patched .o files, for a loop() such as:

for (i = 0; i < sections_per_block; i++) {
	remove_memory(nid, base, MIN_MEMORY_BLOCK_SIZE);
	base += MIN_MEMORY_BLOCK_SIZE;
}

On ppc64le, which translate to:

  f0:   78 1b 7b 7c     mr      r27,r3
  f4:   6c 00 9d 40     ble     cr7,160 <pseries_remove_memblock+0x158>
  f8:   ff ff 9c 3b     addi    r28,r28,-1
  fc:   38 00 a1 fb     std     r29,56(r1)
 100:   00 01 bf 3f     addis   r29,r31,256
 104:   08 c2 9c 7b     rldic   r28,r28,24,8
 108:   14 ea 9c 7f     add     r28,r28,r29
 10c:   14 00 00 48     b       120 <pseries_remove_memblock+0x118>
 110:   00 00 00 60     nop
 114:   00 00 00 60     nop
 118:   00 00 00 60     nop
 11c:   00 00 00 60     nop
 120:   78 fb e4 7f     mr      r4,r31

.LVL174:
        rldic 28,28,24,8         #, tmp198, tmp196,
        add 28,28,29     # _45, tmp198, base
        .p2align 5,,31

Patch removing such loop, changes the section alignment boundary. Given
that alignment changes to .text section are not fatal, relax the check
for text sections.

Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
2018-07-04 08:41:00 +05:30
Joe Lawrence
2f3db2abe9
Merge pull request #890 from kamalesh-babulal/readme
readme: Update gcc-plugin-devel dependency
2018-06-28 11:15:03 -04:00