lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Fri, 5 Feb 2016 14:02:08 +0000 From: Wang Nan <wangnan0@...wei.com> To: Alexei Starovoitov <ast@...nel.org>, Arnaldo Carvalho de Melo <acme@...hat.com>, Arnaldo Carvalho de Melo <acme@...nel.org>, Brendan Gregg <brendan.d.gregg@...il.com> CC: Adrian Hunter <adrian.hunter@...el.com>, Cody P Schafer <dev@...yps.com>, "David S. Miller" <davem@...emloft.net>, He Kuang <hekuang@...wei.com>, Jérémie Galarneau <jeremie.galarneau@...icios.com>, Jiri Olsa <jolsa@...nel.org>, Kirill Smelkov <kirr@...edi.com>, Li Zefan <lizefan@...wei.com>, Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>, Namhyung Kim <namhyung@...nel.org>, Peter Zijlstra <peterz@...radead.org>, <pi3orama@....com>, Wang Nan <wangnan0@...wei.com>, <linux-kernel@...r.kernel.org> Subject: [PATCH 43/54] perf record: Don't read from and poll overwrite channel Reading from overwritable ring buffer is unreliable. Introduce record__mmap_should_read() and prevent reading from overwrite ring buffer in 'perf record'. The rule in record__mmap_should_read() will be changed when perf support reading from backward writing ring buffer. Signed-off-by: Wang Nan <wangnan0@...wei.com> Signed-off-by: He Kuang <hekuang@...wei.com> Cc: Arnaldo Carvalho de Melo <acme@...hat.com> Cc: Jiri Olsa <jolsa@...nel.org> Cc: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com> Cc: Namhyung Kim <namhyung@...nel.org> Cc: Zefan Li <lizefan@...wei.com> Cc: pi3orama@....com --- tools/perf/builtin-record.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 53bfe55..503eee9 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -461,6 +461,19 @@ static struct perf_event_header finished_round_event = { .type = PERF_RECORD_FINISHED_ROUND, }; +static bool record__mmap_should_read(struct record *rec, int idx) +{ + int channel = -1; + + if (!rec->evlist->mmap[idx].base) + return false; + if (perf_evlist__channel_idx(rec->evlist, &channel, &idx)) + return false; + if (perf_evlist__channel_check(rec->evlist, channel, RDONLY)) + return false; + return true; +} + static int record__mmap_read_all(struct record *rec) { u64 bytes_written = rec->bytes_written; @@ -471,7 +484,7 @@ static int record__mmap_read_all(struct record *rec) for (i = 0; i < total_mmaps; i++) { struct auxtrace_mmap *mm = &rec->evlist->mmap[i].auxtrace_mmap; - if (rec->evlist->mmap[i].base) { + if (record__mmap_should_read(rec, i)) { if (record__mmap_read(rec, i) != 0) { rc = -1; goto out; -- 1.8.3.4
Powered by blists - more mailing lists