]> git.baikalelectronics.ru Git - kernel.git/commit
perf: Fix mmap() accounting hole
authorPeter Zijlstra <peterz@infradead.org>
Tue, 4 Jun 2013 08:44:21 +0000 (10:44 +0200)
committerIngo Molnar <mingo@kernel.org>
Wed, 19 Jun 2013 10:44:13 +0000 (12:44 +0200)
commit3a5b379f47c8dafa6bda2a9c51954837a7a805f8
tree28226bb0f9c0e8f43e2680f4ca34d76068b88ceb
parentb0a0c23267eb8dad1df47c98a4c6353b33e461d0
perf: Fix mmap() accounting hole

Vince's fuzzer once again found holes. This time it spotted a leak in
the locked page accounting.

When an event had redirected output and its close() was the last
reference to the buffer we didn't have a vm context to undo accounting.

Change the code to destroy the buffer on the last munmap() and detach
all redirected events at that time. This provides us the right context
to undo the vm accounting.

Reported-and-tested-by: Vince Weaver <vincent.weaver@maine.edu>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20130604084421.GI8923@twins.programming.kicks-ass.net
Cc: <stable@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/events/core.c
kernel/events/internal.h