Commit Graph

779 Commits

Author SHA1 Message Date
Seth Jennings
21c684a794 Merge pull request #378 from jpoimboe/rodata-isra
support renaming of mangled .rodata sections
2014-09-02 11:06:16 -05:00
Seth Jennings
b369d4852a Merge pull request #383 from jpoimboe/sec2-var-rename
rename variables for better readability
2014-08-29 16:15:03 -05:00
Josh Poimboeuf
091930fc80 rename variables for better readability
The naming of variables in this function is confusing, and really threw
me for a loop: sec is first used as an iterator, then sec is reused to
point to the dynrela section, then sec2 is used as another iterator.

Instead make sec the iterator for both loops and dynsec the dynrela
section pointer.
2014-08-29 16:05:52 -05:00
Seth Jennings
ffa6e8c871 Merge pull request #382 from jpoimboe/ignore-section-error-msg
improve KPATCH_IGNORE_SECTION error message
2014-08-29 15:18:25 -05:00
Josh Poimboeuf
ffe560f565 improve KPATCH_IGNORE_SECTION error message 2014-08-29 15:16:52 -05:00
Seth Jennings
00ab879473 Merge pull request #379 from jpoimboe/ignoring-msg-format
change format of "ignoring" messages
2014-08-28 15:43:58 -05:00
Josh Poimboeuf
ae4ad2b4f1 change format of "ignoring" messages
Change the "ignoring" message formatting to be consistent with the
"changed function:" message to make it a little easier to read.
2014-08-28 15:30:43 -05:00
Josh Poimboeuf
e7d00cb9df support renaming of mangled .rodata sections
When a function foo.isra.1 has a switch statement, it might have a
corresponding .rodata.foo.isra.1 section (in addition to its
.text.foo.isra.1 section).  If so, rename that section too.

Otherwise kpatch-build will get confused when comparing the function's
relas which reference the .rodata section, and will mark the function's
rela section as changed because the rela symbol names differ.

I found this bug when trying to build the patch from upstream Linux
commit a3c54931.  Unfortunately this issue is already fixed on F20 and I
wasn't able to come up with a similarly failing test case for the
integration test suite.
2014-08-28 14:34:19 -05:00
Josh Poimboeuf
2e46fef4b6 Merge pull request #375 from spartacus06/modprobe-names
Support modprobe style names in kpatch load
2014-08-28 10:02:00 -05:00
Seth Jennings
58134fd449 Support modprobe format names in uninstall
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-08-27 14:30:39 -05:00
Seth Jennings
1d63ce8493 Support modprobe style names in kpatch load
When the argument is a .ko file, it should be considered a path (i.e.
don't even look for it in the installed DB). When the argument is a
module name, it should be considered a loaded or installed module (and
then in the case of kpatch load we have to do a reverse translation of
all installed modules to see if any of them match).

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-08-26 15:47:07 -05:00
Josh Poimboeuf
688a03d8b6 Merge pull request #369 from jpoimboe/0.2.0
0.2.0 release
2014-08-20 11:09:38 -05:00
Josh Poimboeuf
9a7a1038ac 0.2.0 release
ABI breakage b/w core module <-> patch module:
6a69f5f91a
2014-08-20 11:09:05 -05:00
Josh Poimboeuf
aee8c445a1 Merge pull request #340 from goldyfruit/master
REAME.md: add g++ package to the Debian Wheezy procedure
2014-08-20 11:04:58 -05:00
Seth Jennings
e6e15340ef Merge pull request #368 from jpoimboe/readme-rhel7-typo
readme: fix RHEL 7 prereq typo
2014-08-19 09:31:17 -05:00
Seth Jennings
76b262055d Merge pull request #367 from terrywang/oraclelinux
Add support for Oracle Linux 7 and CentOS 7
2014-08-19 09:30:45 -05:00
Josh Poimboeuf
ffda1aaf59 readme: fix RHEL 7 prereq typo 2014-08-19 09:17:29 -05:00
Terry Wang
cd5e136169 readme: add support for Oracle Linux 7 and CentOS 7 2014-08-19 20:56:02 +10:00
Terry Wang
9fcd8ba732 kpatch-build: add Oracle Linux 7 and CentOS 7 support 2014-08-19 17:38:47 +10:00
Seth Jennings
7b82b59a68 Merge pull request #360 from flaming-toast/func-sysfs-fix
kpatch-patch-hook: fix incorrect old_offsets for loadable modules
2014-08-15 21:33:45 -05:00
Jessica Yu
6a69f5f91a consolidate variables func->old_offset and func->old_addr to just old_addr
To reduce redundancy, remove/change the old_offset fields in the
kpatch_func and kpatch_patch_func structs to just old_addr. Since
old_offset is being used as a placeholder for old_addr, might as well
consolidate it to just one variable.
2014-08-15 23:42:26 -07:00
Jessica Yu
8464c25d95 kpatch-patch-hook: fix incorrect old_offsets for loadable modules
Fix incorrect old_offsets for loadable modules during sysfs
initialization in patch_init.

sysfs will be initialized on patch module init regardless of whether
or not the module is loaded. func_old_addr_show() will read from func->old_addr,
which is initially set to 0; it'll be eventually filled in by the core module.
2014-08-15 23:42:22 -07:00
Seth Jennings
b16f85cad3 Merge pull request #366 from jpoimboe/allow-new-data
create-diff-object: allow new data to be included
2014-08-14 07:56:40 -05:00
Josh Poimboeuf
543ad11ccd create-diff-object: allow new data to be included
Allow the inclusion of new global variables.
2014-08-14 01:12:27 -05:00
Josh Poimboeuf
437245e374 Merge pull request #365 from spartacus06/issue-359-v2
always include .rodata.str1.* sections
2014-08-14 00:19:07 -05:00
Seth Jennings
26ef7bfcb1 always include .rodata.str1.* sections
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-08-13 21:26:34 -05:00
Seth Jennings
f466a60708 fix use-after-free error
Don't use rela after you just freed it!

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-08-13 17:08:42 -05:00
Josh Poimboeuf
a57342806c Merge pull request #363 from jpoimboe/add-hook-test
test: add hook macro test
2014-08-13 14:25:35 -05:00
Josh Poimboeuf
eb62038e92 test: add hook macro test
From issue #357.
2014-08-13 14:24:18 -05:00
Josh Poimboeuf
ae04b84f51 Merge pull request #362 from spartacus06/fix-dynrela-corruption-in-hooks
fix dynrela corruption in load/unload hooks
2014-08-13 14:19:07 -05:00
Seth Jennings
7dfad2fb76 fix dynrela corruption in load/unload hooks
In kpatch_create_dynamic_rela_sections() the dest field is filled in
with either the function symbol or the section symbol that contains the
function depending on whether or not the sym field of the base section
is NULL or not (around line 2153).

In the case of the hook functions, we strip the FUNC symbol to prevent
it from being added to the kpatch.funcs section as a patched function.
However we weren't unbundling the stripped symbol from the section.
This resulted in the sym field pointing to the null symbol (index 0),
corrupting the dynrelas rela section.

Before:

Relocation section [14] '.rela.kpatch.dynrelas' for section [13] '.kpatch.dynrelas' at offset 0x8b8 contains 6 entries:
  Offset              Type            Value               Addend Name
  000000000000000000  X86_64_64       000000000000000000      +9
  0x0000000000000018  X86_64_64       000000000000000000      +8 .kpatch.strings
  0x0000000000000020  X86_64_64       000000000000000000      +0 .kpatch.strings
  0x0000000000000030  X86_64_64       000000000000000000      +9
  0x0000000000000048  X86_64_64       000000000000000000      +8 .kpatch.strings
  0x0000000000000050  X86_64_64       000000000000000000      +0 .kpatch.strings

This commit unbundles the stripped symbol from the section so that the
section symbol is used in the dynrelas rela section.

After:

Relocation section [14] '.rela.kpatch.dynrelas' for section [13] '.kpatch.dynrelas' at offset 0x8b8 contains 6 entries:
  Offset              Type            Value               Addend Name
  000000000000000000  X86_64_64       000000000000000000      +9 .text.kpatch_load_aio_max_nr
  0x0000000000000018  X86_64_64       000000000000000000      +8 .kpatch.strings
  0x0000000000000020  X86_64_64       000000000000000000      +0 .kpatch.strings
  0x0000000000000030  X86_64_64       000000000000000000      +9 .text.kpatch_unload_aio_max_nr
  0x0000000000000048  X86_64_64       000000000000000000      +8 .kpatch.strings
  0x0000000000000050  X86_64_64       000000000000000000      +0 .kpatch.strings

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-08-13 13:40:29 -05:00
Josh Poimboeuf
5763fcdb27 Merge pull request #361 from spartacus06/issue-357
allow patches that only contains hook functions
2014-08-13 11:38:50 -05:00
Seth Jennings
e020127eea allow patches that only contains hook functions
Fixes #357

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-08-13 11:28:43 -05:00
Seth Jennings
c8c69a8eaa Merge pull request #355 from jpoimboe/rhel7-tmp-obj-fix
kpatch-gcc: fix for .tmp_* objects on RHEL 7
2014-08-12 23:08:14 -05:00
Josh Poimboeuf
7b4ee86197 kpatch-gcc: fix for .tmp_* objects on RHEL 7
On RHEL 7 I see the following error when trying to patch meminfo.o:

    cp: cannot stat ‘/home/user/.kpatch/obj/fs/proc/.tmp_meminfo.o’: No such file or directory

It turns out that on RHEL 7, a given object foo.o is compiled as
.tmp_foo.o before then being linked as foo.o.  I have no idea why.  The
fix is to record .tmp_foo.o as foo.o in the changed_objs file.
2014-08-12 21:21:53 -05:00
Josh Poimboeuf
0efd8b0f2b Merge pull request #354 from spartacus06/diff-tree-tests
add difftest.sh test
2014-08-12 11:05:00 -05:00
Seth Jennings
a59607742e add difftest.sh test
The purpose of this test script is to determine if create-diff-object
can properly recognize object file equivalence when passed the same file
for both the original and patched objects.  This verifies that
create-diff-object is correctly parsing, correlating, and comparing the
different elements of the object file.  In practice, a situation similar
to the test case occurs when a commonly included header file changes,
causing Make to rebuild many objects that have no functional change.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-08-12 10:50:46 -05:00
Josh Poimboeuf
78afb8f999 Merge pull request #353 from spartacus06/group-section-support
Group section support
2014-08-11 22:47:41 -05:00
Seth Jennings
e1e694db4b review fixups
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-08-11 22:41:09 -05:00
Seth Jennings
a0e6dce9af cleanup kpatch_correlate_symbols()
This commit inverts some logic to reduce the max indentation

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-08-11 17:24:05 -05:00
Seth Jennings
bf86555e06 add correlation and compare support for GROUP sections
GROUP section are rare and are a mechanism in the ELF to indicated that
certain groups of section must be included or excluded (stripped)
together.

It is valid to have more than one of these section with the same
".group" name.  This currently messes up the section correlation code
with correlates based solely on name.

This commit adds additional correlation criteria for GROUP sections;
namely, the section content must be the same.  Changing of groups
sections (i.e. reindexing of the section indexes the GROUP section
includes in their section data) is not supported and will result in a
"new/changed section not included" error.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-08-11 17:24:05 -05:00
Seth Jennings
2990bb790a Merge pull request #346 from flaming-toast/testmod
testmod/doit.sh: set KBUILD_EXTRA_SYMBOLS to include core module's symbols
2014-08-08 16:56:18 -05:00
Josh Poimboeuf
4a72525e0d Merge pull request #350 from spartacus06/support-unbundled-mangled-functions
support renaming of mangled functions in unbundled sections
2014-08-08 15:26:24 -05:00
Seth Jennings
e483cda793 support renaming of mangled functions in unbundled sections
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-08-08 15:20:31 -05:00
Seth Jennings
41615c9b9c Merge pull request #349 from jpoimboe/system_certificates
upstream kernel fixes
2014-08-08 14:49:54 -05:00
Josh Poimboeuf
a600f1d117 kpatch-build: don't link unchanged objects
The FILES variable can contain unchanged objects, so don't use it to
determine which objects to link.  Instead, just use all the objects that
were placed in the output directory by create-diff-object.
2014-08-08 14:22:17 -05:00
Josh Poimboeuf
1b9868ed33 kpatch-gcc: exclude system_certificates.o
Fixes the following issue when running kpatch-build against the latest
upstream kernel:

    system_certificates.o: no changed functions were found
2014-08-08 14:18:46 -05:00
Josh Poimboeuf
e7cf064c62 kpatch-gcc: split up object exclusion list 2014-08-08 14:18:27 -05:00
Josh Poimboeuf
c5f138f88d Merge pull request #348 from spartacus06/allow-unchanged-object
allow for unchanged objects
2014-08-08 11:15:09 -05:00
Seth Jennings
fb5dbc2fc5 allow for unchanged objects
There are situations in which an object may be rebuilt but have no
functional changes, such as a change to an included header file.

This commit changes kpatch-build to tolerate individual unchanged
objects so long as there is, in the end, at least one changed object.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-08-08 10:26:36 -05:00