lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 06 Nov 2014 12:03:33 +0000
From:	David Howells <dhowells@...hat.com>
To:	Stephen Smalley <sds@...ho.nsa.gov>
Cc:	dhowells@...hat.com, linux-unionfs@...r.kernel.org,
	selinux@...ho.nsa.gov, linux-fsdevel@...r.kernel.org,
	linux-security-module@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 5/7] SELinux: Handle opening of a unioned file

Stephen Smalley <sds@...ho.nsa.gov> wrote:

> How do we know that this union_isid will bear any relation to the actual
> SID assigned to the union inode when it is created?

Note that overlayfs *will* have a union inode at this point, but will just not
use it for non-directories - so in this case we just use the first branch of
the if-statement:

	+	if (inode) {
	+		isec = inode->i_security;
	+		fsec->union_isid = isec->sid;
	+	} ...

in which case, I think that we can be fairly sure that we will have the right
label.

The other two cases are in case there isn't an inode - unionmount, for
example.  The second case is used (if I understand the flag correctly) if the
superblock imposes a single label over all its inodes - so no problem there:

	+	} else if ((sbsec->flags & SE_SBINITIALIZED) &&
	+		   (sbsec->behavior == SECURITY_FS_USE_MNTPOINT)) {
	+		fsec->union_isid = sbsec->mntpoint_sid;
	+	} ...

The third case is the tricky one because we have to try and derive a label.
I've copied the code from the inode creation - so unless the policy changes or
the parent directory inode changes, I would've thought we'd be okay.

> If the union inode does not already exist, when/where does it get created?

For overlayfs, union inodes *have* to exist because it's a filesystem and are
created at the normal times and in the normal way.  They need to exist because
otherwise the dentry at that point in the overlay fs would be negative and the
VFS wouldn't call into the filesystem.

> Also, would be good to create a common helper for use here, by
> selinux_dentry_init_security(), selinux_inode_init_security(), and
> may_create().  Already some seeming potential for inconsistencies there.

Okay, I'll have a look at that.

> > +	return inode_has_perm(cred, file_inode(file), fsec->union_isid, &ad);
> 
> Something is seriously wrong here; you are passing fsec->union_isid
> where we expect a permissions bitmap / access vector.

Good point.  I need to call avc_has_perm() directly.  I don't necessarily have
an sclass, though, hmmm...

David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ