ChimeraOS / chimeraos

A Steam Big Picture based couch gaming OS
MIT License
1.65k stars 115 forks source link

Fix Intel Processor Power Usage Display on MangoHUD #622

Open ibanezbass opened 1 year ago

ibanezbass commented 1 year ago

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).

pastaq commented 1 year ago

Can you report this to mangohud as well? It's likely they need to fix this in their package.

ibanezbass commented 1 year ago

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.

pastaq commented 1 year ago

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.

SaulGoodman1337 commented 5 months ago

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

DwayneHawkins commented 2 weeks ago

Same here, i tried the chmod thing as sudo, still 0 watt.