|
@@ -457,6 +457,16 @@ static void power_pmu_bhrb_read(struct cpu_hw_events *cpuhw)
|
|
|
/* invalid entry */
|
|
|
continue;
|
|
|
|
|
|
+ /*
|
|
|
+ * BHRB rolling buffer could very much contain the kernel
|
|
|
+ * addresses at this point. Check the privileges before
|
|
|
+ * exporting it to userspace (avoid exposure of regions
|
|
|
+ * where we could have speculative execution)
|
|
|
+ */
|
|
|
+ if (perf_paranoid_kernel() && !capable(CAP_SYS_ADMIN) &&
|
|
|
+ is_kernel_addr(addr))
|
|
|
+ continue;
|
|
|
+
|
|
|
/* Branches are read most recent first (ie. mfbhrb 0 is
|
|
|
* the most recent branch).
|
|
|
* There are two types of valid entries:
|