Skip to content

Commit 8bfbd04

Browse files
cgzonespcmoore
authored andcommitted
selinux: deprecated fs ocon
The object context type `fs`, not to be confused with the well used object context type `fscon`, was introduced in the initial git commit 1da177e4c3f4 ("Linux-2.6.12-rc2") but never actually used since. The paper "A Security Policy Configuration for the Security-Enhanced Linux" [1] mentions it under `7.2 File System Contexts` but also states: Currently, this configuration is unused. The policy statement defining such object contexts is `fscon`, e.g.: fscon 2 3 gen_context(system_u:object_r:conA_t,s0) \ gen_context(system_u:object_r:conB_t,s0) It is not documented at selinuxproject.org or in the SELinux notebook and not supported by the Reference Policy buildsystem - the statement is not properly sorted - and thus not used in the Reference or Fedora Policy. Print a warning message at policy load for each such object context: SELinux: void and deprecated fs ocon 02:03 This topic was initially highlighted by Nicolas Iooss [2]. [1]: https://media.defense.gov/2021/Jul/29/2002815735/-1/-1/0/SELINUX-SECURITY-POLICY-CONFIGURATION-REPORT.PDF [2]: https://lore.kernel.org/selinux/CAJfZ7=mP2eJaq2BfO3y0VnwUJaY2cS2p=HZMN71z1pKjzaT0Eg@mail.gmail.com/ Signed-off-by: Christian Göttsche <cgzones@googlemail.com> [PM: tweaked deprecation comment, description line wrapping] Signed-off-by: Paul Moore <paul@paul-moore.com>
1 parent eb14232 commit 8bfbd04

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

security/selinux/ss/policydb.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2257,6 +2257,10 @@ static int ocontext_read(struct policydb *p, const struct policydb_compat_info *
22572257
if (rc)
22582258
goto out;
22592259

2260+
if (i == OCON_FS)
2261+
pr_warn("SELinux: void and deprecated fs ocon %s\n",
2262+
c->u.name);
2263+
22602264
rc = context_read_and_validate(&c->context[0], p, fp);
22612265
if (rc)
22622266
goto out;

security/selinux/ss/policydb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ struct genfs {
225225

226226
/* object context array indices */
227227
#define OCON_ISID 0 /* initial SIDs */
228-
#define OCON_FS 1 /* unlabeled file systems */
228+
#define OCON_FS 1 /* unlabeled file systems (deprecated) */
229229
#define OCON_PORT 2 /* TCP and UDP port numbers */
230230
#define OCON_NETIF 3 /* network interfaces */
231231
#define OCON_NODE 4 /* nodes */

0 commit comments

Comments
 (0)