Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2467423ybl; Mon, 20 Jan 2020 03:33:13 -0800 (PST) X-Google-Smtp-Source: APXvYqw4TxE/WvOImKK8fT+1NVQjbmlRXcl6NgiFiQCP6tPVHmdaB3CntKCJ/rhddMZMR+fNBo2P X-Received: by 2002:aca:d544:: with SMTP id m65mr12626473oig.177.1579519993685; Mon, 20 Jan 2020 03:33:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579519993; cv=none; d=google.com; s=arc-20160816; b=R7Hbmt5I9VLWX2taOYeiVJY0oRcfaQqH9QKgtmdlpea1SbTmt37YQjyMqLmvpgyC22 51+0+7pSpcK3Czh5RH2hwWvbBIM/Dx4gPbyBUpnjsC7piM4oFs5fX56yHVMEQQI+ZMfn rWm7wPiulpxmzllf5d9rjNLc4FGnUxUW9yoEodMk/Q+zUqeXxyj7lUFfc6GwDbwJWTfy +AD0aHXiw232CBJqQYPrUBqWgu+ytG8RRBp5y/BhI8Z78np/RwDpSF6YKUFE0bn1xq0w rXgn2DUvA8IuvQaz0orL9uVIyBJwRcp3QH+X/tQ9JM9jzEryq2xGtu5KeKUbPqUgsuI5 X6hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:references:cc:to:from:subject; bh=/+QtVnxz+SNK4wlCaWhK8vsGQ4j78mSzvk3qHcEjo34=; b=BIpPYe09dOLZ4EvUBNWSaSCvWczdS8bjhyrAa2YkRvBasRttVJJTTWpuSDNsj0CMaN f4fUnvhDBtqPT0JdYFD/ZqIQjQfNGMImfNNcL+iE9mJPZJB87hOhhvoNvb0nCszMF5vr qdGKt442XjSCUiAlRQ7fY8cLD4IkFjyGrRabW61NChO5yaIBWW1ZtIcrwoDYhFMCNh0c CMPFHo3V10w7wUCNCOB4lVP1EReqY/tP18MUg/sn37mKBR7EQW+whtzOTJSCFOGDte00 tk/WLXS5K2k5iixjRfwGlj3IHhyM8Sonsh3Yn8bdLl/Cwf1zIvIqT5y1pHKDbQgbb01l g/eg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s68si18950950oih.275.2020.01.20.03.33.00; Mon, 20 Jan 2020 03:33:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727065AbgATLbD (ORCPT + 99 others); Mon, 20 Jan 2020 06:31:03 -0500 Received: from mga09.intel.com ([134.134.136.24]:59161 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726589AbgATLbC (ORCPT ); Mon, 20 Jan 2020 06:31:02 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jan 2020 03:31:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,341,1574150400"; d="scan'208";a="244381648" Received: from linux.intel.com ([10.54.29.200]) by orsmga002.jf.intel.com with ESMTP; 20 Jan 2020 03:31:01 -0800 Received: from [10.125.252.193] (abudanko-mobl.ccr.corp.intel.com [10.125.252.193]) by linux.intel.com (Postfix) with ESMTP id 8C6D05802C1; Mon, 20 Jan 2020 03:30:52 -0800 (PST) Subject: [PATCH v5 07/10] powerpc/perf: open access for CAP_PERFMON privileged process From: Alexey Budankov To: Peter Zijlstra , Arnaldo Carvalho de Melo , Ingo Molnar , "jani.nikula@linux.intel.com" , "joonas.lahtinen@linux.intel.com" , "rodrigo.vivi@intel.com" , "benh@kernel.crashing.org" , Paul Mackerras , Michael Ellerman , "james.bottomley@hansenpartnership.com" , Serge Hallyn , James Morris , Will Deacon , Mark Rutland , Robert Richter , Alexei Starovoitov Cc: Jiri Olsa , Andi Kleen , Stephane Eranian , Igor Lubashev , Alexander Shishkin , Namhyung Kim , Song Liu , Lionel Landwerlin , Thomas Gleixner , linux-kernel , "linux-security-module@vger.kernel.org" , "selinux@vger.kernel.org" , "intel-gfx@lists.freedesktop.org" , "linux-parisc@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , linux-arm-kernel@lists.infradead.org, "linux-perf-users@vger.kernel.org" , oprofile-list@lists.sf.net References: <0548c832-7f4b-dc4c-8883-3f2b6d351a08@linux.intel.com> Organization: Intel Corp. Message-ID: Date: Mon, 20 Jan 2020 14:30:51 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <0548c832-7f4b-dc4c-8883-3f2b6d351a08@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Open access to monitoring for CAP_PERFMON privileged processes. For backward compatibility reasons access to the monitoring remains open for CAP_SYS_ADMIN privileged processes but CAP_SYS_ADMIN usage for secure monitoring is discouraged with respect to CAP_PERFMON capability. Providing the access under CAP_PERFMON capability singly, without the rest of CAP_SYS_ADMIN credentials, excludes chances to misuse the credentials and makes the operations more secure. Signed-off-by: Alexey Budankov --- arch/powerpc/perf/imc-pmu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c index cb50a9e1fd2d..e837717492e4 100644 --- a/arch/powerpc/perf/imc-pmu.c +++ b/arch/powerpc/perf/imc-pmu.c @@ -898,7 +898,7 @@ static int thread_imc_event_init(struct perf_event *event) if (event->attr.type != event->pmu->type) return -ENOENT; - if (!capable(CAP_SYS_ADMIN)) + if (!perfmon_capable()) return -EACCES; /* Sampling not supported */ @@ -1307,7 +1307,7 @@ static int trace_imc_event_init(struct perf_event *event) if (event->attr.type != event->pmu->type) return -ENOENT; - if (!capable(CAP_SYS_ADMIN)) + if (!perfmon_capable()) return -EACCES; /* Return if this is a couting event */ -- 2.20.1