lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.1.10.0810281039130.29482@gandalf.stny.rr.com>
Date:	Tue, 28 Oct 2008 10:44:24 -0400 (EDT)
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Linux Kernel <linux-kernel@...r.kernel.org>
cc:	Ingo Molnar <mingo@...e.hu>,
	Frédéric Weisbecker <fweisbec@...il.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>
Subject: [PATCH] ftrace: fix current_tracer error return


The commit (in linux-tip) c2931e05ec5965597cbfb79ad332d4a29aeceb23
 ( ftrace: return an error when setting a nonexistent tracer )
added useful code that would error when a bad tracer was written into
the current_tracer file.

But this had a bug if the amount written was more than the amount read by 
that code. The first iteration would set the tracer correctly, but since
it did not consume the rest of what was written (usually whitespace), the 
userspace utility would continue to write what was not consumed. This 
second iteration would fail to find a tracer and return -EINVAL. Funny 
thing is that the tracer would have already been set.

This patch just consumes all the data that is written to the file.


Signed-off-by: Steven Rostedt <srostedt@...hat.com>
---
 kernel/trace/trace.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Index: linux-tip.git/kernel/trace/trace.c
===================================================================
--- linux-tip.git.orig/kernel/trace/trace.c	2008-10-28 10:23:41.000000000 -0400
+++ linux-tip.git/kernel/trace/trace.c	2008-10-28 10:25:58.000000000 -0400
@@ -2399,9 +2399,10 @@ tracing_set_trace_write(struct file *fil
 	int i;
 	size_t ret;
 
+	ret = cnt;
+
 	if (cnt > max_tracer_type_len)
 		cnt = max_tracer_type_len;
-	ret = cnt;
 
 	if (copy_from_user(&buf, ubuf, cnt))
 		return -EFAULT;
@@ -2434,8 +2435,8 @@ tracing_set_trace_write(struct file *fil
  out:
 	mutex_unlock(&trace_types_lock);
 
-	if (ret == cnt)
-		filp->f_pos += cnt;
+	if (ret > 0)
+		filp->f_pos += ret;
 
 	return ret;
 }


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ