mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	<stable@vger.kernel.org>, Rabin Vincent <rabin.vincent@gmail.com>
Subject: [for-next][PATCH 6/8] tracing: Fix crash from reading trace_pipe with sendfile
Date: Sat, 19 Mar 2016 10:15:22 -0400	[thread overview]
Message-ID: <20160319141536.995426051@goodmis.org> (raw)
In-Reply-To: <20160319141516.683762867@goodmis.org>

[-- Attachment #1: 0006-tracing-Fix-crash-from-reading-trace_pipe-with-sendf.patch --]
[-- Type: text/plain, Size: 1069 bytes --]

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

If tracing contains data and the trace_pipe file is read with sendfile(),
then it can trigger a NULL pointer dereference and various BUG_ON within the
VM code.

There's a patch to fix this in the splice_to_pipe() code, but it's also a
good idea to not let that happen from trace_pipe either.

Link: http://lkml.kernel.org/r/1457641146-9068-1-git-send-email-rabin@rab.in

Cc: stable@vger.kernel.org # 2.6.30+
Reported-by: Rabin Vincent <rabin.vincent@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 0ae46048f724..cb2b708e4ea7 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -4954,7 +4954,10 @@ static ssize_t tracing_splice_read_pipe(struct file *filp,
 
 	spd.nr_pages = i;
 
-	ret = splice_to_pipe(pipe, &spd);
+	if (i)
+		ret = splice_to_pipe(pipe, &spd);
+	else
+		ret = 0;
 out:
 	splice_shrink_spd(&spd);
 	return ret;
-- 
2.7.0

  parent reply	other threads:[~2016-03-19 14:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-19 14:15 [for-next][PATCH 0/8] tracing: Last minute updates for 4.6 Steven Rostedt
2016-03-19 14:15 ` [for-next][PATCH 1/8] ftrace: Make ftrace_hash_rec_enable return update bool Steven Rostedt
2016-03-19 14:15 ` [for-next][PATCH 2/8] ftrace: Update dynamic ftrace calls only if necessary Steven Rostedt
2016-03-19 14:15 ` [for-next][PATCH 3/8] ftrace: Use kasprintf() in ftrace_profile_tracefs() Steven Rostedt
2016-03-19 14:15 ` [for-next][PATCH 4/8] tracing: Fix return while holding a lock in register_tracer() Steven Rostedt
2016-03-19 14:15 ` [for-next][PATCH 5/8] tracing: Have preempt(irqs)off trace preempt disabled functions Steven Rostedt
2016-03-19 14:15 ` Steven Rostedt [this message]
2016-03-19 14:15 ` [for-next][PATCH 7/8] x86: ftrace: Fix the misleading comment for arch/x86/kernel/ftrace.c Steven Rostedt
2016-03-19 14:15 ` [for-next][PATCH 8/8] tracing: Remove redundant reset per-CPU buff in irqsoff tracer Steven Rostedt

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=20160319141536.995426051@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=rabin.vincent@gmail.com \
    --cc=stable@vger.kernel.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

all inboxes | Powered by JetHome®