Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754079AbcKUKjR (ORCPT ); Mon, 21 Nov 2016 05:39:17 -0500 Received: from terminus.zytor.com ([198.137.202.10]:59400 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753626AbcKUKjQ (ORCPT ); Mon, 21 Nov 2016 05:39:16 -0500 Date: Mon, 21 Nov 2016 02:38:44 -0800 From: tip-bot for Alexander Shishkin Message-ID: Cc: alexander.shishkin@linux.intel.com, vincent.weaver@maine.edu, tglx@linutronix.de, hpa@zytor.com, linux-kernel@vger.kernel.org, mingo@kernel.org, torvalds@linux-foundation.org, peterz@infradead.org, acme@kernel.org Reply-To: hpa@zytor.com, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, mingo@kernel.org, peterz@infradead.org, acme@kernel.org, alexander.shishkin@linux.intel.com, tglx@linutronix.de, vincent.weaver@maine.edu In-Reply-To: <877f81f264.fsf@ashishki-desk.ger.corp.intel.com> References: <877f81f264.fsf@ashishki-desk.ger.corp.intel.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf/core: Fix address filter parser Git-Commit-ID: e96271f3ed7e702fa36dd0605c0c5b5f065af816 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: 1942 Lines: 54 Commit-ID: e96271f3ed7e702fa36dd0605c0c5b5f065af816 Gitweb: http://git.kernel.org/tip/e96271f3ed7e702fa36dd0605c0c5b5f065af816 Author: Alexander Shishkin AuthorDate: Fri, 18 Nov 2016 13:38:43 +0200 Committer: Ingo Molnar CommitDate: Mon, 21 Nov 2016 11:28:36 +0100 perf/core: Fix address filter parser The token table passed into match_token() must be null-terminated, which it currently is not in the perf's address filter string parser, as caught by Vince's perf_fuzzer and KASAN. It doesn't blow up otherwise because of the alignment padding of the table to the next element in the .rodata, which is luck. Fixing by adding a null-terminator to the token table. Reported-by: Vince Weaver Tested-by: Vince Weaver Signed-off-by: Alexander Shishkin Acked-by: Peter Zijlstra (Intel) Cc: Arnaldo Carvalho de Melo Cc: Linus Torvalds Cc: Thomas Gleixner Cc: dvyukov@google.com Cc: stable@vger.kernel.org # v4.7+ Fixes: 375637bc524 ("perf/core: Introduce address range filtering") Link: http://lkml.kernel.org/r/877f81f264.fsf@ashishki-desk.ger.corp.intel.com Signed-off-by: Ingo Molnar --- kernel/events/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/events/core.c b/kernel/events/core.c index ff230bb..6ee1feb 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -8029,6 +8029,7 @@ restart: * if is not specified, the range is treated as a single address. */ enum { + IF_ACT_NONE = -1, IF_ACT_FILTER, IF_ACT_START, IF_ACT_STOP, @@ -8052,6 +8053,7 @@ static const match_table_t if_tokens = { { IF_SRC_KERNEL, "%u/%u" }, { IF_SRC_FILEADDR, "%u@%s" }, { IF_SRC_KERNELADDR, "%u" }, + { IF_ACT_NONE, NULL }, }; /*