2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-14 00:04:00 +08:00

perf tools: Check we are able to read the event size on mmap

Check we have enough mmaped space to read the current event
size from its headers, otherwise we may dereference some
hell there.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Stephane Eranian <eranian@google.com>
This commit is contained in:
Frederic Weisbecker 2011-05-21 17:07:24 +02:00
parent c5fc472171
commit eac9eacee1

View File

@ -1007,6 +1007,13 @@ remap:
file_pos = file_offset + head;
more:
/*
* Ensure we have enough space remaining to read
* the size of the event in the headers.
*/
if (head + sizeof(event->header) > mmap_size)
goto remap;
event = (union perf_event *)(buf + head);
if (session->header.needs_swap)