mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-10 11:30:08 +01: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 <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Stephane Eranian <[email protected]>
This commit is contained in:
1 parent
c5fc472171
commit
eac9eacee1
1 file changed
+7
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user