mirror of https://gitee.com/openkylin/linux.git
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 <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Link: https://lkml.kernel.org/n/tip-es3zz9r0q2qlssg4wh1w1d8p@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
af30bffa2f
commit
0f476f2bbc
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include "sane_ctype.h"
|
#include "sane_ctype.h"
|
||||||
#include <symbol/kallsyms.h>
|
#include <symbol/kallsyms.h>
|
||||||
|
#include <linux/mman.h>
|
||||||
|
|
||||||
static void __machine__remove_thread(struct machine *machine, struct thread *th, bool lock);
|
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 *event
|
||||||
struct thread *thread;
|
struct thread *thread;
|
||||||
struct map *map;
|
struct map *map;
|
||||||
enum map_type type;
|
enum map_type type;
|
||||||
|
u32 prot = 0;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (dump_trace)
|
if (dump_trace)
|
||||||
|
@ -1477,12 +1479,14 @@ int machine__process_mmap_event(struct machine *machine, union perf_event *event
|
||||||
|
|
||||||
if (event->header.misc & PERF_RECORD_MISC_MMAP_DATA)
|
if (event->header.misc & PERF_RECORD_MISC_MMAP_DATA)
|
||||||
type = MAP__VARIABLE;
|
type = MAP__VARIABLE;
|
||||||
else
|
else {
|
||||||
type = MAP__FUNCTION;
|
type = MAP__FUNCTION;
|
||||||
|
prot = PROT_EXEC;
|
||||||
|
}
|
||||||
|
|
||||||
map = map__new(machine, event->mmap.start,
|
map = map__new(machine, event->mmap.start,
|
||||||
event->mmap.len, event->mmap.pgoff,
|
event->mmap.len, event->mmap.pgoff,
|
||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, prot, 0,
|
||||||
event->mmap.filename,
|
event->mmap.filename,
|
||||||
type, thread);
|
type, thread);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue