Skip to contentSkip to conversation

perf tools: Fix proper buffer size for feature processing

PATCH In review Jiri Olsa 3 participants 3 messages Jul 15, 2019 – Jul 23, 2019 perf events

lore
Share & tools
lore

Jiri Olsa

author reviewer
#0 lore raw

PATCH 1/1 perf tools: Fix proper buffer size for feature processing

After Song Liu's segfault fix for pipe mode, Arnaldo reported following error:

  # perf record -o - | perf script
  0x514 [0x1ac]: failed to process type: 80

It's caused by wrong buffer size setup in feature processing, which makes cpu topology feature fail, because it's using buffer size to recognize its header version.

Cc David Carrillo-Cisneros <[email protected]>
Cc Song Liu <[email protected]>
Cc Kan Liang <[email protected]>
Fixes e9def1b2e74e ("perf tools: Add feature header record to pipe-mode")
---
 tools/perf/util/header.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/header.c +1 -1
index c24db7f4909c..20111f8da5cb 100644
@@ -3747,7 +3747,7 @@ int perf_event__process_feature(struct perf_session *session,
 		return 0;
 
 	ff.buf  = (void *)fe->data;
-	ff.size = event->header.size - sizeof(event->header);
+	ff.size = event->header.size - sizeof(*fe);
 	ff.ph = &session->header;
 
 	if (feat_ops[feat].process(&ff, NULL))
Signature · 1 line
2.21.0
#1 lore raw

Em Mon, Jul 15, 2019 at 04:04:26PM +0200, Jiri Olsa escreveu:

Quoted 5 lines

After Song Liu's segfault fix for pipe mode, Arnaldo reported following error:

  # perf record -o - | perf script
  0x514 [0x1ac]: failed to process type: 80

Thanks, tested and applied.

- Arnaldo

#2 lore raw
In reply to Jiri Olsa
perf tools: Fix proper buffer size for feature processing
Commit-ID:  79b2fe5e756163897175a8f57d66b26cd9befd59
Gitweb:     https://git.kernel.org/tip/79b2fe5e756163897175a8f57d66b26cd9befd59
Author:     Jiri Olsa <[email protected]>
AuthorDate: Mon, 15 Jul 2019 16:04:26 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 23 Jul 2019 08:59:49 -0300

perf tools: Fix proper buffer size for feature processing

After Song Liu's segfault fix for pipe mode, Arnaldo reported following error:

  # perf record -o - | perf script
  0x514 [0x1ac]: failed to process type: 80

It's caused by wrong buffer size setup in feature processing, which makes cpu topology feature fail, because it's using buffer size to recognize its header version.

Cc Alexander Shishkin <[email protected]>
Cc David Carrillo-Cisneros <[email protected]>
Cc Kan Liang <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Song Liu <[email protected]>
Fixes e9def1b2e74e ("perf tools: Add feature header record to pipe-mode")
---
 tools/perf/util/header.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/header.c +1 -1
index c24db7f4909c..20111f8da5cb 100644
@@ -3747,7 +3747,7 @@ int perf_event__process_feature(struct perf_session *session,
 		return 0;
 
 	ff.buf  = (void *)fe->data;
-	ff.size = event->header.size - sizeof(event->header);
+	ff.size = event->header.size - sizeof(*fe);
 	ff.ph = &session->header;
 
 	if (feat_ops[feat].process(&ff, NULL))