The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: mhiramat@kernel.org, Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org,
	Dan Carpenter <dan.carpenter@oracle.com>
Subject: [ftrace/kprobes PATCH 1/3] tracing/uprobes: Fix to return -EFAULT if copy_from_user failed
Date: Wed, 29 Aug 2018 01:17:47 +0900	[thread overview]
Message-ID: <153547306719.26502.8353484532699160223.stgit@devbox> (raw)
In-Reply-To: <153547303754.26502.5265242979168613920.stgit@devbox>

Fix probe_mem_read() to return -EFAULT if copy_from_user()
failed. The copy_from_user() returns remaining bytes
when it failed, but probe_mem_read() caller expects it
returns error code like as probe_kernel_read().

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 kernel/trace/trace_uprobe.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index 12bdbdf772ed..63e99ee716fe 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -104,7 +104,7 @@ probe_mem_read(void *dest, void *src, size_t size)
 {
 	void __user *vaddr = (void __force __user *)src;
 
-	return copy_from_user(dest, vaddr, size);
+	return copy_from_user(dest, vaddr, size) ? -EFAULT : 0;
 }
 /*
  * Fetch a null-terminated string. Caller MUST set *(u32 *)dest with max


  reply	other threads:[~2018-08-28 16:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-28 16:17 [ftrace/kprobes PATCH 0/3] tracing: probeevent: Fix module symbol probing Masami Hiramatsu
2018-08-28 16:17 ` Masami Hiramatsu [this message]
2018-08-28 16:18 ` [ftrace/kprobes PATCH 2/3] tracing/kprobes: Check the probe on unloaded module correctly Masami Hiramatsu
2018-08-28 16:18 ` [ftrace/kprobes PATCH 3/3] tracing/kprobes: Allow kprobe-events to record module symbol Masami Hiramatsu
2018-10-03 19:12   ` Steven Rostedt
2018-10-04  1:11     ` Steven Rostedt
2018-10-05  8:53       ` Masami Hiramatsu
2018-09-27 10:48 ` [ftrace/kprobes PATCH 0/3] tracing: probeevent: Fix module symbol probing Masami Hiramatsu
2018-10-01 15:48   ` Steven Rostedt
2018-10-03  2:47     ` Steven Rostedt
2018-10-03 13:26       ` Masami Hiramatsu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=153547306719.26502.8353484532699160223.stgit@devbox \
    --to=mhiramat@kernel.org \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox