Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 77538612 authored by Jeffrey Vander Stoep's avatar Jeffrey Vander Stoep
Browse files

Revert "BACKPORT: perf_event: Add support for LSM and SELinux checks"



This reverts commit f81151cd.

Reason for revert: collides with aosp/1137243 and breaks build

Change-Id: I6d0216ccaa1a759fb1732c07601f5877b81a5f03
Signed-off-by: default avatarJeff Vander Stoep <jeffv@google.com>
parent 45319d01
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ static inline unsigned long perf_ip_adjust(struct pt_regs *regs)
{
	return 0;
}
static inline void perf_get_data_addr(struct perf_event *event, struct pt_regs *regs, u64 *addrp) { }
static inline void perf_get_data_addr(struct pt_regs *regs, u64 *addrp) { }
static inline u32 perf_get_misc_flags(struct pt_regs *regs)
{
	return 0;
@@ -126,7 +126,7 @@ static unsigned long ebb_switch_in(bool ebb, struct cpu_hw_events *cpuhw)
static inline void power_pmu_bhrb_enable(struct perf_event *event) {}
static inline void power_pmu_bhrb_disable(struct perf_event *event) {}
static void power_pmu_sched_task(struct perf_event_context *ctx, bool sched_in) {}
static inline void power_pmu_bhrb_read(struct perf_event *event, struct cpu_hw_events *cpuhw) {}
static inline void power_pmu_bhrb_read(struct cpu_hw_events *cpuhw) {}
static void pmao_restore_workaround(bool ebb) { }
static bool use_ic(u64 event)
{
@@ -174,7 +174,7 @@ static inline unsigned long perf_ip_adjust(struct pt_regs *regs)
 * pointed to by SIAR; this is indicated by the [POWER6_]MMCRA_SDSYNC, the
 * [POWER7P_]MMCRA_SDAR_VALID bit in MMCRA, or the SDAR_VALID bit in SIER.
 */
static inline void perf_get_data_addr(struct perf_event *event, struct pt_regs *regs, u64 *addrp)
static inline void perf_get_data_addr(struct pt_regs *regs, u64 *addrp)
{
	unsigned long mmcra = regs->dsisr;
	bool sdar_valid;
@@ -435,7 +435,7 @@ static __u64 power_pmu_bhrb_to(u64 addr)
}

/* Processing BHRB entries */
static void power_pmu_bhrb_read(struct perf_event *event, struct cpu_hw_events *cpuhw)
static void power_pmu_bhrb_read(struct cpu_hw_events *cpuhw)
{
	u64 val;
	u64 addr;
@@ -463,7 +463,8 @@ static void power_pmu_bhrb_read(struct perf_event *event, struct cpu_hw_events *
			 * exporting it to userspace (avoid exposure of regions
			 * where we could have speculative execution)
			 */
			if (is_kernel_addr(addr) && perf_allow_kernel(&event->attr) != 0)
			if (perf_paranoid_kernel() && !capable(CAP_SYS_ADMIN) &&
				is_kernel_addr(addr))
				continue;

			/* Branches are read most recent first (ie. mfbhrb 0 is
@@ -2076,12 +2077,12 @@ static void record_and_restart(struct perf_event *event, unsigned long val,

		if (event->attr.sample_type &
		    (PERF_SAMPLE_ADDR | PERF_SAMPLE_PHYS_ADDR))
			perf_get_data_addr(event, regs, &data.addr);
			perf_get_data_addr(regs, &data.addr);

		if (event->attr.sample_type & PERF_SAMPLE_BRANCH_STACK) {
			struct cpu_hw_events *cpuhw;
			cpuhw = this_cpu_ptr(&cpu_hw_events);
			power_pmu_bhrb_read(event, cpuhw);
			power_pmu_bhrb_read(cpuhw);
			data.br_stack = &cpuhw->bhrb_stack;
		}

+3 −5
Original line number Diff line number Diff line
@@ -557,11 +557,9 @@ static int bts_event_init(struct perf_event *event)
	 * Note that the default paranoia setting permits unprivileged
	 * users to profile the kernel.
	 */
	if (event->attr.exclude_kernel) {
		ret = perf_allow_kernel(&event->attr);
		if (ret)
			return ret;
	}
	if (event->attr.exclude_kernel && perf_paranoid_kernel() &&
	    !capable(CAP_SYS_ADMIN))
		return -EACCES;

	if (x86_add_exclusive(x86_lbr_exclusive_bts))
		return -EBUSY;
+2 −3
Original line number Diff line number Diff line
@@ -3087,9 +3087,8 @@ static int intel_pmu_hw_config(struct perf_event *event)
	if (x86_pmu.version < 3)
		return -EINVAL;

	ret = perf_allow_cpu(&event->attr);
	if (ret)
		return ret;
	if (perf_paranoid_cpu() && !capable(CAP_SYS_ADMIN))
		return -EACCES;

	event->hw.config |= ARCH_PERFMON_EVENTSEL_ANY;

+2 −3
Original line number Diff line number Diff line
@@ -776,9 +776,8 @@ static int p4_validate_raw_event(struct perf_event *event)
	 * the user needs special permissions to be able to use it
	 */
	if (p4_ht_active() && p4_event_bind_map[v].shared) {
		v = perf_allow_cpu(&event->attr);
		if (v)
			return v;
		if (perf_paranoid_cpu() && !capable(CAP_SYS_ADMIN))
			return -EACCES;
	}

	/* ESCR EventMask bits may be invalid */
+0 −15
Original line number Diff line number Diff line
@@ -1727,14 +1727,6 @@ union security_list_options {
	int (*bpf_prog_alloc_security)(struct bpf_prog_aux *aux);
	void (*bpf_prog_free_security)(struct bpf_prog_aux *aux);
#endif /* CONFIG_BPF_SYSCALL */
#ifdef CONFIG_PERF_EVENTS
	int (*perf_event_open)(struct perf_event_attr *attr, int type);
	int (*perf_event_alloc)(struct perf_event *event);
	void (*perf_event_free)(struct perf_event *event);
	int (*perf_event_read)(struct perf_event *event);
	int (*perf_event_write)(struct perf_event *event);

#endif
};

struct security_hook_heads {
@@ -1963,13 +1955,6 @@ struct security_hook_heads {
	struct list_head bpf_prog_alloc_security;
	struct list_head bpf_prog_free_security;
#endif /* CONFIG_BPF_SYSCALL */
#ifdef CONFIG_PERF_EVENTS
	struct list_head perf_event_open;
	struct list_head perf_event_alloc;
	struct list_head perf_event_free;
	struct list_head perf_event_read;
	struct list_head perf_event_write;
#endif
} __randomize_layout;

/*
Loading