2 policy_module(devices,1.1.13)
4 ########################################
10 attribute memory_raw_read;
11 attribute memory_raw_write;
12 attribute devices_unconfined_type;
15 # device_t is the type of /dev.
18 fs_associate_tmpfs(device_t)
20 files_mountpoint(device_t)
21 files_associate_tmp(device_t)
23 # Only directories and symlinks should be labeled device_t.
24 # If there are other files with this type, it is wrong.
25 # Relabelto is allowed for setfiles to function, in case
26 # a device node has no specific type yet, but is for some
27 # reason labeled with a specific type
28 #cjp: want this, but udev policy breaks this
29 #neverallow domain device_t:{ file fifo_file sock_file chr_file blk_file } ~{ getattr setattr relabelfrom relabelto };
32 # Type for /dev/agpgart
35 dev_node(agp_device_t)
38 # Type for /dev/apm_bios
44 dev_node(cardmgr_dev_t)
45 files_tmp_file(cardmgr_dev_t)
48 # clock_device_t is the type of
52 dev_node(clock_device_t)
55 # cpu control devices /dev/cpu/0/*
58 dev_node(cpu_device_t)
60 # for the IBM zSeries z90crypt hardware ssl accelorator
62 dev_node(crypt_device_t)
65 dev_node(dri_device_t)
68 dev_node(event_device_t)
71 # Type for framebuffer /dev/fb/*
73 type framebuf_device_t;
74 dev_node(framebuf_device_t)
77 # Type for /dev/mapper/control
80 dev_node(lvm_control_t)
83 # memory_device_t is the type of /dev/kmem,
84 # /dev/mem and /dev/port.
87 dev_node(memory_device_t)
89 neverallow ~{ memory_raw_read devices_unconfined_type } memory_device_t:{ chr_file blk_file } read;
90 neverallow ~{ memory_raw_write devices_unconfined_type } memory_device_t:{ chr_file blk_file } { append write };
93 dev_node(misc_device_t)
96 # A more general type for mouse devices.
99 dev_node(mouse_device_t)
102 # Type for /dev/cpu/mtrr and /proc/mtrr
105 dev_node(mtrr_device_t)
106 genfscon proc /mtrr gen_context(system_u:object_r:mtrr_device_t,s0)
109 # null_device_t is the type of /dev/null.
112 dev_node(null_device_t)
113 mls_trusted_object(null_device_t)
114 sid devnull gen_context(system_u:object_r:null_device_t,s0)
120 dev_node(power_device_t)
122 type printer_device_t;
123 dev_node(printer_device_t)
126 # random_device_t is the type of /dev/random
128 type random_device_t;
129 dev_node(random_device_t)
131 type scanner_device_t;
132 dev_node(scanner_device_t)
135 # Type for sound devices and mixers
138 dev_node(sound_device_t)
141 # sysfs_t is the type for the /sys pseudofs
144 files_mountpoint(sysfs_t)
146 genfscon sysfs / gen_context(system_u:object_r:sysfs_t,s0)
149 # urandom_device_t is the type of /dev/urandom
151 type urandom_device_t;
152 dev_node(urandom_device_t)
155 # usbfs_t is the type for the /proc/bus/usb pseudofs
157 type usbfs_t alias usbdevfs_t;
158 files_mountpoint(usbfs_t)
159 fs_noxattr_type(usbfs_t)
160 genfscon usbfs / gen_context(system_u:object_r:usbfs_t,s0)
161 genfscon usbdevfs / gen_context(system_u:object_r:usbfs_t,s0)
164 # usb_device_t is the type for /dev/bus/usb/[0-9]+/[0-9]+
167 dev_node(usb_device_t)
170 dev_node(v4l_device_t)
172 # Type for vmware devices.
173 type vmware_device_t;
174 dev_node(vmware_device_t)
176 type watchdog_device_t;
177 dev_node(vmware_device_t)
180 dev_node(xen_device_t)
182 type xserver_misc_device_t;
183 dev_node(xserver_misc_device_t)
186 # zero_device_t is the type of /dev/zero.
189 dev_node(zero_device_t)
190 mls_trusted_object(zero_device_t)
192 ########################################
194 # Rules for all device nodes
197 fs_associate(device_node)
198 fs_associate_tmpfs(device_node)
200 files_associate_tmp(device_node)
202 ########################################
204 # Unconfined access to this module
207 allow devices_unconfined_type self:capability sys_rawio;
208 allow devices_unconfined_type device_node:{ blk_file chr_file } *;
209 allow devices_unconfined_type mtrr_device_t:{ dir file } *;