Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20E97C433E2 for ; Tue, 8 Sep 2020 21:27:59 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9CB2A2145D for ; Tue, 8 Sep 2020 21:27:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9CB2A2145D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvdimm-bounces@lists.01.org Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 3B54913C614A6; Tue, 8 Sep 2020 14:27:58 -0700 (PDT) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=192.55.52.120; helo=mga04.intel.com; envelope-from=ira.weiny@intel.com; receiver= Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4C35713C046E7 for ; Tue, 8 Sep 2020 14:27:54 -0700 (PDT) IronPort-SDR: fK5EvxZIaHZqORFq/+OGf2sMNBIHc2CQHLfAuSK+Gu12crzPXs5IIrhamoblU2hxxvMALOqLO9 Yoyyv4K8hvYg== X-IronPort-AV: E=McAfee;i="6000,8403,9738"; a="155628050" X-IronPort-AV: E=Sophos;i="5.76,407,1592895600"; d="scan'208";a="155628050" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Sep 2020 14:27:53 -0700 IronPort-SDR: hwcjq7Pqa0jT08ahd3lviO5aItJ8tdYYEohvQkRbr5SMQYLLE0tI/WJR/vWuSO8HZXglMKmkMe GDGZw9vyLKtw== X-IronPort-AV: E=Sophos;i="5.76,407,1592895600"; d="scan'208";a="299929072" Received: from iweiny-desk2.sc.intel.com (HELO localhost) ([10.3.52.147]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Sep 2020 14:27:52 -0700 Date: Tue, 8 Sep 2020 14:27:52 -0700 From: Ira Weiny To: Vaibhav Jain Subject: Re: [PATCH v2] powerpc/papr_scm: Limit the readability of 'perf_stats' sysfs attribute Message-ID: <20200908212752.GD1930795@iweiny-DESK2.sc.intel.com> References: <20200907110540.21349-1-vaibhav@linux.ibm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200907110540.21349-1-vaibhav@linux.ibm.com> User-Agent: Mutt/1.11.1 (2018-12-01) Message-ID-Hash: PMRIT4K7VCFVYE3UCRPMO4R6FIW4UPFO X-Message-ID-Hash: PMRIT4K7VCFVYE3UCRPMO4R6FIW4UPFO X-MailFrom: ira.weiny@intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: linuxppc-dev@lists.ozlabs.org, linux-nvdimm@lists.01.org, "Aneesh Kumar K . V" , Michael Ellerman X-Mailman-Version: 3.1.1 Precedence: list List-Id: "Linux-nvdimm developer list." Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Mon, Sep 07, 2020 at 04:35:40PM +0530, Vaibhav Jain wrote: > The newly introduced 'perf_stats' attribute uses the default access > mode of 0444 letting non-root users access performance stats of an > nvdimm and potentially force the kernel into issuing large number of > expensive HCALLs. Since the information exposed by this attribute > cannot be cached hence its better to ward of access to this attribute ^^^ off? > from users who don't need to access these performance statistics. > > Hence this patch updates access mode of 'perf_stats' attribute to > be only readable by root users. Generally it is bad form to say "this patch". See 4c here: -- https://www.ozlabs.org/~akpm/stuff/tpp.txt But I'm not picky... :-D With the s/of/off/ change: Reviewed-by: Ira Weiny > > Fixes: 2d02bf835e573 ('powerpc/papr_scm: Fetch nvdimm performance stats from PHYP') > Reported-by: Aneesh Kumar K.V > Signed-off-by: Vaibhav Jain > --- > Change-log: > > v2: > * Instead of checking for perfmon_capable() inside show_perf_stats() > set the attribute as DEVICE_ATTR_ADMIN_RO [ Aneesh ] > * Update patch description > --- > arch/powerpc/platforms/pseries/papr_scm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/powerpc/platforms/pseries/papr_scm.c b/arch/powerpc/platforms/pseries/papr_scm.c > index f439f0dfea7d1..a88a707a608aa 100644 > --- a/arch/powerpc/platforms/pseries/papr_scm.c > +++ b/arch/powerpc/platforms/pseries/papr_scm.c > @@ -822,7 +822,7 @@ static ssize_t perf_stats_show(struct device *dev, > kfree(stats); > return rc ? rc : seq_buf_used(&s); > } > -DEVICE_ATTR_RO(perf_stats); > +DEVICE_ATTR_ADMIN_RO(perf_stats); > > static ssize_t flags_show(struct device *dev, > struct device_attribute *attr, char *buf) > -- > 2.26.2 > _______________________________________________ Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org To unsubscribe send an email to linux-nvdimm-leave@lists.01.org