Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941395AbcJXTCQ (ORCPT ); Mon, 24 Oct 2016 15:02:16 -0400 Received: from terminus.zytor.com ([198.137.202.10]:46898 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S941373AbcJXTCN (ORCPT ); Mon, 24 Oct 2016 15:02:13 -0400 Date: Mon, 24 Oct 2016 12:01:38 -0700 From: tip-bot for Stefano Sanfilippo Message-ID: Cc: rmcilroy@chromium.org, linux-kernel@vger.kernel.org, peterz@infradead.org, jolsa@redhat.com, tglx@linutronix.de, eranian@google.com, mingo@kernel.org, namhyung@kernel.org, anton@ozlabs.org, ssanfilippo@chromium.org, hpa@zytor.com, acme@redhat.com Reply-To: ssanfilippo@chromium.org, hpa@zytor.com, acme@redhat.com, anton@ozlabs.org, namhyung@kernel.org, eranian@google.com, mingo@kernel.org, jolsa@redhat.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, peterz@infradead.org, rmcilroy@chromium.org In-Reply-To: <1476356383-30100-9-git-send-email-eranian@google.com> References: <1476356383-30100-9-git-send-email-eranian@google.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf jit: Check JITHEADER_VERSION Git-Commit-ID: 6760d77b708571b925e2dd2b61f847cbee6e0f21 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1637 Lines: 42 Commit-ID: 6760d77b708571b925e2dd2b61f847cbee6e0f21 Gitweb: http://git.kernel.org/tip/6760d77b708571b925e2dd2b61f847cbee6e0f21 Author: Stefano Sanfilippo AuthorDate: Thu, 13 Oct 2016 03:59:42 -0700 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 24 Oct 2016 11:07:40 -0300 perf jit: Check JITHEADER_VERSION Check the version number when opening a jitdump file. Accept older versions, but not newer ones. Signed-off-by: Stefano Sanfilippo Signed-off-by: Ross McIlroy Reviewed-by: Stephane Eranian Cc: Anton Blanchard Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1476356383-30100-9-git-send-email-eranian@google.com Signed-off-by: Arnaldo Carvalho de Melo --- 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 6a2688d..c9a941e 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);