perf machine: Set PROT_EXEC for executable PERF_RECORD_MMAP records
tip-bot for Arnaldo Carvalho de Melo
merge botCommit-ID: 0f476f2bbc1b46f76f9383dfe647858a888549aa Gitweb: https://git.kernel.org/tip/0f476f2bbc1b46f76f9383dfe647858a888549aa Author: Arnaldo Carvalho de Melo <[email protected]> AuthorDate: Thu, 26 Apr 2018 11:30:50 -0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Thu, 26 Apr 2018 13:47:19 -0300
perf machine: Set PROT_EXEC for executable PERF_RECORD_MMAP records
The kernel doesn't fill the map 'prot' field for PERF_RECORD_MMAP records, and we will use that info to replace checking for MAP__VARIABLE, so store that when processing the PERF_RECORD_MISC_MMAP_DATA perf_event_attr.header.misc bit.
Cc Adrian Hunter <[email protected]>
Cc David Ahern <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Wang Nan <[email protected]>
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
--- tools/perf/util/machine.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
tools/perf/util/machine.c +6 -2
@@ -24,6 +24,7 @@#include "sane_ctype.h" #include <symbol/kallsyms.h> +#include <linux/mman.h> static void __machine__remove_thread (struct machine *machine,struct thread *th,bool lock);
@@ -1457,6 +1458,7 @@ int machine__process_mmap_event(struct machine *machine, union perf_event *eventstruct thread *thread;struct map *map;enum map_type type; +u32 prot =0 ;int ret =0 ;if (dump_trace)
@@ -1477,12 +1479,14 @@ int machine__process_mmap_event(struct machine *machine, union perf_event *eventif (event->header.misc &PERF_RECORD_MISC_MMAP_DATA ) type =MAP__VARIABLE ; -else +else { type =MAP__FUNCTION ; + prot =PROT_EXEC ; + } map =map__new (machine, event->mmap.start, event->mmap.len, event->mmap.pgoff, -0 ,0 ,0 ,0 ,0 ,0 , +0 ,0 ,0 ,0 , prot,0 , event->mmap.filename, type, thread);