Skip to contentSkip to conversation

perf tools: fix build for rbtree.c change

PATCH In review Andi Kleen 4 participants 6 messages Mar 30, 2012 perf events

lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/2 perf tools: fix build for rbtree.c change

From: Andi Kleen <[email protected]>

rbtree.c in the main tree now includes linux/export.h, so this file needs a stub too. This makes perf build again in mainline.

---
 tools/perf/util/include/linux/export.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 tools/perf/util/include/linux/export.h
tools/perf/util/include/linux/export.h new file +1 -0
new file mode 100644
index 0000000..493b181
@@ -0,0 +1 @@
+#include <linux/module.h>
Signature · 1 line
1.7.7.6
author
#1 lore raw

PATCH 2/2 perf tools: Fix record sample overlap check for callchains

From: Andi Kleen <[email protected]>

perf record checks for buffer overflow, but checked for the wrong size for callchains. callchains are 8 bytes each, not 1.

---
 tools/perf/util/evsel.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tools/perf/util/evsel.c +1 -1
index f421f7c..90c0756 100644
@@ -550,7 +550,7 @@ int perf_event__parse_sample(const union perf_event *event, u64 type,
 
 		data->callchain = (struct ip_callchain *)array;
 
-		if (sample_overlap(event, array, data->callchain->nr))
+		if (sample_overlap(event, array, (1 + data->callchain->nr) * 8))
 			return -EFAULT;
 
 		array += 1 + data->callchain->nr;
Signature · 1 line
1.7.7.6
#2 lore raw

Re: [PATCH 2/2] perf tools: Fix record sample overlap check for callchains

Quoted 15 lines · Andi Kleen

From: Andi Kleen<[email protected]>

perf record checks for buffer overflow, but checked for the wrong size for callchains. callchains are 8 bytes each, not 1.

---
  tools/perf/util/evsel.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
tools/perf/util/evsel.c +0 -0
index f421f7c..90c0756 100644

tools/perf/util/evsel.c int perf_event__parse_sample(const union perf_event *event, u64 type, · line 553

Quoted 5 lines
tools/perf/util/evsel.c +1 -1
@@ -550,7 +550,7 @@ int perf_event__parse_sample(const union perf_event *event, u64 type,
 
  		data->callchain = (struct ip_callchain *)array;
 
-		if (sample_overlap(event, array, data->callchain->nr))
+		if (sample_overlap(event, array, (1 + data->callchain->nr) * 8))

sizeof(u64) rather than the magic 8?

David

Quoted 3 lines
tools/perf/util/evsel.c +0 -0
  			return -EFAULT;
 
  		array += 1 + data->callchain->nr;
#4 lore raw

Em Fri, Mar 30, 2012 at 01:47:53PM -0400, Josh Boyer escreveu:

Quoted 11 lines · Andi Kleen
Quoted 6 lines

From: Andi Kleen <[email protected]>

rbtree.c in the main tree now includes linux/export.h, so this file needs a stub too. This makes perf build again in mainline.

http://git.kernel.org/?p=linux/kernel/git/tip/tip.git;a=commit;h=2c86bf172e550b4bf089ac7f0de3f6370e243842

Apparently 'perf-urgent-for-linus' isn't as urgent as it sounds?

There was a delay due to a resolution on getting rid of pre-generated bison/flex files, but Ingo should expedite that pull request RSN.

- Arnaldo

#5 lore raw
In reply to Andi Kleen

Em Fri, Mar 30, 2012 at 10:38:33AM -0700, Andi Kleen escreveu:

Quoted 4 lines

From: Andi Kleen <[email protected]>

rbtree.c in the main tree now includes linux/export.h, so this file needs a stub too. This makes perf build again in mainline.

Thank you, this one got fixed already.

Quoted 15 lines
---
 tools/perf/util/include/linux/export.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 tools/perf/util/include/linux/export.h
tools/perf/util/include/linux/export.h new file +1 -0
new file mode 100644
index 0000000..493b181
@@ -0,0 +1 @@
+#include <linux/module.h>
Signature · 1 line
1.7.7.6