Commit Graph

779 Commits

Author SHA1 Message Date
Seth Jennings
fd637ce542 Merge pull request #285 from goldyfruit/master
kpatch-build: add debian support
2014-07-01 14:02:57 -05:00
Gaetan Trellu
4e3b4825ad kpatch-build: merge the ubuntu and debian section 2014-07-01 14:41:57 -04:00
Josh Poimboeuf
df679e3192 Merge pull request #278 from spartacus06/user-hook-support-v2
add user-defined load/unload hook support
2014-07-01 13:09:33 -05:00
Seth Jennings
d4e4d14dbe fixup review comments
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-07-01 12:22:16 -05:00
Seth Jennings
1ebae501ba Merge pull request #283 from jpoimboe/mcount
create-diff-object: create __mcount_loc section
2014-07-01 11:10:59 -05:00
Josh Poimboeuf
d2201980e6 kmod/core: ftrace function_graph tracer compatibility
Steven Rostedt recommended to return "regs->ip + MCOUNT_INSN_SIZE",
which is what the function_graph tracer expects.  This fixes
function_graph tracing for a patched function.

This change also means that the function tracer will only show the
patched function once (corresponding to a trace of the original
function) rather than twice.  This is probably more in line with what a
user would expect.
2014-07-01 10:16:38 -05:00
Gaetan Trellu
d341e3237e kpatch-build: fix SUBLEVEL in the Makefile 2014-07-01 11:16:23 -04:00
Gaetan Trellu
0459810dd3 kpatch-build: add debian support 2014-07-01 10:55:43 -04:00
Seth Jennings
cae31c410b Merge pull request #284 from jpoimboe/ftrace-unregister-order
kmod/core: fix ftrace unregister order
2014-07-01 09:33:26 -05:00
Josh Poimboeuf
2dbae9ae42 kmod/core: fix ftrace unregister order
Currently, when removing a patch module, the ftrace buffer gets flooded
with traces.  This happens because we're clearing the ftrace ops filter
before unregistering the ops, which creates a small window where all
functions are being traced.

We should be doing the unregistering in the reverse order in which we
registered, meaning ops should be unregistered and _then_ the filter
should be cleared.
2014-07-01 08:52:59 -05:00
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