alistair23-linux/security/selinux
Jeff Layton 5d50ffd7c3 locks: add new fcntl cmd values for handling file private locks
Due to some unfortunate history, POSIX locks have very strange and
unhelpful semantics. The thing that usually catches people by surprise
is that they are dropped whenever the process closes any file descriptor
associated with the inode.

This is extremely problematic for people developing file servers that
need to implement byte-range locks. Developers often need a "lock
management" facility to ensure that file descriptors are not closed
until all of the locks associated with the inode are finished.

Additionally, "classic" POSIX locks are owned by the process. Locks
taken between threads within the same process won't conflict with one
another, which renders them useless for synchronization between threads.

This patchset adds a new type of lock that attempts to address these
issues. These locks conflict with classic POSIX read/write locks, but
have semantics that are more like BSD locks with respect to inheritance
and behavior on close.

This is implemented primarily by changing how fl_owner field is set for
these locks. Instead of having them owned by the files_struct of the
process, they are instead owned by the filp on which they were acquired.
Thus, they are inherited across fork() and are only released when the
last reference to a filp is put.

These new semantics prevent them from being merged with classic POSIX
locks, even if they are acquired by the same process. These locks will
also conflict with classic POSIX locks even if they are acquired by
the same process or on the same file descriptor.

The new locks are managed using a new set of cmd values to the fcntl()
syscall. The initial implementation of this converts these values to
"classic" cmd values at a fairly high level, and the details are not
exposed to the underlying filesystem. We may eventually want to push
this handing out to the lower filesystem code but for now I don't
see any need for it.

Also, note that with this implementation the new cmd values are only
available via fcntl64() on 32-bit arches. There's little need to
add support for legacy apps on a new interface like this.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
2014-03-31 08:24:43 -04:00
..
include Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security 2014-01-21 09:06:02 -08:00
ss Merge git://git.infradead.org/users/eparis/audit 2014-01-23 18:08:10 -08:00
.gitignore
avc.c selinux: remove 'flags' parameter from avc_audit() 2013-10-04 14:13:25 -07:00
exports.c
hooks.c locks: add new fcntl cmd values for handling file private locks 2014-03-31 08:24:43 -04:00
Kconfig
Makefile
netif.c net: pass info struct via netdevice notifier 2013-05-28 13:11:01 -07:00
netlabel.c selinux: ensure that the cached NetLabel secattr matches the desired SID 2013-12-04 16:08:17 -05:00
netlink.c selinux: replace obsolete NLMSG_* with type safe nlmsg_* 2013-03-28 14:25:49 -04:00
netnode.c selinux: fix problems in netnode when BUG() is compiled out 2013-07-25 13:03:27 -04:00
netport.c
nlmsgtab.c selinux: apply selinux checks on new audit message types 2013-11-05 11:07:35 -05:00
selinuxfs.c Add SELinux policy capability for always checking packet and peer classes. 2013-07-25 13:03:38 -04:00
xfrm.c selinux: look for IPsec labels on both inbound and outbound packets 2013-12-12 17:21:31 -05:00