@@ -184,16 +184,17 @@ The *genfscon* statement is used to allocate a security context to
184
184
filesystems that cannot support any of the other file labeling
185
185
statements (* fs_use_xattr* , * fs_use_task* or * fs_use_trans* ). Generally
186
186
a filesystem would have a single default security context assigned by
187
- * genfscon* from the root (/) that would then be inherited by all files and
188
- directories on that filesystem. The exception to this is the * /proc*
189
- filesystem, where directories can be labeled with a specific security
190
- context (as shown in the examples). Note that there is no terminating
191
- semi-colon on this statement.
187
+ * genfscon* from the root (* /* ) that would then be inherited by all files and
188
+ directories on that filesystem. File entries can be, if supported by the
189
+ underlying filesystem, labeled with a specific security context (as shown in
190
+ the examples), which is useful for pseudo filesystems exporting kernel state
191
+ (e.g. * proc* , * sysfs* , * cgroup2* , * securityfs* , * selinuxfs* ).
192
+ Note that there is no terminating semi-colon on this statement.
192
193
193
194
** The statement definition is:**
194
195
195
196
```
196
- genfscon fs_name partial_path fs_context
197
+ genfscon fs_name partial_path [filetype_specifier] fs_context
197
198
```
198
199
199
200
** Where:**
@@ -208,8 +209,23 @@ The filesystem name.
208
209
209
210
* partial_path*
210
211
211
- If * fs_name* is * proc* , then the partial path (see the examples). For all other
212
- types, this must be * /* .
212
+ If * fs_name* is a virtual kernel filesystem, then the partial path (see the
213
+ examples). For all other types, this must be * /* .
214
+
215
+ * filetype_specifier*
216
+
217
+ Optional filetype specifier to apply the context only to a specific file type.
218
+ Valid specifiers are:
219
+
220
+ - * -b* block device
221
+ - * -c* character device
222
+ - * -d* directory
223
+ - * -p* named pipe
224
+ - * -l* symbolic link
225
+ - * -s* socket
226
+ - * --* regular file
227
+
228
+ If omitted the context applies to all file types.
213
229
214
230
* fs_context*
215
231
@@ -241,14 +257,20 @@ genfscon selinuxfs / system_u:object_r:security_t:s0
241
257
```
242
258
243
259
```
244
- # The following show some example /proc entries. Note that the
245
- # /kmsg has the highest sensitivity level assigned (s15) because
246
- # it is a trusted process.
260
+ # The following examples show pseudo kernel filesystem entries. Note that
261
+ # the /kmsg has the highest sensitivity level assigned (s15) because
262
+ # it is a file containing possibly sensitive information.
263
+
264
+ genfscon cgroup2 "/user.slice" -d system_u:object_r:cgroup_user_slice_t:s0
247
265
248
266
genfscon proc / system_u:object_r:proc_t:s0
249
267
genfscon proc /sysvipc system_u:object_r:proc_t:s0
250
268
genfscon proc /fs/openafs system_u:object_r:proc_afs_t:s0
251
269
genfscon proc /kmsg system_u:object_r:proc_kmsg_t:s15:c0.c255
270
+
271
+ genfscon selinuxfs /booleans/secure_mode_policyload -- system_u:object_r:secure_mode_policyload_boolean_t:s0
272
+
273
+ genfscon sysfs /devices/system/cpu/online -- system_u:object_r:cpu_online_sysfs_t:s0
252
274
```
253
275
254
276
<!-- %CUTHERE% -->
0 commit comments