Commit Graph

819 Commits

Author SHA1 Message Date
Josh Poimboeuf
b2f47f9ef3 add another user of is_text_section 2014-09-09 15:11:09 -05:00
Josh Poimboeuf
0537ff6a6f skip data sections when looking for users of static locals
It's possible for a static local variable's data section to have
a relocation which refers to the variable symbol itself.  Fix the logic
which searches for the user of a static local variable by only looking
in text sections (i.e. functions).

Fixes #411.
2014-09-09 14:43:42 -05:00
Seth Jennings
c21cc1292f Merge pull request #398 from flaming-toast/patch-reenable
re-enable forced patch modules
2014-09-09 12:05:30 -05:00
Josh Poimboeuf
57ee537053 Merge pull request #408 from cormander/show-all-errors
die on create-diff-object when all objects have processed
2014-09-09 10:51:36 -05:00
Seth Jennings
52bae5a4ab Merge pull request #409 from cormander/bad-insn
Be more specific about the bad first instruction
2014-09-09 10:06:12 -05:00
Jessica Yu
8f06a11962 testmod/doit.sh: add .kpatch.checksum to test module 2014-09-09 07:52:41 -04:00
Jessica Yu
0c9a54645c re-enable patch modules with checksum matching
In order to safely re-enable patch modules, add a special
.kpatch.checksum section containing an md5sum of a patch module's
contents. The contents of this section are exported to sysfs via
patch_init and double checked when kpatch load finds that a module of
the same name is already loaded.
2014-09-09 07:52:16 -04:00
Corey Henderson
3d9a140bfa oops, use sym->name, not sym->sec->rela->name 2014-09-08 22:44:55 -04:00
Corey Henderson
55c981d794 Give more generic failure message, and include ERROR in output 2014-09-08 22:28:00 -04:00
Corey Henderson
3e14e1859f change in wording per jpoimboe 2014-09-08 22:21:20 -04:00
Corey Henderson
96b4e099d8 Be more specific about the bad first instruction 2014-09-08 22:04:18 -04:00
Corey Henderson
c0113db4ad die on create-diff-object when all objects have processed
When working on large patches that are bound to have lots of
errors, it can be frustrating to have to re-run the build and wait
after every error you fix. With this patch, you get a chance to see
most (if not all) of the errors you'll be facing, at least across
the different object files.
2014-09-08 21:46:40 -04:00
Josh Poimboeuf
6c6299651b Merge pull request #407 from spartacus06/shadow-inplace
Store small shadow fields in-place
2014-09-08 16:10:11 -05:00
Seth Jennings
eb75f0aaae Store small shadow fields in-place
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-09-08 16:00:20 -05:00
Seth Jennings
3343eed007 Merge pull request #380 from jpoimboe/shadow-variables
add support for shadow variables
2014-09-08 14:17:37 -05:00
Josh Poimboeuf
4dee89269c add support for shadow variables
This adds support for shadow variables, which allow you to add new
"shadow" fields to existing data structures.

To allow patches to call the shadow functions in the core module, I had
to add a funky hack to use --warn-unresolved-symbols when linking, which
allows the patched vmlinux to link with the missing symbols.  I also
added greps to the log file to ensure that only unresolved symbols to
kpatch_shadow_* are allowed.  We can remove this hack once the core
module gets moved into the kernel tree.

Fixes #314.
2014-09-08 13:36:37 -05:00
Seth Jennings
aa1f9cb8d8 Merge pull request #404 from cormander/error-objname
Give objname on build error
2014-09-08 10:26:08 -05:00
Corey Henderson
1e878ed8fa just put objname inside of error for ERROR 2014-09-08 00:19:45 -04:00
Corey Henderson
af942023dc Send all error output to STDERR 2014-09-07 23:58:27 -04:00
Corey Henderson
5228e07c63 Give objname on build error 2014-09-07 23:38:04 -04:00
Seth Jennings
4a96e11768 Merge pull request #400 from cormander/die-changes
Always echo the $LOGFILE on kpatch-build failure
2014-09-05 09:31:12 -05:00
Seth Jennings
853732a230 Merge pull request #401 from cormander/rpm-spec
Some minor updates to rpm spec file
2014-09-05 09:15:50 -05:00
Corey Henderson
88f7d9e834 April 10th was a Thursday 2014-09-05 01:27:42 -04:00
Corey Henderson
b2ac34aa2e Use proper _usr macro on Makefile sed 2014-09-05 01:08:53 -04:00
Corey Henderson
69cc2f7a4e Call die() instead of exit on SIGSEGV 2014-09-05 00:48:11 -04:00
Corey Henderson
aa7f14be0d Always show the $LOGFILE on build failure 2014-09-05 00:44:02 -04:00
Seth Jennings
60d5170faf Merge pull request #399 from jpoimboe/print-new-functions
print new functions
2014-09-04 09:10:52 -05:00
Josh Poimboeuf
99308028d5 print new functions
Fixes #397.
2014-09-04 08:44:54 -05:00
Josh Poimboeuf
4cd66aa713 Merge pull request #396 from spartacus06/include-new-symbols
Include new symbols
2014-09-03 17:12:26 -05:00
Seth Jennings
4506a9575e add test case for new globals inclusion
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-09-03 17:06:50 -05:00
Seth Jennings
6023e9bbde always include new global symbols
In the case that a new global symbol is defined in a file but not used
by a changed function, the symbol will currently not be included.

However, since it is global, another file in the patch my reference it,
but it will not be there.

This commit includes new global symbols so that they may be referenced
by changes in other files within the same patch.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-09-03 14:32:58 -05:00
Seth Jennings
b790e4dc27 Merge pull request #395 from jpoimboe/static-local-fixes
static local variable fixes for WARN_ON_ONCE
2014-09-03 13:23:55 -05:00
Josh Poimboeuf
02fcfa506b code review fixes
Rename bundled1 to bundled and bundled2 to basebundled.
2014-09-03 13:11:04 -05:00
Josh Poimboeuf
aca9b52567 add test case for issue #394. 2014-09-03 10:10:07 -05:00
Josh Poimboeuf
8ac338aac4 support renaming of unbundled static locals
WARN_ON_ONCE places the __warned static local variable in the
.data.unlikely section, so it's not bundled (i.e. ignored by the
-fdata-sections gcc flag).  There's no reason why we can't rename
unbundled symbols, so add support for them.

Fixes #394.
2014-09-03 10:03:01 -05:00
Josh Poimboeuf
017c5e6395 allow multiple references to same static local var
This fixes a logic bug in the static local variable code where we don't
allow multiple relocation references to the same static local variable
symbol.
2014-09-03 09:55:40 -05:00
Josh Poimboeuf
0fd7f7f0be Merge pull request #393 from jpoimboe/0.2.1
0.2.1 release
2014-09-02 11:11:56 -05:00
Josh Poimboeuf
24d8e961ea 0.2.1 release 2014-09-02 11:11:14 -05:00
Seth Jennings
d0606ae91d Merge pull request #390 from jpoimboe/inter-object-call
support for calling a new function in another object
2014-09-02 11:08:55 -05:00
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
Josh Poimboeuf
f257de7c77 support for calling a new function in another object
If a patch adds a new function in foo.c, and calls that function from
bar.c, currently it fails with something like:

    kpatch_create_dynamic_rela_sections: 2115: lookup_global_symbol failed for tpe_allow_file, needed for .text.do_mmap_pgoff

This (crudely) fixes the issue by assuming that if we can't find the
global symbol in the original vmlinux, that it will be provided by
another object in the patch module.  If that assumption is incorrect,
the module will fail to load due to the missing symbol dependency.

A (perhaps) better way to fix this is to search for the symbol in the
patched version of the vmlinux.  But I think this approach is good
enough, for now at least.

Fixes #388.
2014-09-02 10:05:49 -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