[ I also back-ported this and 3 related patches to 2.6.29, see 
git://git.kiszka.org/ipipe-2.6.git queues/2.6.29-noarch. ]

In order to safely enable/disable ftrace during runtime we have to
harden its related service that relies on stop_machine for vanilla
kernels.

Signed-off-by: Jan Kiszka <[email protected]>
---

 kernel/trace/ftrace.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index f7c600d..aa45f71 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -28,6 +28,7 @@
 #include <linux/ctype.h>
 #include <linux/list.h>
 #include <linux/hash.h>
+#include <linux/ipipe.h>
 
 #include <trace/sched.h>
 
@@ -627,6 +628,9 @@ static int __ftrace_modify_code(void *data)
 
 static void ftrace_run_update_code(int command)
 {
+#ifdef CONFIG_IPIPE
+       unsigned long flags;
+#endif /* CONFIG_IPIPE */
        int ret;
 
        ret = ftrace_arch_code_modify_prepare();
@@ -634,7 +638,13 @@ static void ftrace_run_update_code(int command)
        if (ret)
                return;
 
+#ifdef CONFIG_IPIPE
+       flags = ipipe_critical_enter(NULL);
+       __ftrace_modify_code(&command);
+       ipipe_critical_exit(flags);
+#else  /* !CONFIG_IPIPE */
        stop_machine(__ftrace_modify_code, &command, NULL);
+#endif /* !CONFIG_IPIPE */
 
        ret = ftrace_arch_code_modify_post_process();
        FTRACE_WARN_ON(ret);

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Adeos-main mailing list
[email protected]
https://mail.gna.org/listinfo/adeos-main

Reply via email to