]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
perf_counter: Allow mmap if paranoid checks are turned off
authorIngo Molnar <mingo@elte.hu>
Sun, 13 Sep 2009 15:33:44 +0000 (17:33 +0200)
committerIngo Molnar <mingo@elte.hu>
Sun, 13 Sep 2009 15:33:44 +0000 (17:33 +0200)
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>
kernel/perf_counter.c

index e0d91fdf0c3cfbb417c6fd94d38f2c5700942815..667ab25ad3d591e42773f8a0c5eb3b86610ec9f0 100644 (file)
@@ -2315,7 +2315,8 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
        lock_limit >>= PAGE_SHIFT;
        locked = vma->vm_mm->locked_vm + extra;
 
-       if ((locked > lock_limit) && !capable(CAP_IPC_LOCK)) {
+       if ((locked > lock_limit) && perf_paranoid_tracepoint_raw() &&
+               !capable(CAP_IPC_LOCK)) {
                ret = -EPERM;
                goto unlock;
        }