Commit Graph

843 Commits

Author SHA1 Message Date
Josh Poimboeuf
5cce81f49b kpatch-gcc: properly quote arguments
Fixes an error when the following is an argument to gcc:

'-DIPATH_IDSTR="QLogic' kernel.org 'driver"'

gcc: error: kernel.org: No such file or directory
gcc: error: driver": No such file or directory
2014-09-15 11:17:37 -05:00
Seth Jennings
43ca05e5b1 Merge pull request #425 from jpoimboe/fedora-src-rpm-koji-2
kpatch-build: download fedora src rpms from koji
2014-09-15 11:15:46 -05:00
Josh Poimboeuf
d254d3d0f2 fix review comments
Use the wget -P option.
2014-09-15 11:12:11 -05:00
Josh Poimboeuf
74316588e8 kpatch-build: download fedora src rpms from koji
yumdownloader is problematic because it doesn't allow you to download
anything but the latest released kernel.  It can also be slow at times.
Instead, for Fedora, download the RPMs from koji.
2014-09-15 11:12:11 -05:00
Josh Poimboeuf
6176353f8d kpatch-build: add KVER and KREL variables
Add KVER and KREL variables, and use them where appropriate.  Also
remove the setting of ARCHVERSION in the '-s' case, since it's not
actually used anywhere in that case.
2014-09-15 11:11:25 -05:00
Seth Jennings
29551bd9b5 Merge pull request #424 from jpoimboe/readme-openssl
readme: add openssl to F20 dependencies
2014-09-15 10:56:23 -05:00
Josh Poimboeuf
3b8361333a readme: add openssl to F20 dependencies 2014-09-15 10:47:43 -05:00
Seth Jennings
89edbb2e41 Merge pull request #420 from jpoimboe/special-sections-later
process special sections after inclusion logic
2014-09-12 21:52:29 -05:00
Josh Poimboeuf
d41365fc0e process special sections after inclusion logic
The special sections should be processed after all the other inclusion
logic has run, so that should_keep_rela_group() can work properly.
Otherwise it might remove a needed rela group from a special section.
2014-09-12 14:03:10 -05:00
Josh Poimboeuf
fc3a63bb25 Merge pull request #419 from jpoimboe/fix-integration-tests
fix test conflict
2014-09-12 13:13:34 -05:00
Josh Poimboeuf
dacdfcfd22 fix test conflict
I accidentally added two tests which both create a non-static
kpatch_foo() function, which breaks the combined integration test kernel
build.
2014-09-12 13:12:36 -05:00
Josh Poimboeuf
114b21c7e5 Merge pull request #417 from spartacus06/fix-376
check ARCHVERSION for hyphen before creating localversion
2014-09-11 15:53:43 -05:00
Seth Jennings
fef7a6ede5 check ARCHVERSION for hyphen before creating localversion
If hyphen doesn't exist in uname -r (ARCHVERSION), then it is probably a
non-distro kernel and we don't need to create the localversion file.

Fixes #376

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-09-11 15:38:05 -05:00
Seth Jennings
93398c21ca Merge pull request #412 from jpoimboe/key-warned
support for__key and __warned special static local vars
2014-09-11 14:24:49 -05:00
Seth Jennings
a82b3d8fa0 Merge pull request #415 from jpoimboe/mangled-strcmp
fix the mangled function strcmp
2014-09-11 13:30:17 -05:00
Seth Jennings
671a30fb99 Merge pull request #413 from jpoimboe/static-fix
skip data sections when looking for users of static locals
2014-09-11 13:22:51 -05:00
Josh Poimboeuf
1553764be6 add other users of kpatch_mangled_strcmp 2014-09-11 08:27:09 -05:00
Josh Poimboeuf
0da57e8807 fix the mangled function strcmp
Fix the mangled function strcmp so that it compares all of the string
except for the numbered parts.  foo.isra.35 should match foo.isra.1, but
not foo.isra.35.part.36.

Fixes #352.
2014-09-10 21:25:30 -05:00
Seth Jennings
d60e88bb88 Merge pull request #416 from jpoimboe/patch-function-rename
patch module function/variable renaming
2014-09-10 21:21:25 -05:00
Josh Poimboeuf
a224d2470c patch module function/variable renaming
Make the kpatch-patch-hook.c function and variable names consistent by
prefixing them all with 'patch_'.  This makes it easier to distinguish
the patch hook sections from the patched sections when looking at the
ELF section data.
2014-09-10 21:14:23 -05:00
Seth Jennings
aac8b03f44 Merge pull request #414 from jpoimboe/ignore-rela-section
allow the user to ignore a rela section
2014-09-10 17:06:00 -05:00
Josh Poimboeuf
24ea032f9f allow the user to ignore a rela section
If the user specifies KPATCH_IGNORE_SECTION for a rela section, ignore
the corresponding text section instead of corrupting memory.

Fixes #381.
2014-09-10 17:05:17 -05:00
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
Josh Poimboeuf
db91697542 don't convert section references to syms for debug sections
This fixes a seg fault in the test suite caused by a debug section
referencing an un-included unbundled symbol (though its section was
included).  The symbol was a __warned symbol and the section was
.data.unlikely.

For debug sections, there is no need to replace section references with
symbols because we don't compare debug sections.
2014-09-09 13:36:23 -05:00
Josh Poimboeuf
2982962549 support for__key and __warned special static local vars
Add support for the __key and __warned "special" static local variables.
I'm calling them that for lack of a better term, analagous to the
kernel's special sections that we have to deal with.

__warned: Used by WARN_ONCE et al as an indicator as to whether a
message has already been printed.  I think it makes sense (and is much
easier) to reset this counter for a given function when replacing the
function, since the user may expect the new function to warn again.

__key: Used by lockdep as an identifier for a given lock initialization
code path (see http://lwn.net/Articles/185666/ for more info).  I think
it makes sense (and is much easier) to create a new key for a given
function when replacing the function, because the locking semantics may
have changed, so it makes sense for lockdep to use a new key to validate
the new locking behavior.

So for both __warned and __key static variables, the new version of the
variable should be used when referenced by an included function.

Made the following changes to support these special variables:

- Ignore their suffixes when comparing them in rela_equal, so that gcc
  renaming them will not result in a function being marked as changed
  just because it referenced a renamed static local

- Don't ever correlate them, so that their new versions will be included
  if a changed or new function uses their corresponding symbols

Fixes #402.
2014-09-09 13:36:20 -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