Skip to contentSkip to conversation

ftrace: advance readpos in trace_seq_to_user() by really read bytes

PATCH In review Vitaly Mayatskikh 2 participants 3 messages Mar 26, 2009 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ftrace: advance readpos in trace_seq_to_user() by really read bytes

If tracer will not provide input buffer of enough size, he will never see data between cnt and len bytes.

kernel/trace/trace.c +1 -1
index 17bb88d..0217615 100644
@@ -477,7 +477,7 @@ ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, size_t cnt)
 	if (ret)
 		return -EFAULT;
 
-	s->readpos += len;
+	s->readpos += cnt;
 	return cnt;
 }
 
Signature · 1 line
wbr, Vitaly
#1 lore raw
Quoted 8 lines · On Thu, 26 Mar 2009 18:22:18 +0100 Vitaly Mayatskikh <[email protected]>…

If tracer will not provide input buffer of enough size, he will never see data between cnt and len bytes.

kernel/trace/trace.c +0 -0
index 17bb88d..0217615 100644

kernel/trace/trace.c ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, size_t cnt) · line 482

Quoted 7 lines
kernel/trace/trace.c +1 -1
@@ -477,7 +477,7 @@ ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, size_t cnt)
 	if (ret)
 		return -EFAULT;
 
-	s->readpos += len;
+	s->readpos += cnt;
 	return cnt;
 }

This fix seems to be already included in tip/master:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git

It's not in Linus' master, but I guess it's on its way there.

Thanks.

Signature · 2 lines
Pekka Paalanen
http://www.iki.fi/pq/
#2 lore raw
Quoted 4 lines · Pekka Paalanen

This fix seems to be already included in tip/master:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git

It's not in Linus' master, but I guess it's on its way there.

Yes, fix is there. Thanks for pointing.

Signature · 1 line
wbr, Vitaly