summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSteven Rostedt <rostedt@goodmis.org>2008-10-23 09:32:59 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-23 16:00:13 +0200
commit593eb8a2d63e95772a5f22d746f18a997c5ee463 (patch)
tree2a99c61ccffc2c0fd280bb2e5f81ac2f22e2f471 /arch
parent34698bcbdf7b0629d6c873b5da7c63073fb45361 (diff)
downloadtalos-obmc-linux-593eb8a2d63e95772a5f22d746f18a997c5ee463.tar.gz
talos-obmc-linux-593eb8a2d63e95772a5f22d746f18a997c5ee463.zip
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 'arch')
-rw-r--r--arch/x86/kernel/ftrace.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index 8821ceabf51d..428291581cb2 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -62,7 +62,6 @@ ftrace_modify_code(unsigned long ip, unsigned char *old_code,
unsigned char *new_code)
{
unsigned char replaced[MCOUNT_INSN_SIZE];
- int ret;
/*
* Note: Due to modules and __init, code can
@@ -72,15 +71,16 @@ ftrace_modify_code(unsigned long ip, unsigned char *old_code,
* No real locking needed, this code is run through
* kstop_machine, or before SMP starts.
*/
- if (__copy_from_user_inatomic(replaced, (char __user *)ip, MCOUNT_INSN_SIZE))
- return 1;
+ if (__copy_from_user_inatomic(replaced, (char __user *)ip,
+ MCOUNT_INSN_SIZE))
+ return -EFAULT;
if (memcmp(replaced, old_code, MCOUNT_INSN_SIZE) != 0)
- return 2;
+ return -EINVAL;
- ret = __copy_to_user_inatomic((char __user *)ip, new_code,
- MCOUNT_INSN_SIZE);
- WARN_ON_ONCE(ret);
+ if (__copy_to_user_inatomic((char __user *)ip, new_code,
+ MCOUNT_INSN_SIZE))
+ return -EPERM;
sync_core();
OpenPOWER on IntegriCloud