Fix Intel Processor Power Usage Display on MangoHUD
It seems that /sys/class/powercap/intel-rapl:0/energy_uj needs read and execute for all users (o+rx or 555; I think it's set to 400 by default) in order to display the cpu power usage in MangoHUD. Confirmed this on my desktop pc (10700K) and OneXPlayer (1195G7).
Can you report this to mangohud as well? It's likely they need to fix this in their package.
It appears this is a known issue due to a potential security vulnerability. This is in the readme for MangoHUD:
Note: RAPL is currently used for Intel CPUs to show power draw with cpu_power which may be unreadable for non-root users due to [vulnerability](https://platypusattack.com/). The corresponding energy_uj file has to be readable by corresponding user, e.g. by running chmod o+r /sys/class/powercap/intel-rapl\:0/energy_uj as root, else the power shown will be 0 W, though having the file readable may potentially be a security vulnerability persisting until system reboots.
Would making the file readable by the MangoHUD process user still present a security risk?
EDIT: It looks like Intel has patched this vulnerability in 6th gen and new processors.
I'm wondering if we can use a udev rule to solve this. Something like:
ENV{SUBSYSTEM}=="powercap", ACTION=="add|change", MODE="0440", OWNER="root", GROUP="wheel"
in a file 99-powercap.rules should theoretically allow anyone in the "wheel" group to read the file without introducing additional security issues or require polkit/sudoers.
is there any news here? i would also like to have the wattage displayed. But the chmod alone doesn't work - it still says 0 watts