1 policy_module(devices, 1.11.3)
3 ########################################
9 attribute memory_raw_read;
10 attribute memory_raw_write;
11 attribute devices_unconfined_type;
14 # device_t is the type of /dev.
17 fs_associate_tmpfs(device_t)
19 files_mountpoint(device_t)
20 files_associate_tmp(device_t)
22 fs_use_trans devtmpfs gen_context(system_u:object_r:device_t,s0);
25 # Type for /dev/agpgart
28 dev_node(agp_device_t)
31 # Type for /dev/apm_bios
37 # Type for /dev/autofs
40 dev_node(autofs_device_t)
43 dev_node(cardmgr_dev_t)
44 files_tmp_file(cardmgr_dev_t)
47 # clock_device_t is the type of
51 dev_node(clock_device_t)
54 # cpu control devices /dev/cpu/0/*
57 dev_node(cpu_device_t)
63 dev_node(crash_device_t)
65 # for the IBM zSeries z90crypt hardware ssl accelorator
67 dev_node(crypt_device_t)
70 # dlm_misc_device_t is the type of /dev/misc/dlm.*
72 type dlm_control_device_t;
73 dev_node(dlm_control_device_t)
76 dev_node(dri_device_t)
79 dev_node(event_device_t)
82 # Type for framebuffer /dev/fb/*
84 type framebuf_device_t;
85 dev_node(framebuf_device_t)
88 # Type for /dev/ipmi/0
91 dev_node(ipmi_device_t)
97 dev_node(kmsg_device_t)
100 # ksm_device_t is the type of /dev/ksm
103 dev_node(ksm_device_t)
106 # kvm_device_t is the type of
110 dev_node(kvm_device_t)
111 mls_trusted_object(kvm_device_t)
117 dev_node(lirc_device_t)
120 # Type for /dev/mapper/control
122 type loop_control_device_t;
123 dev_node(loop_control_device_t)
126 # Type for /dev/mapper/control
129 dev_node(lvm_control_t)
132 # memory_device_t is the type of /dev/kmem,
133 # /dev/mem and /dev/port.
135 type memory_device_t;
136 dev_node(memory_device_t)
138 neverallow ~{ memory_raw_read devices_unconfined_type } memory_device_t:{ chr_file blk_file } read;
139 neverallow ~{ memory_raw_write devices_unconfined_type } memory_device_t:{ chr_file blk_file } { append write };
142 dev_node(misc_device_t)
145 # A general type for modem devices.
148 dev_node(modem_device_t)
151 # A more general type for mouse devices.
154 dev_node(mouse_device_t)
157 # Type for /dev/cpu/mtrr and /proc/mtrr
160 dev_node(mtrr_device_t)
161 genfscon proc /mtrr gen_context(system_u:object_r:mtrr_device_t,s0)
164 # network control devices
166 type netcontrol_device_t;
167 dev_node(netcontrol_device_t)
170 # null_device_t is the type of /dev/null.
173 dev_node(null_device_t)
174 mls_trusted_object(null_device_t)
175 sid devnull gen_context(system_u:object_r:null_device_t,s0)
178 # Type for /dev/nvram
181 dev_node(nvram_device_t)
187 dev_node(power_device_t)
189 type printer_device_t;
190 dev_node(printer_device_t)
191 mls_file_write_within_range(printer_device_t)
194 # qemu control devices
197 dev_node(qemu_device_t)
200 # random_device_t is the type of /dev/random
202 type random_device_t;
203 dev_node(random_device_t)
205 type scanner_device_t;
206 dev_node(scanner_device_t)
209 # Type for smartcards
211 type smartcard_device_t;
212 dev_node(smartcard_device_t)
215 # Type for sound devices and mixers
218 dev_node(sound_device_t)
221 # sysfs_t is the type for the /sys pseudofs
224 files_mountpoint(sysfs_t)
226 genfscon sysfs / gen_context(system_u:object_r:sysfs_t,s0)
229 allow cpu_online_t sysfs_t:filesystem associate;
230 genfscon sysfs /devices/system/cpu/online gen_context(system_u:object_r:cpu_online_t,s0)
236 dev_node(tpm_device_t)
239 # urandom_device_t is the type of /dev/urandom
241 type urandom_device_t;
242 dev_node(urandom_device_t)
245 # usbfs_t is the type for the /proc/bus/usb pseudofs
247 type usbfs_t alias usbdevfs_t;
248 files_mountpoint(usbfs_t)
249 fs_noxattr_type(usbfs_t)
250 genfscon usbfs / gen_context(system_u:object_r:usbfs_t,s0)
251 genfscon usbdevfs / gen_context(system_u:object_r:usbfs_t,s0)
254 # usb_device_t is the type for /dev/bus/usb/[0-9]+/[0-9]+
257 dev_node(usb_device_t)
260 # usb_device_t is the type for /dev/usbmon
262 type usbmon_device_t;
263 dev_node(usbmon_device_t)
266 # userio_device_t is the type for /dev/uio[0-9]+
268 type userio_device_t;
269 dev_node(userio_device_t)
272 dev_node(v4l_device_t)
275 # vhost_device_t is the type for /dev/vhost-net
278 dev_node(vhost_device_t)
279 mls_trusted_object(vhost_device_t)
281 # Type for vmware devices.
282 type vmware_device_t;
283 dev_node(vmware_device_t)
285 type watchdog_device_t;
286 dev_node(watchdog_device_t)
289 # wireless control devices
291 type wireless_device_t;
292 dev_node(wireless_device_t)
295 dev_node(xen_device_t)
297 type xserver_misc_device_t;
298 dev_node(xserver_misc_device_t)
301 # zero_device_t is the type of /dev/zero.
304 dev_node(zero_device_t)
305 mls_trusted_object(zero_device_t)
307 ########################################
309 # Rules for all device nodes
312 allow device_node device_t:filesystem associate;
314 fs_associate(device_node)
315 fs_associate_tmpfs(device_node)
317 files_associate_tmp(device_node)
319 ########################################
321 # Unconfined access to this module
324 allow devices_unconfined_type self:capability sys_rawio;
325 allow devices_unconfined_type device_node:{ blk_file chr_file lnk_file } *;
326 allow devices_unconfined_type mtrr_device_t:file *;