From: Alexander Shishkin Date: Fri, 18 Nov 2016 11:38:43 +0000 (+0200) Subject: perf/core: Fix address filter parser X-Git-Tag: v4.8.12~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=403f47ddbf6b282c1ea562e91d5f81960507a804;p=thirdparty%2Fkernel%2Fstable.git perf/core: Fix address filter parser commit e96271f3ed7e702fa36dd0605c0c5b5f065af816 upstream. 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 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/kernel/events/core.c b/kernel/events/core.c index fc9bb22252913..f8c5f5ec666e0 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -7908,6 +7908,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, @@ -7931,6 +7932,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 }, }; /*