diff options
author | Alexander Shishkin <alexander.shishkin@linux.intel.com> | 2016-11-18 06:38:43 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-11-21 05:28:36 -0500 |
commit | e96271f3ed7e702fa36dd0605c0c5b5f065af816 (patch) | |
tree | 06a8a4bb58ff3d0700ce8b224c2282bbf79247f0 | |
parent | e40ed1542dd779e5037a22c6b534e57127472365 (diff) |
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 <vincent.weaver@maine.edu>
Tested-by: Vince Weaver <vincent.weaver@maine.edu>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
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 <mingo@kernel.org>
-rw-r--r-- | kernel/events/core.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c index ff230bb4a02e..6ee1febdf6ff 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -8029,6 +8029,7 @@ restart: | |||
8029 | * if <size> is not specified, the range is treated as a single address. | 8029 | * if <size> is not specified, the range is treated as a single address. |
8030 | */ | 8030 | */ |
8031 | enum { | 8031 | enum { |
8032 | IF_ACT_NONE = -1, | ||
8032 | IF_ACT_FILTER, | 8033 | IF_ACT_FILTER, |
8033 | IF_ACT_START, | 8034 | IF_ACT_START, |
8034 | IF_ACT_STOP, | 8035 | IF_ACT_STOP, |
@@ -8052,6 +8053,7 @@ static const match_table_t if_tokens = { | |||
8052 | { IF_SRC_KERNEL, "%u/%u" }, | 8053 | { IF_SRC_KERNEL, "%u/%u" }, |
8053 | { IF_SRC_FILEADDR, "%u@%s" }, | 8054 | { IF_SRC_FILEADDR, "%u@%s" }, |
8054 | { IF_SRC_KERNELADDR, "%u" }, | 8055 | { IF_SRC_KERNELADDR, "%u" }, |
8056 | { IF_ACT_NONE, NULL }, | ||
8055 | }; | 8057 | }; |
8056 | 8058 | ||
8057 | /* | 8059 | /* |