Commit Graph

709 Commits

Author SHA1 Message Date
Seth Jennings
aa6f510bc0 Merge pull request #339 from jpoimboe/module-name-fixes
module name fixes
2014-07-29 20:59:39 -05:00
Seth Jennings
57a8fb352e Merge pull request #338 from jpoimboe/kpatch-build-usage
kpatch-build: don't show full kpatch-build path in usage message
2014-07-29 20:54:33 -05:00
Josh Poimboeuf
4f91924d7e kpatch-build: truncate long patch names
Otherwise the module name listed in /proc/modules is corrupted due to an
array buffer overrun.
2014-07-29 17:02:48 -05:00
Josh Poimboeuf
a0756a5f1d kpatch-build: convert spaces in patch name to '-' 2014-07-29 17:02:10 -05:00
Josh Poimboeuf
749da4f261 kpatch-build: don't show full kpatch-build path in usage message
For interface consistency with other unix utilities.
2014-07-29 16:46:12 -05:00
Seth Jennings
c884811bb9 Merge pull request #337 from jpoimboe/core-module-path
kpatch: change core module path again
2014-07-29 09:44:20 -05:00
Josh Poimboeuf
ec77b26c76 kpatch: change core module path again
On RHEL I'm seeing issues with putting the core module in the "extra"
path.  On the next depmod run, it gets added to modules.dep, and on a
subsequent kpatch install I see the following errors:

    /usr/lib/dracut/modules.d/50drm/module-setup.sh: line 26: /lib/modules/3.10.0-123.4.4.el7.x86_64//weak-updates/kpatch/kpatch.ko: No such file or directory
    /usr/lib/dracut/modules.d/90kernel-modules/module-setup.sh: line 14: /lib/modules/3.10.0-123.4.4.el7.x86_64//weak-updates/kpatch/kpatch.ko: No such file or directory
    modinfo: ERROR: Module /lib/modules/3.10.0-123.4.4.el7.x86_64/weak-updates/kpatch/kpatch.ko not found.

Until the core module gets merged into Linux, I think we can put it in
/usr/lib/kpatch, which is also where the patch modules are going to be
delivered in the RHEL RPM.

Making sure the other options still work with the kpatch utility for
now, so as to keep backwards compatibility between a newer kpatch
utility and older core modules.  We can break this compatibility for
kpatch 0.2.0.
2014-07-28 20:30:20 -05:00
Josh Poimboeuf
7db96adb9c Merge pull request #335 from spartacus06/user-libdir
allow user-defined LIBDIR in install paths
2014-07-28 15:55:43 -05:00
Seth Jennings
fe9dd75f56 Merge pull request #334 from jpoimboe/revert-warn-macros
Revert "add KPATCH_WARN_*_LINE macros"
2014-07-28 15:14:35 -05:00
Josh Poimboeuf
c260364882 Revert "add KPATCH_WARN_*_LINE macros"
This reverts commit 57b51d0bdc.

Probably no longer needed now that we have KPATCH_IGNORE_FUNCTION and
KPATCH_IGNORE_SECTION.
2014-07-28 15:04:25 -05:00
Josh Poimboeuf
b68dec7d22 Merge pull request #332 from spartacus06/ignore-sections
add KPATCH_IGNORE_SECTION support (plus fixups)
2014-07-28 15:03:40 -05:00
Seth Jennings
392049a283 make symbol section change an error
make symbol section change an error, except when moving out of an
ignored section

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-07-28 14:09:33 -05:00
Seth Jennings
ebf55f8614 add support for replacing section syms for unbundled sections
Right now, the test patch unnecessarily includes hrtimer_nanosleep()
because the call to do_nanosleep() generates a rela the references the
unbundled .sched.text section.  This section symbol is not currently
replaced by kpatch_replace_sections_syms() as it only replaces bundled
sections symbols.

This commit adds logic to kpatch_replace_sections_syms() to replace
unbundled section symbols as well by scanning the symbol table for
symbols that start at the rela entry's offset within the matching
section.

This allows for properly rela section correlation when the functions
have moved from an unbundled section to a bundled section.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-07-28 11:10:32 -05:00
Seth Jennings
8ac20f5475 add KPATCH_IGNORE_SECTION support
This macro is for ignoring sections that may change as a side effect of
another change or might be a non-bundlable section; that is one that
does not honor -ffunction-section and create a one-to-one relation from
function symbol to section.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-07-28 11:10:32 -05:00
Seth Jennings
da45b84bbc Merge pull request #333 from goldyfruit/master
kmod/core/Makefile: update the Makefile for Debian Like
2014-07-28 09:58:22 -05:00
Gaetan Trellu
52ad9452ba kmod/core/Makefile: update the Makefile for Debian Like 2014-07-28 10:50:03 -04:00
Josh Poimboeuf
02f97cda44 Merge pull request #330 from goldyfruit/master
kpatch: update the kpatch version and the man and the kmod/core/Makefile
2014-07-28 09:31:33 -05:00
Seth Jennings
11f8f8da76 mark mcount sections as SAME
Right now, in the case that the mcount sections have changed, we get a
"changed section not included" error on them.  Since we rebuild them
from scratch, just mark them as SAME even if they are different so that
we don't cause an error.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-07-28 09:29:46 -05:00
Seth Jennings
85da92132f s/funcs/functions/g
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-07-28 09:29:46 -05:00
Josh Poimboeuf
02e1a824d9 Merge pull request #331 from spartacus06/dont-check-shlink
remove sh_link from section comparison
2014-07-28 09:00:32 -05:00
Seth Jennings
5a4756bbb8 remove sh_link from section comparison
This sh_link line currently has a bug with both operands being sec1; the
second should be sec2.  However the bug is masking a logical flaw; that
is that the sh_link is the index of either the symtab or the strtab and
that can change if sections have been added or removed by the patch.

This commit removes the comparison.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-07-25 09:35:34 -05:00
Gaetan Trellu
a44fbf3f8b kpatch: update the kpatch version and the man 2014-07-25 09:33:41 -04:00
Seth Jennings
4e41f39853 Merge pull request #328 from jpoimboe/static-local-vars
support for gcc static local variable naming
2014-07-24 17:23:30 -05:00
Josh Poimboeuf
9c3c9b0c0a support for gcc static local variable renaming
gcc renames static local variables by appending a period and a number.
For example, __key could be renamed to __key.31452.  Unfortunately this
number can arbitrarily change.  Try to rename the patched version of the
symbol to match the base version and then correlate them.

Fixes #313.
2014-07-24 15:08:15 -05:00
Josh Poimboeuf
402911b949 replace section symbols before correlating
The correlation logic could get confused if it compares two relas whose
symbols haven't been converted from section symbols to object or
function symbols.  So we should replace section symbols for both the
base and the patched object before correlating, so that it can compare
the function and object symbols rather than the section symbols.

This is also a prerequisite for dealing properly with gcc's renaming of
static local variables, because relas which reference static locals
usually use section symbols.
2014-07-24 14:51:57 -05:00
Josh Poimboeuf
ce8bb40fc0 Merge pull request #327 from spartacus06/make-all
remove build pass from kpatch-build
2014-07-23 11:30:53 -05:00
Seth Jennings
5321b21aa0 fixup review comments
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-07-23 11:24:02 -05:00
Seth Jennings
9a2f8c5c44 remove build pass from kpatch-build
Now that we use the vmlinux from the distro debug package we don't need
to do any build runs without -ffunction-sections -fdata-sections.

Old:
Build orig in objdir
Build patched in objdir
Build orig w/ flags in objdir2
Copy orig .o's into orig
Build patched w/ flags in objdir2
Copy patched .o's into patched

New:
Build orig w/ flags in objdir
Build patched w/ flags in objdir
Copy patched .o's into patched
Build orig w/ flags in objdir
Copy orig .o's into orig

This commit also does try to build each change object singularly since
there are cases in the kernel tree where the Makefile does not reside in
the same directory as the changed object.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-07-23 10:03:00 -05:00
Seth Jennings
c40d164931 Merge pull request #326 from jpoimboe/unload-all
kpatch: add unload --all command
2014-07-23 09:50:12 -05:00
Josh Poimboeuf
d707c4062d kpatch: add unload --all command
This may end up being useful in the distro patch module upgrade path.
If the core module also needs updating, we can first do "kpatch unload
--all" and "rmmod kpatch" before doing "kpatch load" of the new patch
module.
2014-07-23 09:16:11 -05:00
Josh Poimboeuf
77c8700888 Merge pull request #323 from spartacus06/ignore-funcs-v2
add support for manually ignore functions
2014-07-23 09:01:55 -05:00
Seth Jennings
84618404e0 add support for manually ignore functions
This commit adds the KPATCH_IGNORE_FUNC() macro for ignoring functions
that may change as a side effect of a change in another function.  The
WARN class of macros, for example, embed the line number in an
instruction, which will cause the function to be detected as changed
when, in fact, there has been no functional change.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-07-23 09:00:16 -05:00
Seth Jennings
063668477c Merge pull request #320 from goldyfruit/master
readme.md: add support for Debian GNU/Linux Wheezy (7.x)
2014-07-21 09:25:32 -05:00
Gaetan Trellu
f69a9400eb readme.md: add support for Debian GNU/Linux Wheezy (7.x) 2014-07-20 22:53:50 -04:00
Josh Poimboeuf
434ed7a10e Merge pull request #319 from spartacus06/fix-msgs
fix logging in kpatch_verify_patchability()
2014-07-18 16:02:36 -05:00
Seth Jennings
bdb44e7594 fix logging in kpatch_verify_patchability()
log_normal() already prints the objname; no need to do it again

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-07-18 15:29:46 -05:00
Seth Jennings
1c8e8a7d57 Merge pull request #317 from jpoimboe/module-old-addr-fix
kmod/core: module old_addr fix
2014-07-18 10:44:25 -05:00
Josh Poimboeuf
8a008e8645 kmod/core: module old_addr fix
When patching a module, I ran into a "can't set ftrace filter at
address" error.  The root cause was due to the fact that
mod->module_core + old_offset is apparently not a reliable way to
determine the function's address.

Instead, just get the address from kallsyms like we do for module
dynrelas.
2014-07-18 10:09:52 -05:00
Seth Jennings
735dfcb005 allow user-defined LIBDIR in install paths
User reported cases where libraries are in lib32/64 directories, not
lib.

Allow the user to override by setting LIBDIR.

Fixes #167

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-07-15 12:47:39 -05:00
Josh Poimboeuf
576ee09442 Merge pull request #312 from spartacus06/add-rhel-install-doc
add install documentation for RHEL
2014-07-15 12:19:49 -05:00
Seth Jennings
00ebeb0b0d add install documentation for RHEL
Fixes #253

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-07-15 12:09:04 -05:00
Josh Poimboeuf
00a19e6508 Merge pull request #311 from spartacus06/version-compat-update
update supported kernel version
2014-07-15 11:51:10 -05:00
Seth Jennings
3025ce1dae remove mentry mention in kernel version requirement
There are more reasons besides mentry support for 3.9 being the
minimum supported kernel version.  There are also API changes that
happened in 3.9 that make the core module incompatible with previous
versions.

Rather than spelling all that out, just simply state the minimum
version.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-07-15 11:38:20 -05:00
Seth Jennings
d325e69c3c update supported kernel version
Some of the kernel APIs that are used by the core kernel module where
updated in 3.9 and are incompatible with previous kernel versions.

Update the README to reflect this.

Fixes #257

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-07-15 11:26:03 -05:00
Seth Jennings
f8813be8ef Merge pull request #310 from jpoimboe/checkpatch-fixes
kmod/core: checkpatch style fixes
2014-07-14 15:55:07 -05:00
Josh Poimboeuf
96d3d241f5 kmod/core: checkpatch style fixes 2014-07-14 15:53:41 -05:00
Seth Jennings
a12715c2e2 Merge pull request #303 from jpoimboe/warn-macros
add KPATCH_WARN_*_LINE macros
2014-07-14 09:51:30 -05:00
Seth Jennings
daa8762346 Merge pull request #307 from flaming-toast/kpatch-unload
kpatch: pass basename of argument to unload_module
2014-07-14 09:00:28 -05:00
Seth Jennings
60efcbd63e Merge pull request #301 from jpoimboe/debug-seg-fault
create-diff-object: fix for unincluded sec->secsym
2014-07-14 08:51:05 -05:00
Seth Jennings
ad82576f4c Merge pull request #308 from jpoimboe/readme-videos
readme: add links to more videos
2014-07-14 08:50:19 -05:00