Skip to contentSkip to conversation

perf_events: fix bogus copy_to_user() in perf_event_read_group()

PATCH In review Stephane Eranian 3 participants 6 messages Nov 23, 2009 – Nov 24, 2009 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 perf_events: fix bogus copy_to_user() in perf_event_read_group()

       When using an event group, the value and id for non leaders events were wrong due to invalid offset into the outgoing buffer.

---
 perf_event.c |    2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/perf_event.c +0 -0
index 0b0d5f7..8306127 100644
@@ -1826,7 +1826,7 @@ static int perf_event_read_group(struct perf_event *event,
 

               size = n * sizeof(u64);

-               if (copy_to_user(buf + size, values, size)) {
+               if (copy_to_user(buf + ret, values, size)) { ret = -EFAULT;
                       goto unlock;
               }

#2 lore raw
Quoted 4 lines · Stephane Eranian

When using an event group, the value and id for non leaders events were wrong due to invalid offset into the outgoing buffer.

Gah, I only just wrecked that didn't I...

Thanks for catching that.

#3 lore raw
Quoted 8 lines · Peter Zijlstra
Quoted 4 lines · Stephane Eranian

       When using an event group, the value and id for non leaders events were wrong due to invalid offset into the outgoing buffer.

Gah, I only just wrecked that didn't I...

Probably because it worked before.

Quoted 3 lines

Thanks for catching that.

Signature · 8 lines
Stephane Eranian  | EMEA Software Engineering
Google France | 38 avenue de l'Opéra | 75002 Paris
Tel : +33 (0) 1 42 68 53 00
This email may be confidential or privileged. If you received this
communication by mistake, please
don't forward it to anyone else, please erase all copies and
attachments, and please let me know that
it went to the wrong person. Thanks
#4 lore raw
In reply to Stephane Eranian
Quoted 14 lines · Stephane Eranian

?? ?? ?? ??When using an event group, the value and id for non leaders events were ?? ?? ?? ??wrong due to invalid offset into the outgoing buffer.

?? ?? ?? ??Signed-off-by: Stephane Eranian <[email protected]>

---
??perf_event.c | ?? ??2 +-
??1 file changed, 1 insertion(+), 1 deletion(-)

kernel/perf_event.c +0 -0
index 0b0d5f7..8306127 100644

kernel/perf_event.c static int perf_event_read_group(struct perf_event *event, · line 1832

Quoted 8 lines
kernel/perf_event.c +1 -1
@@ -1826,7 +1826,7 @@ static int perf_event_read_group(struct perf_event *event,
 
 ?? ?? ?? ?? ?? ?? ?? ??size = n * sizeof(u64);
 
- ?? ?? ?? ?? ?? ?? ?? if (copy_to_user(buf + size, values, size)) {
+ ?? ?? ?? ?? ?? ?? ?? if (copy_to_user(buf + ret, values, size)) {
 ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??ret = -EFAULT;
 ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??goto unlock;
 ?? ?? ?? ?? ?? ?? ?? ??}

hm, patch is seriously garbled - mind sending it according to Documentation/email-clients.txt?

Thanks,

Ingo

#5 lore raw

PATCH 1/1 perf_events: fix bogus copy_to_user() in perf_event_read_group()

In reply to Stephane Eranian

[This is a repost due to a formatting problem with Gmail]

When using an event group, the value and id for non leaders events were wrong due to invalid offset into the outgoing buffer.

---
 perf_event.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/perf_event.c +1 -1
index 0b0d5f7..8306127 100644
@@ -1826,7 +1826,7 @@ static int perf_event_read_group(struct perf_event *event,
 
 		size = n * sizeof(u64);
 
-		if (copy_to_user(buf + size, values, size)) {
+		if (copy_to_user(buf + ret, values, size)) {
 			ret = -EFAULT;
 			goto unlock;
 		}
#6 lore raw

[tip:perf/core] perf_events: Fix bogus copy_to_user() in perf_event_read_group()

Commit-ID:  184d3da8ef0ca552dffa0fdd35c046e058a2cf9a
Gitweb:     http://git.kernel.org/tip/184d3da8ef0ca552dffa0fdd35c046e058a2cf9a
Author:     Stephane Eranian <[email protected]>
AuthorDate: Mon, 23 Nov 2009 21:40:49 -0800
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 24 Nov 2009 08:55:27 +0100

perf_events: Fix bogus copy_to_user() in perf_event_read_group()

When using an event group, the value and id for non leaders events were wrong due to invalid offset into the outgoing buffer.

LKML-Reference: <[email protected]>

---
 kernel/perf_event.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/perf_event.c +1 -1
index 9425c96..accfd7b 100644
@@ -1831,7 +1831,7 @@ static int perf_event_read_group(struct perf_event *event,
 
 		size = n * sizeof(u64);
 
-		if (copy_to_user(buf + size, values, size)) {
+		if (copy_to_user(buf + ret, values, size)) {
 			ret = -EFAULT;
 			goto unlock;
 		}