[PATCH] powerpc/papr_scm: Make access mode of 'perf_stats' attribute file to '0400'

Vaibhav Jain vaibhav at linux.ibm.com
Wed Aug 12 17:36:14 AEST 2020


Hi Mpe,

Thanks for reviewing this patch. My responses below:

Michael Ellerman <mpe at ellerman.id.au> writes:

> Vaibhav Jain <vaibhav at linux.ibm.com> writes:
>> 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
>> from non-root users.
>>
>> Hence this patch updates the access-mode of 'perf_stats' sysfs
>> attribute file to 0400 to make it only readable to root-users.
>
> Or should we ratelimit it?
Ideal consumers of this data will be users with CAP_PERFMON or
CAP_SYS_ADMIN. Also they need up-to-date values for these performance stats
as these values can be time sensitive.

So rate limiting may not be a complete solution since a user running
'perf' might be throttled by another user who is simply reading the
sysfs file contents.

So instead of setting attribute mode to 0400, will add a check for
'perfmon_capable()' in perf_stats_show() denying read access to users
without CAP_PERFMON or CAP_SYS_ADMIN.


> Fixes: ??
Right. I will add this in v2.

>
>> Reported-by: Aneesh Kumar K.V <aneesh.kumar at linux.ibm.com>
>> Signed-off-by: Vaibhav Jain <vaibhav at linux.ibm.com>
>
> cheers
>

-- 
Cheers
~ Vaibhav


More information about the Linuxppc-dev mailing list