Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 158299
b: refs/heads/master
c: 0fbdea1
h: refs/heads/master
i:
  158297: 59472d4
  158295: 53c61b3
v: v3
  • Loading branch information
Ingo Molnar committed Sep 2, 2009
1 parent 741ace9 commit e9e34a5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f76bd108e5031202bb40849306f98c4afebe4ef6
refs/heads/master: 0fbdea19e9394a5cb5f2f5081b028c50b558910a
13 changes: 10 additions & 3 deletions trunk/kernel/perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,18 @@ static atomic_t nr_task_counters __read_mostly;

/*
* perf counter paranoia level:
* 0 - not paranoid
* 1 - disallow cpu counters to unpriv
* 2 - disallow kernel profiling to unpriv
* -1 - not paranoid at all
* 0 - disallow raw tracepoint access for unpriv
* 1 - disallow cpu counters for unpriv
* 2 - disallow kernel profiling for unpriv
*/
int sysctl_perf_counter_paranoid __read_mostly = 1;

static inline bool perf_paranoid_tracepoint_raw(void)
{
return sysctl_perf_counter_paranoid > -1;
}

static inline bool perf_paranoid_cpu(void)
{
return sysctl_perf_counter_paranoid > 0;
Expand Down Expand Up @@ -3971,6 +3977,7 @@ static const struct pmu *tp_perf_counter_init(struct perf_counter *counter)
* have these.
*/
if ((counter->attr.sample_type & PERF_SAMPLE_RAW) &&
perf_paranoid_tracepoint_raw() &&
!capable(CAP_SYS_ADMIN))
return ERR_PTR(-EPERM);

Expand Down

0 comments on commit e9e34a5

Please sign in to comment.