diff options
-rw-r--r-- | kernel/perf_event.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 6ae6218..ff5d430 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) long user_extra, extra; int ret = 0; + /* + * Don't allow mmap() of inherited per-task counters. This would + * create a performance issue due to all children writing to the + * same buffer. + */ + if (event->cpu == -1 && event->attr.inherit) + return -EINVAL; + if (!(vma->vm_flags & VM_SHARED)) return -EINVAL; |