]> git.karo-electronics.de Git - linux-beck.git/commitdiff
perf jit: Check JITHEADER_VERSION
authorStefano Sanfilippo <ssanfilippo@chromium.org>
Thu, 13 Oct 2016 10:59:42 +0000 (03:59 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 24 Oct 2016 14:07:40 +0000 (11:07 -0300)
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

index 6a2688da3c4aec251f0a80d30dd723120efae357..c9a941ef0f6dde0c88da23a6d233d120646c3257 100644 (file)
@@ -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);