]> git.baikalelectronics.ru Git - kernel.git/commit
selinux: permit removing security.selinux xattr before policy load
authorStephen Smalley <stephen.smalley.work@gmail.com>
Thu, 20 Aug 2020 17:00:40 +0000 (13:00 -0400)
committerPaul Moore <paul@paul-moore.com>
Fri, 21 Aug 2020 01:55:31 +0000 (21:55 -0400)
commit30a4e25ace8c4bf9c5cb193ea87550eedfc56111
tree6694cacf7d7ec810637e34ce4473f631a2d05c79
parente099ea743b3d26f42da2202e916fcd97a7338b4f
selinux: permit removing security.selinux xattr before policy load

Currently SELinux denies attempts to remove the security.selinux xattr
always, even when permissive or no policy is loaded.  This was originally
motivated by the view that all files should be labeled, even if that label
is unlabeled_t, and we shouldn't permit files that were once labeled to
have their labels removed entirely.  This however prevents removing
SELinux xattrs in the case where one "disables" SELinux by not loading
a policy (e.g. a system where runtime disable is removed and selinux=0
was not specified).  Allow removing the xattr before SELinux is
initialized.  We could conceivably permit it even after initialization
if permissive, or introduce a separate permission check here.

Signed-off-by: Stephen Smalley <stephen.smalley.work@gmail.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/hooks.c