From: Alexander Shishkin Date: Thu, 26 Jan 2017 09:40:56 +0000 (+0200) Subject: perf/core: Do error out on a kernel filter on an exclude_filter event X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=9ccbfbb157a38921702402281ca7be530b4c3669;p=openwrt%2Fstaging%2Fblogic.git perf/core: Do error out on a kernel filter on an exclude_filter event It is currently possible to configure a kernel address filter for a event that excludes kernel from its traces (attr.exclude_kernel==1). While in reality this doesn't make sense, the SET_FILTER ioctl() should return a error in such case, currently it does not. Furthermore, it will still silently discard the filter and any potentially valid filters that came with it. This patch makes the SET_FILTER ioctl() error out in such cases. Signed-off-by: Alexander Shishkin Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Mathieu Poirier Cc: Arnaldo Carvalho de Melo Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Linus Torvalds Cc: Mark Rutland Cc: Peter Zijlstra Cc: Stephane Eranian Cc: Thomas Gleixner Cc: Vince Weaver Cc: Will Deacon Cc: vince@deater.net Link: http://lkml.kernel.org/r/20170126094057.13805-3-alexander.shishkin@linux.intel.com Signed-off-by: Ingo Molnar --- diff --git a/kernel/events/core.c b/kernel/events/core.c index 88676ff98c0f..1730995c31ec 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -8260,6 +8260,7 @@ perf_event_parse_addr_filter(struct perf_event *event, char *fstr, * attribute. */ if (state == IF_STATE_END) { + ret = -EINVAL; if (kernel && event->attr.exclude_kernel) goto fail;