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

Commit 992a8642 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "perf: Skip permission checks on kernel owned perf events"

parents 99ddba49 b05ec5a7
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -3241,16 +3241,18 @@ errout:
 * Returns a matching context with refcount and pincount.
 */
static struct perf_event_context *
find_get_context(struct pmu *pmu, struct task_struct *task, int cpu)
find_get_context(struct perf_event *event, struct task_struct *task, int cpu)
{
	struct perf_event_context *ctx, *clone_ctx = NULL;
	struct perf_cpu_context *cpuctx;
	struct pmu *pmu = event->pmu;
	unsigned long flags;
	int ctxn, err;

	if (!task) {
		/* Must be root to operate on a CPU event: */
		if (perf_paranoid_cpu() && !capable(CAP_SYS_ADMIN))
		if (event->owner != EVENT_OWNER_KERNEL && perf_paranoid_cpu() &&
			!capable(CAP_SYS_ADMIN))
			return ERR_PTR(-EACCES);

		/*
@@ -7415,7 +7417,7 @@ SYSCALL_DEFINE5(perf_event_open,
	/*
	 * Get the target context (task or percpu):
	 */
	ctx = find_get_context(pmu, task, event->cpu);
	ctx = find_get_context(event, task, event->cpu);
	if (IS_ERR(ctx)) {
		err = PTR_ERR(ctx);
		goto err_alloc;
@@ -7584,7 +7586,7 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu,

	account_event(event);

	ctx = find_get_context(event->pmu, task, cpu);
	ctx = find_get_context(event, task, cpu);
	if (IS_ERR(ctx)) {
		err = PTR_ERR(ctx);
		goto err_free;