summaryrefslogtreecommitdiff
path: root/kernel/livepatch/patch.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-06-21 12:02:48 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2017-06-21 12:02:48 -0700
commitdcba71086e0d1abf4f00cd381530b11d0db7fa1d (patch)
tree8f89180f41c3592529b9bfecb77e63a683b414fb /kernel/livepatch/patch.c
parent021f601980ccf07e65bc03e40d0321243f782d34 (diff)
parent842c08846420baa619fe3cb8c9af538efdb89428 (diff)
downloadlinux-dcba71086e0d1abf4f00cd381530b11d0db7fa1d.tar.gz
linux-dcba71086e0d1abf4f00cd381530b11d0db7fa1d.tar.bz2
linux-dcba71086e0d1abf4f00cd381530b11d0db7fa1d.zip
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livepatching
Pull livepatching fix from Jiri Kosina: "Fix the way how livepatches are being stacked with respect to RCU, from Petr Mladek" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livepatching: livepatch: Fix stacking of patches with respect to RCU
Diffstat (limited to 'kernel/livepatch/patch.c')
-rw-r--r--kernel/livepatch/patch.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/kernel/livepatch/patch.c b/kernel/livepatch/patch.c
index f8269036bf0b..52c4e907c14b 100644
--- a/kernel/livepatch/patch.c
+++ b/kernel/livepatch/patch.c
@@ -59,7 +59,11 @@ static void notrace klp_ftrace_handler(unsigned long ip,
ops = container_of(fops, struct klp_ops, fops);
- rcu_read_lock();
+ /*
+ * A variant of synchronize_sched() is used to allow patching functions
+ * where RCU is not watching, see klp_synchronize_transition().
+ */
+ preempt_disable_notrace();
func = list_first_or_null_rcu(&ops->func_stack, struct klp_func,
stack_node);
@@ -115,7 +119,7 @@ static void notrace klp_ftrace_handler(unsigned long ip,
klp_arch_set_pc(regs, (unsigned long)func->new_func);
unlock:
- rcu_read_unlock();
+ preempt_enable_notrace();
}
/*