android_kernel_samsung_msm8976/net/netlabel
Paul Moore 389fb800ac netlabel: Label incoming TCP connections correctly in SELinux
The current NetLabel/SELinux behavior for incoming TCP connections works but
only through a series of happy coincidences that rely on the limited nature of
standard CIPSO (only able to convey MLS attributes) and the write equality
imposed by the SELinux MLS constraints.  The problem is that network sockets
created as the result of an incoming TCP connection were not on-the-wire
labeled based on the security attributes of the parent socket but rather based
on the wire label of the remote peer.  The issue had to do with how IP options
were managed as part of the network stack and where the LSM hooks were in
relation to the code which set the IP options on these newly created child
sockets.  While NetLabel/SELinux did correctly set the socket's on-the-wire
label it was promptly cleared by the network stack and reset based on the IP
options of the remote peer.

This patch, in conjunction with a prior patch that adjusted the LSM hook
locations, works to set the correct on-the-wire label format for new incoming
connections through the security_inet_conn_request() hook.  Besides the
correct behavior there are many advantages to this change, the most significant
is that all of the NetLabel socket labeling code in SELinux now lives in hooks
which can return error codes to the core stack which allows us to finally get
ride of the selinux_netlbl_inode_permission() logic which greatly simplfies
the NetLabel/SELinux glue code.  In the process of developing this patch I
also ran into a small handful of AF_INET6 cleanliness issues that have been
fixed which should make the code safer and easier to extend in the future.

Signed-off-by: Paul Moore <paul.moore@hp.com>
Acked-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: James Morris <jmorris@namei.org>
2009-03-28 15:01:36 +11:00
..
Kconfig [NETLABEL]: Fix build failure. 2006-11-05 16:44:06 -08:00
Makefile netlabel: Add a generic way to create ordered linked lists of network addrs 2008-10-10 10:16:32 -04:00
netlabel_addrlist.c net: replace NIPQUAD() in net/*/ 2008-10-31 00:54:56 -07:00
netlabel_addrlist.h netlabel: Fix compilation warnings in net/netlabel/netlabel_addrlist.c 2008-10-30 10:44:48 -04:00
netlabel_cipso_v4.c netlabel: Update kernel configuration API 2008-12-31 12:54:11 -05:00
netlabel_cipso_v4.h netlabel: Add configuration support for local labeling 2008-10-10 10:16:34 -04:00
netlabel_domainhash.c netlabel: Update kernel configuration API 2008-12-31 12:54:11 -05:00
netlabel_domainhash.h netlabel: Update kernel configuration API 2008-12-31 12:54:11 -05:00
netlabel_kapi.c netlabel: Label incoming TCP connections correctly in SELinux 2009-03-28 15:01:36 +11:00
netlabel_mgmt.c net: remove redundant argument comments 2008-11-21 17:15:03 -08:00
netlabel_mgmt.h netlabel: Add network address selectors to the NetLabel/LSM domain mapping 2008-10-10 10:16:32 -04:00
netlabel_unlabeled.c netlabel: Update kernel configuration API 2008-12-31 12:54:11 -05:00
netlabel_unlabeled.h netlabel: Update kernel configuration API 2008-12-31 12:54:11 -05:00
netlabel_user.c Audit: collect sessionid in netlink messages 2008-04-28 06:18:03 -04:00
netlabel_user.h Audit: collect sessionid in netlink messages 2008-04-28 06:18:03 -04:00