From: Stephen Smalley Date: Wed, 9 Nov 2005 05:34:32 +0000 (-0800) Subject: [PATCH] selinux: MLS compatibility X-Git-Tag: firefly_0821_release~40516 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e517a0cd859ae0c4d9451107113fc2b076456f8f;p=firefly-linux-kernel-4.4.55.git [PATCH] selinux: MLS compatibility This patch enables files created on a MLS-enabled SELinux system to be accessible on a non-MLS SELinux system, by skipping the MLS component of the security context in the non-MLS case. Signed-off-by: Stephen Smalley Signed-off-by: James Morris Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/security/selinux/ss/mls.c b/security/selinux/ss/mls.c index aaefac2921f1..640d0bfdbc68 100644 --- a/security/selinux/ss/mls.c +++ b/security/selinux/ss/mls.c @@ -262,8 +262,11 @@ int mls_context_to_sid(char oldc, struct cat_datum *catdatum, *rngdatum; int l, rc = -EINVAL; - if (!selinux_mls_enabled) + if (!selinux_mls_enabled) { + if (def_sid != SECSID_NULL && oldc) + *scontext += strlen(*scontext); return 0; + } /* * No MLS component to the security context, try and map to