diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-09-13 11:33:44 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-09-13 11:33:44 -0400 |
commit | 459ec28ab404d7afcd512ce9b855959ad301605a (patch) | |
tree | 5c17a0f919242bafffd29cea65a62139a34c2aeb | |
parent | 1fc35b29b4098aa3bf9fc9acb4c1615d0b5dd95d (diff) |
perf_counter: Allow mmap if paranoid checks are turned off
Before:
$ perf sched record -f sleep 1
Error: failed to mmap with 1 (Operation not permitted)
After:
$ perf sched record -f sleep 1
[ perf record: Captured and wrote 0.095 MB perf.data (~4161 samples) ]
Note, this is only allowed if perfcounter_paranoid is set to
the most permissive (non-default) value of -1.
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | kernel/perf_counter.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c index e0d91fdf0c3..667ab25ad3d 100644 --- a/kernel/perf_counter.c +++ b/kernel/perf_counter.c | |||
@@ -2315,7 +2315,8 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma) | |||
2315 | lock_limit >>= PAGE_SHIFT; | 2315 | lock_limit >>= PAGE_SHIFT; |
2316 | locked = vma->vm_mm->locked_vm + extra; | 2316 | locked = vma->vm_mm->locked_vm + extra; |
2317 | 2317 | ||
2318 | if ((locked > lock_limit) && !capable(CAP_IPC_LOCK)) { | 2318 | if ((locked > lock_limit) && perf_paranoid_tracepoint_raw() && |
2319 | !capable(CAP_IPC_LOCK)) { | ||
2319 | ret = -EPERM; | 2320 | ret = -EPERM; |
2320 | goto unlock; | 2321 | goto unlock; |
2321 | } | 2322 | } |