File tree Expand file tree Collapse file tree 3 files changed +9
-0
lines changed Expand file tree Collapse file tree 3 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -119,6 +119,7 @@ enum lockdown_reason {
119
119
LOCKDOWN_KCORE ,
120
120
LOCKDOWN_KPROBES ,
121
121
LOCKDOWN_BPF_READ ,
122
+ LOCKDOWN_PERF ,
122
123
LOCKDOWN_CONFIDENTIALITY_MAX ,
123
124
};
124
125
Original file line number Diff line number Diff line change @@ -10798,6 +10798,13 @@ SYSCALL_DEFINE5(perf_event_open,
10798
10798
perf_paranoid_kernel () && !capable (CAP_SYS_ADMIN ))
10799
10799
return - EACCES ;
10800
10800
10801
+ err = security_locked_down (LOCKDOWN_PERF );
10802
+ if (err && (attr .sample_type & PERF_SAMPLE_REGS_INTR ))
10803
+ /* REGS_INTR can leak data, lockdown must prevent this */
10804
+ return err ;
10805
+
10806
+ err = 0 ;
10807
+
10801
10808
/*
10802
10809
* In cgroup mode, the pid argument is used to pass the fd
10803
10810
* opened to the cgroup directory in cgroupfs. The cpu argument
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ static char *lockdown_reasons[LOCKDOWN_CONFIDENTIALITY_MAX+1] = {
34
34
[LOCKDOWN_KCORE ] = "/proc/kcore access" ,
35
35
[LOCKDOWN_KPROBES ] = "use of kprobes" ,
36
36
[LOCKDOWN_BPF_READ ] = "use of bpf to read kernel RAM" ,
37
+ [LOCKDOWN_PERF ] = "unsafe use of perf" ,
37
38
[LOCKDOWN_CONFIDENTIALITY_MAX ] = "confidentiality" ,
38
39
};
39
40
You can’t perform that action at this time.
0 commit comments