| 1 |
Required Permissions |
| 2 |
==================== |
| 3 |
|
| 4 |
The i7z/i7z_rw_registers tools require *write* permissions to |
| 5 |
the machine state registers (msr) via /dev/cpu/*/msr, which usually |
| 6 |
means to run these tools as root. Doing improper stuff with the msr |
| 7 |
can crash your system. |
| 8 |
|
| 9 |
I wouldn't recommend making i7z a setuid root executable - the code is |
| 10 |
too poorly written and giving it setuid permissions may easily result |
| 11 |
in a security hole. |
| 12 |
|
| 13 |
The following instructions should allow one to set permissions for i7z |
| 14 |
to be used by certain normal users. |
| 15 |
|
| 16 |
THESE INSTRUCTIONS COME WITHOUT ANY WARRANTY. |
| 17 |
USE THEM ON YOUR OWN RESPONSIBILITY! |
| 18 |
|
| 19 |
* Add a new system group 'msr' and put a user in there: |
| 20 |
|
| 21 |
# addgroup --system msr |
| 22 |
# adduser <LOGIN> msr |
| 23 |
|
| 24 |
* Load the msr kernel module and set the permissions, this will have |
| 25 |
to be performed after each reboot (or after unloading+reloading the |
| 26 |
msr module). |
| 27 |
|
| 28 |
# modprobe msr |
| 29 |
# chgrp msr /dev/cpu/*/msr |
| 30 |
# chmod 660 /dev/cpu/*/msr |
| 31 |
|
| 32 |
* Accessing the msr device nodes additionally requires the |
| 33 |
CAP_SYS_RAWIO capability. So restrict execution of i7z to |
| 34 |
the 'msr' group and set the capability. getcap/setcap can be found |
| 35 |
in the libcap2-bin package. |
| 36 |
Note: The setcap setting is not persistent over upgrades of the |
| 37 |
i7z package! |
| 38 |
|
| 39 |
# dpkg-statoverride --update --add root msr 0754 /usr/sbin/i7z |
| 40 |
# setcap cap_sys_rawio=ep /usr/sbin/i7z |
| 41 |
|
| 42 |
Now a regular user in the 'msr' group should be able to run i7z. |
| 43 |
|
| 44 |
* Undoing the dpkg-statoverride and setcap later on: |
| 45 |
|
| 46 |
# setcap -r /usr/sbin/i7z |
| 47 |
# dpkg-statoverride --remove /usr/sbin/i7z |