Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1507379

[PATCH 24/37] perf jit: Check JITHEADER_VERSION

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 24/37] perf jit: Check JITHEADER_VERSION
Date 2016-10-24 18:30 +0200
Message-ID <svQim-1Di-57@gated-at.bofh.it> (permalink)
References <svQil-1Di-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Stefano Sanfilippo <ssanfilippo@chromium.org>

Check the version number when opening a jitdump file.  Accept older
versions, but not newer ones.

Signed-off-by: Stefano Sanfilippo <ssanfilippo@chromium.org>
Signed-off-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Stephane Eranian <eranian@google.com>
Cc: Anton Blanchard <anton@ozlabs.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1476356383-30100-9-git-send-email-eranian@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/jitdump.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/perf/util/jitdump.c b/tools/perf/util/jitdump.c
index 6a2688da3c4a..c9a941ef0f6d 100644
--- a/tools/perf/util/jitdump.c
+++ b/tools/perf/util/jitdump.c
@@ -180,6 +180,12 @@ jit_open(struct jit_buf_desc *jd, const char *name)
 			header.elf_mach,
 			jd->use_arch_timestamp);
 
+	if (header.version > JITHEADER_VERSION) {
+		pr_err("wrong jitdump version %u, expected " STR(JITHEADER_VERSION),
+			header.version);
+		goto error;
+	}
+
 	if (header.flags & JITDUMP_FLAGS_RESERVED) {
 		pr_err("jitdump file contains invalid or unsupported flags 0x%llx\n",
 		       (unsigned long long)header.flags & JITDUMP_FLAGS_RESERVED);
-- 
2.7.4

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 24/37] perf jit: Check JITHEADER_VERSION Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-10-24 18:30 +0200

csiph-web