diff options
author | Steven Rostedt <rostedt@goodmis.org> | 2008-10-23 09:32:59 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-23 10:00:13 -0400 |
commit | 593eb8a2d63e95772a5f22d746f18a997c5ee463 (patch) | |
tree | 2a99c61ccffc2c0fd280bb2e5f81ac2f22e2f471 /kernel | |
parent | 34698bcbdf7b0629d6c873b5da7c63073fb45361 (diff) |
ftrace: return error on failed modified text.
Have the ftrace_modify_code return error values:
-EFAULT on error of reading the address
-EINVAL if what is read does not match what it expected
-EPERM if the write fails to update after a successful match.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/ftrace.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 1f54a94189fe..b2de8de77356 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -596,22 +596,22 @@ ftrace_code_disable(struct dyn_ftrace *rec) | |||
596 | { | 596 | { |
597 | unsigned long ip; | 597 | unsigned long ip; |
598 | unsigned char *nop, *call; | 598 | unsigned char *nop, *call; |
599 | int failed; | 599 | int ret; |
600 | 600 | ||
601 | ip = rec->ip; | 601 | ip = rec->ip; |
602 | 602 | ||
603 | nop = ftrace_nop_replace(); | 603 | nop = ftrace_nop_replace(); |
604 | call = ftrace_call_replace(ip, mcount_addr); | 604 | call = ftrace_call_replace(ip, mcount_addr); |
605 | 605 | ||
606 | failed = ftrace_modify_code(ip, call, nop); | 606 | ret = ftrace_modify_code(ip, call, nop); |
607 | if (failed) { | 607 | if (ret) { |
608 | switch (failed) { | 608 | switch (ret) { |
609 | case 1: | 609 | case -EFAULT: |
610 | WARN_ON_ONCE(1); | 610 | WARN_ON_ONCE(1); |
611 | pr_info("ftrace faulted on modifying "); | 611 | pr_info("ftrace faulted on modifying "); |
612 | print_ip_sym(ip); | 612 | print_ip_sym(ip); |
613 | break; | 613 | break; |
614 | case 2: | 614 | case -EINVAL: |
615 | WARN_ON_ONCE(1); | 615 | WARN_ON_ONCE(1); |
616 | pr_info("ftrace failed to modify "); | 616 | pr_info("ftrace failed to modify "); |
617 | print_ip_sym(ip); | 617 | print_ip_sym(ip); |
@@ -620,6 +620,15 @@ ftrace_code_disable(struct dyn_ftrace *rec) | |||
620 | print_ip_ins(" replace: ", nop); | 620 | print_ip_ins(" replace: ", nop); |
621 | printk(KERN_CONT "\n"); | 621 | printk(KERN_CONT "\n"); |
622 | break; | 622 | break; |
623 | case -EPERM: | ||
624 | WARN_ON_ONCE(1); | ||
625 | pr_info("ftrace faulted on writing "); | ||
626 | print_ip_sym(ip); | ||
627 | break; | ||
628 | default: | ||
629 | WARN_ON_ONCE(1); | ||
630 | pr_info("ftrace faulted on unknown error "); | ||
631 | print_ip_sym(ip); | ||
623 | } | 632 | } |
624 | 633 | ||
625 | rec->flags |= FTRACE_FL_FAILED; | 634 | rec->flags |= FTRACE_FL_FAILED; |