|
@@ -495,6 +495,19 @@ static int bts_event_init(struct perf_event *event)
|
|
if (x86_add_exclusive(x86_lbr_exclusive_bts))
|
|
if (x86_add_exclusive(x86_lbr_exclusive_bts))
|
|
return -EBUSY;
|
|
return -EBUSY;
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
+ * BTS leaks kernel addresses even when CPL0 tracing is
|
|
|
|
+ * disabled, so disallow intel_bts driver for unprivileged
|
|
|
|
+ * users on paranoid systems since it provides trace data
|
|
|
|
+ * to the user in a zero-copy fashion.
|
|
|
|
+ *
|
|
|
|
+ * Note that the default paranoia setting permits unprivileged
|
|
|
|
+ * users to profile the kernel.
|
|
|
|
+ */
|
|
|
|
+ if (event->attr.exclude_kernel && perf_paranoid_kernel() &&
|
|
|
|
+ !capable(CAP_SYS_ADMIN))
|
|
|
|
+ return -EACCES;
|
|
|
|
+
|
|
ret = x86_reserve_hardware();
|
|
ret = x86_reserve_hardware();
|
|
if (ret) {
|
|
if (ret) {
|
|
x86_del_exclusive(x86_lbr_exclusive_bts);
|
|
x86_del_exclusive(x86_lbr_exclusive_bts);
|