提交 e96271f3 编写于 作者: A Alexander Shishkin 提交者: Ingo Molnar

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: NVince Weaver <vincent.weaver@maine.edu>
Tested-by: NVince Weaver <vincent.weaver@maine.edu>
Signed-off-by: NAlexander Shishkin <alexander.shishkin@linux.intel.com>
Acked-by: NPeter 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: 375637bc ("perf/core: Introduce address range filtering")
Link: http://lkml.kernel.org/r/877f81f264.fsf@ashishki-desk.ger.corp.intel.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
上级 e40ed154
...@@ -8029,6 +8029,7 @@ static void perf_event_addr_filters_apply(struct perf_event *event) ...@@ -8029,6 +8029,7 @@ static void perf_event_addr_filters_apply(struct perf_event *event)
* if <size> is not specified, the range is treated as a single address. * if <size> is not specified, the range is treated as a single address.
*/ */
enum { enum {
IF_ACT_NONE = -1,
IF_ACT_FILTER, IF_ACT_FILTER,
IF_ACT_START, IF_ACT_START,
IF_ACT_STOP, IF_ACT_STOP,
...@@ -8052,6 +8053,7 @@ static const match_table_t if_tokens = { ...@@ -8052,6 +8053,7 @@ static const match_table_t if_tokens = {
{ IF_SRC_KERNEL, "%u/%u" }, { IF_SRC_KERNEL, "%u/%u" },
{ IF_SRC_FILEADDR, "%u@%s" }, { IF_SRC_FILEADDR, "%u@%s" },
{ IF_SRC_KERNELADDR, "%u" }, { IF_SRC_KERNELADDR, "%u" },
{ IF_ACT_NONE, NULL },
}; };
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册