Linux 5.13 Will Stop Restricting CPU Power Metrics Access For AMD Energy Driver
Written by Michael Larabel in AMD on 11 April 2021 at 12:53 PM EDT. 9 Comments
AMD --
Following the PLATYPUS discovery last year that CPU energy information could be used for possible side channel attacks, the Intel RAPL counters were not only restricted to root but the "amd_energy" driver for exposing CPU energy information on supported Zen series CPUs was also dialed back to root-only in the name of security. Linux 5.13 is introducing a new mechanism so AMD CPUs will be able to still read the energy counters even if not operating as root.

Linux hardware monitoring subsystem (HWMON) maintainer Guenter Roeck authored a change to the AMD_Energy driver and went ahead and committed it on Friday to his hwmon-next tree ahead of the Linux 5.13 merge window opening up later in April. The restricting of energy counters to root privileges as a result of the side-channel attack is "annoying" and so he slightly modified the behavior of the driver. As PLATYPUS relies on quick and accurate energy readings, the approach is to make it.... slightly less accurate.


PLATYPUS was made public last November as using Intel RAPL for a side channel attack. This in turn led the Linux kernel to restricting access to CPU energy counters too root... Quite inconvenient to access compared to other sensors.


What the amd_energy driver is now set to do is to cache energy values for a short and randomized period of time. It's only cached for a very short period of time (the random cache time is calculated as "jiffies + HZ + get_random_int() % HZ") but enough that it should make the energy readings unreliable for a PLATYPUS style side channel attack but still should be accurate enough for normal use-cases of wanting to monitor the real-time AND CPU energy metrics while now restoring the ability to do so as a non-root user.


The amd_energy driver remains principally focused on AMD EPYC processors but hopefully in time the AMD Ryzen processors will be restored to similar level of support with this mainline kernel driver that exposes its metrics via sysfs.


This patch is the one introducing the change in hwmon-next.
Related News
About The Author
Author picture

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter or contacted via MichaelLarabel.com.

Popular News This Week