Skip to content

Commit 3d2195c

Browse files
eparisJames Morris
authored andcommitted
SELinux: do not check open perms if they are not known to policy
When I introduced open perms policy didn't understand them and I implemented them as a policycap. When I added the checking of open perm to truncate I forgot to conditionalize it on the userspace defined policy capability. Running an old policy with a new kernel will not check open on open(2) but will check it on truncate. Conditionalize the truncate check the same as the open check. Signed-off-by: Eric Paris <eparis@redhat.com> Cc: stable@vger.kernel.org # 3.4.x Signed-off-by: James Morris <james.l.morris@oracle.com>
1 parent 64919e6 commit 3d2195c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

security/selinux/hooks.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2717,7 +2717,7 @@ static int selinux_inode_setattr(struct dentry *dentry, struct iattr *iattr)
27172717
ATTR_ATIME_SET | ATTR_MTIME_SET | ATTR_TIMES_SET))
27182718
return dentry_has_perm(cred, dentry, FILE__SETATTR);
27192719

2720-
if (ia_valid & ATTR_SIZE)
2720+
if (selinux_policycap_openperm && (ia_valid & ATTR_SIZE))
27212721
av |= FILE__OPEN;
27222722

27232723
return dentry_has_perm(cred, dentry, av);

0 commit comments

Comments
 (0)