Commit Graph

819 Commits

Author SHA1 Message Date
Josh Poimboeuf
79bd9f03ee create-diff-object: create __mcount_loc section
For ftrace to be able to trace a patched function, it requires that the
__mcount_loc section contains a pointer to the function, and that the
first instruction of the function is "callq __fentry__".

Normally that work is done by the recordmcount script, but it ignores
functions that aren't in a few standard sections (.text and a few
others).
2014-07-01 08:29:37 -05:00
Josh Poimboeuf
d3550bfc3a Merge pull request #282 from goldyfruit/master
core.c: add check to be sure that the kernel run with CONFIG_KALLSYMS_AL...
2014-06-30 21:28:19 -05:00
Gaetan Trellu
4a00442e1d core.c: add check to be sure that the kernel run with CONFIG_KALLSYMS_ALL option 2014-06-30 18:13:44 -04:00
Seth Jennings
26815a1ad9 Merge pull request #280 from jpoimboe/cache-rm-fix
kpatch-build: don't remove USERSRCDIR
2014-06-30 14:35:49 -05:00
Josh Poimboeuf
403cf65b89 kpatch-build: don't remove USERSRCDIR
Fixes #279.
2014-06-30 14:20:13 -05:00
Seth Jennings
4835e3edc3 add user-defined load/unload hook support
This commit enables the ability to create user-defined hooks as part of
the normal code patch that can do preparatory work for the application
of the patch.  This work could include, but is not limited to, changing
data structure semantics.

The user may define a new function as part of the patch and mark it as a
load-time or unload-time hook with the kpatch_load_hook() and
kpatch_unload_hook() macros.  These macros are in an include file that
gets copied into the source tree at include/linux/kpatch-hooks.h at
patch build time. The signature for both hooks is "int kpatch_unload_hook(void)".

For now, the return code is ignored.  The hooks may not fail.  They also
run in stop_machine() context and may not sleep.  These hooks, more or
less, must follow all the rules of interrupt context code.
2014-06-30 13:37:26 -05:00
Seth Jennings
e154296e0d Merge pull request #277 from jpoimboe/pr-err
kmod/core: use pr_err instead of printk
2014-06-29 23:23:33 -05:00
Josh Poimboeuf
b6541ab85b kmod/core: use pr_err instead of printk 2014-06-29 21:59:38 -05:00
Seth Jennings
faa37ffa2a Merge pull request #275 from jpoimboe/detect-printk-error
test: detect kernel oopses and warnings
2014-06-27 15:16:48 -05:00
Seth Jennings
37e0a1a705 Merge pull request #274 from jpoimboe/remove-test-printks
test: remove annoying printks
2014-06-27 15:16:20 -05:00
Josh Poimboeuf
f85c1c6f43 test: detect kernel oopses and warnings 2014-06-27 13:24:14 -05:00
Josh Poimboeuf
e8f396229d test: remove annoying printks
The printks in the integration tests aren't very useful and annoyingly
fill up the dmesg buffer.  Remove them by making them contingent on
unlikely conditions.
2014-06-27 13:15:02 -05:00
Seth Jennings
152bfee051 Merge pull request #273 from jpoimboe/detect-core-dump
kpatch-build: detect core dump
2014-06-27 12:16:51 -05:00
Josh Poimboeuf
895672953e kpatch-build: detect core dump 2014-06-27 12:08:04 -05:00
Josh Poimboeuf
0c2c498a8e Merge pull request #272 from spartacus06/fix-new-func-handling
create-diff-object: fixup new function handling
2014-06-27 09:31:46 -05:00
Seth Jennings
537f68b4fd create-diff-object: fixup new function handling
The original logic in the inclusion tree code worked under the
assumption that it was the only code path marking symbols for inclusion.
Therefore, if the symbol had been marked as included, it could be safely
assumed that we also already called kpatch_include_symbol() on it.  With
the special section handling marking symbols as included, however, this
assumption is not valid.

We should call kpatch_include_symbol() regardless of whether or not the
symbol has already been marked as included or not in order to possible
include the symbol's entire bundle.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-06-27 09:12:44 -05:00
Seth Jennings
b3665a03d3 Merge pull request #266 from jstancek/safety_check_stacktrace
kmod/core: be more verbose when activness safety check fails
2014-06-27 09:01:31 -05:00
Jan Stancek
0617ae1b2c kmod/core: be more verbose when activness safety check fails
Print some basic info and stack trace for task when activness
safety check fails.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
2014-06-27 09:32:34 +02:00
Seth Jennings
41c6b48920 Merge pull request #271 from jpoimboe/relocation-page-boundary
kmod/core: fix relocation writes across page boundaries
2014-06-26 16:51:20 -05:00
Josh Poimboeuf
c36e90e188 kmod/core: fix relocation writes across page boundaries
The integration test suite was intermittently giving the following
error:

  [192685.907072] kpatch: write to 0xffffffffa082bffe failed for symbol call_netdevice_notifiers_info

The error was caused by a write across a page boundary without first
making the second page read/write.
2014-06-26 16:37:05 -05:00
Josh Poimboeuf
132aa1bbc6 Merge pull request #269 from spartacus06/reduce-debug-logging
create-diff-object: reduce verbosity in debug mode
2014-06-26 12:21:39 -05:00
Seth Jennings
d9472012a2 create-diff-object: reduce verbosity in debug mode
With the inclusion of the debug sections, the debug output is so verbose
that it becomes less useful.

This commit reduces the verbosity by skipping rela listings of debug
sections.

It includes a new helper function, is_debug_section(), to consolidate
the logic for detecting debug sections.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-06-26 10:46:57 -05:00
Josh Poimboeuf
6dd2932fba Merge pull request #268 from goldyfruit/master
readme: update the mandatory gcc version
2014-06-26 09:32:27 -05:00
Gaetan Trellu
d70ee821ef readme: update the mandatory gcc version 2014-06-26 10:22:52 -04:00
Seth Jennings
d13e98f7e5 Merge pull request #267 from jpoimboe/kpatch-symlink
kpatch-build: allow ~/.kpatch to already exist
2014-06-26 09:17:54 -05:00
Josh Poimboeuf
06a2075ab5 kpatch-build: allow ~/.kpatch to already exist
This is useful if ~/.kpatch is a symlink or a tmpfs mount.

- move SRCDIR/OBJDIR/OBJDIR2 initialization to the top
- create new VERSIONFILE variable
- create new clean_cache function which doesn't remove ~/.kpatch

Fixes #261.
2014-06-26 09:05:36 -05:00
Seth Jennings
2df462dda6 Merge pull request #264 from jpoimboe/include-new-functions
create-diff-object: include new functions
2014-06-26 08:57:38 -05:00
Josh Poimboeuf
2362d44783 create-diff-object: include new functions 2014-06-25 16:46:08 -05:00
Josh Poimboeuf
a72f2c4c4c Merge pull request #262 from spartacus06/fixup-error-paths
kmod: patch: cleanup error paths
2014-06-24 14:37:27 -05:00
Seth Jennings
e8d2ab565b kmod: patch: cleanup error paths
Right now, if there is a failure in patch_make_dynrelas_list(),
patch_free_objects() is called twice; once in the error section of
patch_make_dynrelas_list() and again in the err_objects section of
patch_init().

This fixes this and cleans up the error handling a bit.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-06-24 12:50:26 -05:00
Seth Jennings
023842c148 Merge pull request #258 from jpoimboe/sourcedir-2.0
kpatch-build: --sourcedir 2.0
2014-06-20 14:36:30 -05:00
Josh Poimboeuf
36c98e39d6 fix review comment 2014-06-20 14:34:54 -05:00
Josh Poimboeuf
4316632e1f Merge pull request #260 from goldyfruit/master
kpatch: remove the path to modinfo to fix the info function
2014-06-20 11:54:25 -05:00
Gaetan Trellu
c5f5a57fef kpatch: remove the path to modinfo to fix the info function 2014-06-20 12:35:06 -04:00
Seth Jennings
1dd843b7d0 Merge pull request #259 from jpoimboe/fix-uninstall
kmod: fix uninstall path
2014-06-20 09:13:05 -05:00
Josh Poimboeuf
731e39aea9 kmod: fix uninstall path 2014-06-20 09:07:23 -05:00
Josh Poimboeuf
89ce1c5d79 kpatch-build: --sourcedir 2.0
In my experience this is a much more useful implementation of the
"--sourcedir" option:

- use the source tree in-place rather than first copying it to
  ~/.kpatch/src.  In my case this avoids a 5GB copy, including the
  entire .git subdirectory, and allows ccache to be reused.

- find the vmlinux and .config files in the sourcedir

- autodetect the ARCHVERSION
2014-06-20 08:05:16 -05:00
Seth Jennings
92fb49e6f2 Merge pull request #256 from jpoimboe/no-print-vmlinux-module
kmod/core: don't print "patching module 'vmlinux'"
2014-06-19 22:33:25 -05:00
Josh Poimboeuf
27c80f5439 kmod/core: don't print "patching module 'vmlinux'" 2014-06-19 22:19:06 -05:00
Seth Jennings
ebaa5d32b7 Merge pull request #255 from jpoimboe/kpatch-build-debug
kpatch-build: DEBUG for create-diff-object
2014-06-19 13:05:25 -05:00
Josh Poimboeuf
3e4aa955d9 fix review comment 2014-06-19 13:01:54 -05:00
Josh Poimboeuf
eccc3eb63b kpatch-build: DEBUG for create-diff-object
Add -d option to create-diff-object when DEBUG is set.  That way for
weird kpatch-build issues we can just tell people to use the -d flag and
then provide the build log.
2014-06-19 12:30:22 -05:00
Seth Jennings
ebdd5d9e5b Merge pull request #254 from jpoimboe/vmlinux-unloaded-err
kmod/core: fix unloaded module 'vmlinux' error
2014-06-19 10:41:58 -05:00
Josh Poimboeuf
625b98488d kmod/core: fix unloaded module 'vmlinux' error
Fix the following error:

  [  344.564905] kpatch: delaying patch of unloaded module 'vmlinux'
2014-06-19 10:39:14 -05:00
Seth Jennings
35f34238b4 Merge pull request #252 from jpoimboe/dash-t-typo
kpatch-build: fix getopt typo for --target
2014-06-18 16:05:23 -05:00
Josh Poimboeuf
2e14094844 kpatch-build: fix getopt typo for --target 2014-06-18 16:03:42 -05:00
Seth Jennings
bff0608cb0 Merge pull request #251 from jpoimboe/readme-modules
readme: several updates
2014-06-18 14:57:59 -05:00
Josh Poimboeuf
53c3bbe278 readme: several updates
- replace the old low-level video with the new high-level one, and place
  it with screenshot prominently at the top

- increase default ccache size

- remove obsolete NOTEs

- add blurb about patching modules and -t

- "trampoline" -> "handler"

- more details about ftrace, perf, tracepoints compatibility

- add recommended practice re: single cumulative module vs multiple
  independent modules
2014-06-18 14:42:03 -05:00
Seth Jennings
50cb818196 Merge pull request #249 from jpoimboe/undefined-module-symbols
fix undefined symbols for future loaded modules
2014-06-18 13:28:39 -05:00
Josh Poimboeuf
9d016add40 fix review comments 2014-06-18 12:23:38 -05:00