Re: [PATCH 7/8] SELinux: Create a common helper to determine an inode label

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/18/2015 11:13 AM, David Howells wrote:
> Stephen Smalley <sds@xxxxxxxxxxxxx> wrote:
> 
>>> +	if ((sbsec->flags & SE_SBINITIALIZED) &&
>>> +		   (sbsec->behavior == SECURITY_FS_USE_MNTPOINT)) {
>>> +		*_new_isid = sbsec->mntpoint_sid;
>>> +	} else if (tsec->create_sid) {
>>
>> This doesn't quite match the logic in inode_init_security today, see its
>> checking of SBLABEL_MNT.
> 
> Fair point.  What does SBLABEL_MNT mean precisely?  It seems to indicate one
> of an odd mix of behaviours.  I presume it means that we *have* to calculate a
> label and can't get one from the underlying fs if it is not set.

It means the filesystem supports per-file labeling and you can use
setxattr(..."security.selinux") and setfscreatecon() for files on it.
You can see whether it is set on a filesystem by looking for the
seclabel option in cat /proc/mounts.  If it is not set, then we ignore
tsec->create_sid.  It is arguable as to whether it is correct to always
call security_transition_sid() there either, but that's another topic.

> 
> Also, in:
> 
> 	sbsec->flags |= SE_SBINITIALIZED;
> 	if (selinux_is_sblabel_mnt(sb))
> 		sbsec->flags |= SBLABEL_MNT;
> 
> should SE_SBINITIALIZED be set after SBLABEL_MNT?  And should there be a
> memory barrier in here somewhere before the setting of SE_SBINITIALIZED?

I believe that's all under sbsec->lock held by the caller, but that code
has changed a lot and been refactored significantly by others.



--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux