Skip to content

Commit 19f6d91

Browse files
lenbgregkh
authored andcommitted
powercap: restrict energy meter to root access
commit 949dd01 upstream. Remove non-privileged user access to power data contained in /sys/class/powercap/intel-rapl*/*/energy_uj Non-privileged users currently have read access to power data and can use this data to form a security attack. Some privileged drivers/applications need read access to this data, but don't expose it to non-privileged users. For example, thermald uses this data to ensure that power management works correctly. Thus removing non-privileged access is preferred over completely disabling this power reporting capability with CONFIG_INTEL_RAPL=n. Fixes: 95677a9 ("PowerCap: Fix mode for energy counter") Signed-off-by: Len Brown <len.brown@intel.com> Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ec9c6b4 commit 19f6d91

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/powercap/powercap_sys.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,9 @@ static void create_power_zone_common_attributes(
367367
&dev_attr_max_energy_range_uj.attr;
368368
if (power_zone->ops->get_energy_uj) {
369369
if (power_zone->ops->reset_energy_uj)
370-
dev_attr_energy_uj.attr.mode = S_IWUSR | S_IRUGO;
370+
dev_attr_energy_uj.attr.mode = S_IWUSR | S_IRUSR;
371371
else
372-
dev_attr_energy_uj.attr.mode = S_IRUGO;
372+
dev_attr_energy_uj.attr.mode = S_IRUSR;
373373
power_zone->zone_dev_attrs[count++] =
374374
&dev_attr_energy_uj.attr;
375375
}

0 commit comments

Comments
 (0)