Linux 5.13 Will Stop Restricting CPU Power Metrics Access For AMD Energy Driver
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.