aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/perf_event.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 6ae62186dd0c..ff5d430d45a7 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -2593,6 +2593,14 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
2593 long user_extra, extra; 2593 long user_extra, extra;
2594 int ret = 0; 2594 int ret = 0;
2595 2595
2596 /*
2597 * Don't allow mmap() of inherited per-task counters. This would
2598 * create a performance issue due to all children writing to the
2599 * same buffer.
2600 */
2601 if (event->cpu == -1 && event->attr.inherit)
2602 return -EINVAL;
2603
2596 if (!(vma->vm_flags & VM_SHARED)) 2604 if (!(vma->vm_flags & VM_SHARED))
2597 return -EINVAL; 2605 return -EINVAL;
2598 2606