From 3c7300c341ef2867df520142b99a517a5afc6532 Mon Sep 17 00:00:00 2001 From: Josh Poimboeuf Date: Fri, 19 Aug 2016 12:09:30 -0500 Subject: [PATCH] kmod/core: use FTRACE_OPS_FL_IPMODIFY flag ftrace only allows a single user of this flag to register for a given function. This prevents kpatch conflicts with kprobes handlers which also might want to change regs->ip for a function. We should have done this a few years ago. Better late than never... --- kmod/core/core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kmod/core/core.c b/kmod/core/core.c index 77c7290..2b76c89 100644 --- a/kmod/core/core.c +++ b/kmod/core/core.c @@ -515,9 +515,13 @@ done: preempt_enable_notrace(); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) +#define FTRACE_OPS_FL_IPMODIFY 0 +#endif + static struct ftrace_ops kpatch_ftrace_ops __read_mostly = { .func = kpatch_ftrace_handler, - .flags = FTRACE_OPS_FL_SAVE_REGS, + .flags = FTRACE_OPS_FL_SAVE_REGS | FTRACE_OPS_FL_IPMODIFY, }; static int kpatch_ftrace_add_func(unsigned long ip)