Commit Graph

647 Commits

Author SHA1 Message Date
Josh Poimboeuf
6f38498d95 Merge pull request #299 from useidel/master
Rebase of SPEC file to current version
2014-07-07 21:09:54 -05:00
Seth Jennings
44ad2ba733 Merge pull request #298 from jpoimboe/no-fentry-dynrela
create-diff-object: don't create __fentry__ dynrelas
2014-07-07 21:02:50 -05:00
Seth Jennings
322b9b99ba Merge pull request #300 from jpoimboe/gcc-version-readelf
kpatch-build: extract GCC version from .comment section
2014-07-07 21:01:18 -05:00
Josh Poimboeuf
ddf4836466 kpatch-build: extract GCC version from .comment section
Extract the GCC version from the .comment section of vmlinux.  This
hopefully makes the version check more robust across various distros.

Fixes #297.
2014-07-07 20:54:57 -05:00
Udo Seidel
5c7630ee76 Rebase of SPEC file to current version 2014-07-07 22:08:54 +02:00
Josh Poimboeuf
e847026824 create-diff-object: don't create __fentry__ dynrelas
This fixes the following issue for a patch which changes a module:

  kpatch_create_mcount_sections: 1968: bad first rela in .rela.text.e_show

The first rela is "bad" because the real first rela was converted to a
dynrela and then removed from the rela list.

This is a temporary fix.  The more permanent fix should be to allow
lookups in vmlinux for patched modules so we don't create any
unnecessary dynrelas.
2014-07-07 14:03:02 -05:00
Seth Jennings
690385a37d Merge pull request #294 from jpoimboe/custom-rpmbuild-dir
kpatch-build: support custom ~/.rpmmacros file
2014-07-03 09:22:52 -05:00
Josh Poimboeuf
817d3746b4 kpatch-build: support custom ~/.rpmmacros file
Be able to deal with a custom ~/.rpmmacros file, for which the SPECS and
BUILD directories are configurable.
2014-07-03 09:16:49 -05:00
Josh Poimboeuf
11cac52533 Merge pull request #293 from spartacus06/support-forced-patching
support forced patching
2014-07-02 14:13:25 -05:00
Seth Jennings
2e93c5e1e3 support forced patching
Some functions in the kernel are always on the stack of some thread
in the system.  Attempts to patch these function will currently always
fail the activeness safety check.

However, through human inspection, it can be determined that, for a
particular function, consistency is maintained even if the old and new
versions of the function run concurrently.

This commit introduces a KPATCH_FORCE_UNSAFE() macro to define patched
functions that such be exempted from the activeness safety check.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-07-02 14:06:33 -05:00
Seth Jennings
6b428eec2f Merge pull request #291 from jpoimboe/gcc-ubuntu
kpatch-build: fix gcc version check on ubuntu
2014-07-02 08:35:19 -05:00
Josh Poimboeuf
dda01a5a1d Merge pull request #290 from goldyfruit/master
kpatch-build: use getconf to get the processors number
2014-07-02 06:21:12 -05:00
Josh Poimboeuf
5893a28fdf kpatch-build: fix gcc version check on ubuntu 2014-07-02 06:17:59 -05:00
Gaetan Trellu
9d72c76b1a kpatch-build: use getconf to get the processors number 2014-07-01 22:18:16 -04:00
Josh Poimboeuf
aaf1bf3e8e Merge pull request #288 from spartacus06/section-create-refactor
consolidate new section pair creation
2014-07-01 16:27:06 -05:00
Seth Jennings
1f17adec07 consolidate new section pair creation
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-07-01 16:00:51 -05:00
Seth Jennings
94ec430201 Merge pull request #286 from jpoimboe/check-gcc-version
kpatch-build: gcc version checks
2014-07-01 15:07:55 -05:00
Josh Poimboeuf
73171714bc kpatch-build: gcc version checks
Ensure the version of the locally installed gcc matches the one used to
compile the kernel, and is >= 4.8.

Fixes #246.
2014-07-01 14:24:53 -05:00
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