kmod/core: use pr_err instead of printk
Merge pull request #277 from jpoimboe/pr-err

kmod/core: use pr_err instead of printk
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.
kpatch-build: don't remove USERSRCDIR

Fixes #279.
Merge pull request #280 from jpoimboe/cache-rm-fix

kpatch-build: don't remove USERSRCDIR
core.c: add check to be sure that the kernel run with CONFIG_KALLSYMS_ALL option
Merge pull request #282 from goldyfruit/master

core.c: add check to be sure that the kernel run with CONFIG_KALLSYMS_AL...
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).
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.
Merge pull request #284 from jpoimboe/ftrace-unregister-order

kmod/core: fix ftrace unregister order
kpatch-build: add debian support
kpatch-build: fix SUBLEVEL in the Makefile
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.
Merge pull request #283 from jpoimboe/mcount

create-diff-object: create __mcount_loc section
fixup review comments

Signed-off-by: Seth Jennings <sjenning@redhat.com>
Merge pull request #278 from spartacus06/user-hook-support-v2

add user-defined load/unload hook support
kpatch-build: merge the ubuntu and debian section
Merge pull request #285 from goldyfruit/master

kpatch-build: add debian support
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.
Merge pull request #286 from jpoimboe/check-gcc-version

kpatch-build: gcc version checks