From: Arnaldo Carvalho de Melo Date: Mon, 28 Jul 2014 15:39:50 +0000 (-0300) Subject: perf evlist: Don't run workload if not told to X-Git-Tag: fixes-against-v3.18-rc2~100^2~47^2~31 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f1c4225f6bcb20cc004b271dc72b96d0da29e9e;p=pandora-kernel.git perf evlist: Don't run workload if not told to The perf_evlist__prepare_workload() method works by forking and then waiting on a fd that must be written to to allow the workload to be exec()ed. But if the tool calling it fails to, say, set up the events with which it wants to sample the workload for, it will not call perf_evlist__start_workload(), but even in this case the workload ended up running: [acme@zoo linux]$ trace /bin/echo workload ends up running, it should not... Couldn't mmap the events: Operation not permitted workload ends up running, it should not... [acme@zoo linux]$ So check if at least one byte was written before letting exec() be called. Now the expected behaviour: [acme@zoo linux]$ trace /bin/echo workload ends up running, it should not... Couldn't mmap the events: Operation not permitted [acme@zoo linux]$ Acked-by: Jiri Olsa Cc: Adrian Hunter Cc: David Ahern Cc: Don Zickus Cc: Frederic Weisbecker Cc: Jiri Olsa Cc: Mike Galbraith Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/n/tip-oh1ixo8m74rf295a05gfjw8b@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- Reading git-diff-tree failed