[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1380172836-13936-1-git-send-email-sonnyrao@chromium.org>
Date: Wed, 25 Sep 2013 22:20:36 -0700
From: Sonny Rao <sonnyrao@...omium.org>
To: linux-kernel@...r.kernel.org
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
Stephane Eranian <eranian@...gle.com>,
Sonny Rao <sonnyrao@...omium.org>
Subject: [PATCH] perf: fix infinite loop with corrupted header
We recently ran into a corrupt perf data file which mostly looked okay
but the section size for data was set to 0. This caused perf report to
get into an infinite loop in __perf_session_process_events(). Let's
just avoid this by bailing early and reporting it if there's an
invalid header.
Signed-off-by: Sonny Rao <sonnyrao@...omium.org>
---
tools/perf/util/header.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 26441d0..085ef76 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -2582,6 +2582,10 @@ int perf_file_header__read(struct perf_file_header *header,
ph->data_offset = header->data.offset;
ph->data_size = header->data.size;
ph->feat_offset = header->data.offset + header->data.size;
+
+ if (!header->data.size)
+ die("corrupted header, invalid size 0 for data section\n");
+
return 0;
}
--
1.8.4
--
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