Skip to content

Commit

Permalink
Confine the pcm service
Browse files Browse the repository at this point in the history
Intel(r) Performance Counter Monitor [1] is an application programming
interface (API) and a set of tools based on the API to monitor
performance and energy metrics of Intel(r) Core(tm), Xeon(r), Atom(tm)
and Xeon Phi(tm) processors. PCM works on Linux, Windows, Mac OS X,
FreeBSD and DragonFlyBSD operating systems.

pcm-sensor-server is a service providing performance counter data
over http in JSON or Prometheus.

[1] https://github.com/intel/pcm
  • Loading branch information
zpytela committed Oct 15, 2024
1 parent cc18c38 commit 9d4bcef
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
10 changes: 9 additions & 1 deletion dist/targeted/modules.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3022,9 +3022,17 @@ systemd-homed = module
#
iiosensorproxy = module

# Layer: system
# Layer: contrib
# Module: powerprofiles
#
# Policy for power-profiles-daemon - power profiles handling over D-Bus
#
powerprofiles = module

# Layer: contrib
# Module: pcm
#
# Policy for pcm - Intel(r) Performance Counter Monitor
#
#
pcm = module
1 change: 1 addition & 0 deletions policy/modules/contrib/pcm.fc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/usr/sbin/pcm-sensor-server -- gen_context(system_u:object_r:pcmsensor_exec_t,s0)
1 change: 1 addition & 0 deletions policy/modules/contrib/pcm.if
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## <summary>Intel Performance Counter Monitor (PCM) Sensor Service</summary>
23 changes: 23 additions & 0 deletions policy/modules/contrib/pcm.te
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
policy_module(pcm, 1.0)
#policy_module(pcmsensor, 1.0)

########################################
#
# Declarations
#

type pcmsensor_t;
type pcmsensor_exec_t;
init_daemon_domain(pcmsensor_t, pcmsensor_exec_t)

permissive pcmsensor_t;

allow pcmsensor_t self:capability { sys_rawio sys_resource };
allow pcmsensor_t self:process { ptrace setrlimit };

kernel_read_proc_files(pcmsensor_t)
kernel_read_debugfs(pcmsensor_t)

dev_rw_cpu_microcode(pcmsensor_t)
# /sys/module/msr/parameters/allow_writes
dev_rw_sysfs(pcmsensor_t)

0 comments on commit 9d4bcef

Please sign in to comment.