]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/papr_scm: Limit the readability of 'perf_stats' sysfs attribute
authorVaibhav Jain <vaibhav@linux.ibm.com>
Mon, 7 Sep 2020 11:05:40 +0000 (16:35 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 9 Sep 2020 04:44:38 +0000 (14:44 +1000)
commit5a2b276e454b59995d448d293add0c3d6fc980ea
treec4ebb7061c9d75f18c76b5f02da22ac437616117
parenteea837b74d5520a3439ed0d65affe6735d3319a5
powerpc/papr_scm: Limit the readability of 'perf_stats' sysfs attribute

The newly introduced 'perf_stats' attribute uses the default access
mode of 0444, allowing non-root users to access performance stats of
an nvdimm and potentially force the kernel into issuing a large number
of expensive hypercalls. Since the information exposed by this
attribute cannot be cached it is better to ward off access to this
attribute from users who don't need to access to these performance
statistics.

Hence update the access mode of 'perf_stats' attribute to be only
readable by root users.

Fixes: 86e8f83fb22a ("powerpc/papr_scm: Fetch nvdimm performance stats from PHYP")
Reported-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200907110540.21349-1-vaibhav@linux.ibm.com
arch/powerpc/platforms/pseries/papr_scm.c