From: Gary Tierney Date: Mon, 9 Jan 2017 15:07:32 +0000 (-0500) Subject: selinux: default to security isid in sel_make_bools() if no sid is found X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=900fde06cb9d27625fec4f5cabd7f5462adc79fb;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git selinux: default to security isid in sel_make_bools() if no sid is found Use SECINITSID_SECURITY as the default SID for booleans which don't have a matching SID returned from security_genfs_sid(), also update the error message to a warning which matches this. This prevents the policy failing to load (and consequently the system failing to boot) when there is no default genfscon statement matched for the selinuxfs in the new policy. Signed-off-by: Gary Tierney Acked-by: Stephen Smalley Signed-off-by: Paul Moore --- diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index 7672b61d6673..c354807381c1 100644 --- a/security/selinux/selinuxfs.c +++ b/security/selinux/selinuxfs.c @@ -1311,9 +1311,9 @@ static int sel_make_bools(void) isec = (struct inode_security_struct *)inode->i_security; ret = security_genfs_sid("selinuxfs", page, SECCLASS_FILE, &sid); if (ret) { - pr_err("SELinux: failed to lookup sid for %s\n", page); - goto out; - + pr_warn_ratelimited("SELinux: no sid found, defaulting to security isid for %s\n", + page); + sid = SECINITSID_SECURITY; } isec->sid = sid;