[PATCH 0/2] Fix ordering of ftrace + livepatch module notifier callbacks

From: Jessica Yu
Date: Fri Jan 29 2016 - 01:44:26 EST


As explained here [1], livepatch modules are failing to initialize properly
because the ftrace coming module notifier (which calls
ftrace_module_enable()) runs after the livepatch module notifier (which
enables the patch(es)). Thus livepatch attempts to apply patches to modules
before ftrace_module_enable() is even called for the corresponding
module(s). Separate klp_module_notify() into coming and going notifiers
and tweak the priorities to fix the order in which the ftrace and livepatch
notifiers are called.

Tested the changes with a test livepatch module that patches 9p and nilfs2,
and verified that the issue is fixed.

Patch 1/2 based on the 'for-next' branch in livepatching -
git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livepatching.git

Patch 2/2 based on the 'ftrace/core' branch in linux-trace -
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git

[1] http://lkml.kernel.org/g/20160128204033.GA32131@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Jessica Yu (2):
livepatch: Implement separate coming and going module notifiers
ftrace: Adjust priority of ftrace module notifier

kernel/livepatch/core.c | 128 +++++++++++++++++++++++++++---------------------
kernel/trace/ftrace.c | 7 ++-
2 files changed, 79 insertions(+), 56 deletions(-)

--
2.4.3