summaryrefslogtreecommitdiff
path: root/kernel/events/internal.h
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2013-06-04 10:44:21 +0200
committerIngo Molnar <mingo@kernel.org>2013-06-19 12:44:13 +0200
commit9bb5d40cd93c9dd4be74834b1dcb1ba03629716b (patch)
tree28226bb0f9c0e8f43e2680f4ca34d76068b88ceb /kernel/events/internal.h
parent26cb63ad11e04047a64309362674bcbbd6a6f246 (diff)
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>
Diffstat (limited to 'kernel/events/internal.h')
-rw-r--r--kernel/events/internal.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/events/internal.h b/kernel/events/internal.h
index 5bc6c8e9b851..ca6599723be5 100644
--- a/kernel/events/internal.h
+++ b/kernel/events/internal.h
@@ -31,7 +31,8 @@ struct ring_buffer {
spinlock_t event_lock;
struct list_head event_list;
- int mmap_locked;
+ atomic_t mmap_count;
+ unsigned long mmap_locked;
struct user_struct *mmap_user;
struct perf_event_mmap_page *user_page;