<feed xmlns='http://www.w3.org/2005/Atom'>
<title>lwn.git/security/selinux/netlabel.c, branch v2.6.30.1</title>
<subtitle>Linux kernel documentation tree maintained by Jonathan Corbet</subtitle>
<id>http://mirrors.hust.edu.cn/git/lwn.git/atom?h=v2.6.30.1</id>
<link rel='self' href='http://mirrors.hust.edu.cn/git/lwn.git/atom?h=v2.6.30.1'/>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/'/>
<updated>2009-03-28T04:01:36+00:00</updated>
<entry>
<title>netlabel: Label incoming TCP connections correctly in SELinux</title>
<updated>2009-03-28T04:01:36+00:00</updated>
<author>
<name>Paul Moore</name>
<email>paul.moore@hp.com</email>
</author>
<published>2009-03-27T21:10:34+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=389fb800ac8be2832efedd19978a2b8ced37eb61'/>
<id>urn:sha1:389fb800ac8be2832efedd19978a2b8ced37eb61</id>
<content type='text'>
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 &lt;paul.moore@hp.com&gt;
Acked-by: Casey Schaufler &lt;casey@schaufler-ca.com&gt;
Signed-off-by: James Morris &lt;jmorris@namei.org&gt;
</content>
</entry>
<entry>
<title>selinux: Fix a panic in selinux_netlbl_inode_permission()</title>
<updated>2009-03-01T22:30:04+00:00</updated>
<author>
<name>Paul Moore</name>
<email>paul.moore@hp.com</email>
</author>
<published>2009-02-27T20:00:03+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=d7f59dc4642ce2fc7b79fcd4ec02ffce7f21eb02'/>
<id>urn:sha1:d7f59dc4642ce2fc7b79fcd4ec02ffce7f21eb02</id>
<content type='text'>
Rick McNeal from LSI identified a panic in selinux_netlbl_inode_permission()
caused by a certain sequence of SUNRPC operations.  The problem appears to be
due to the lack of NULL pointer checking in the function; this patch adds the
pointer checks so the function will exit safely in the cases where the socket
is not completely initialized.

Signed-off-by: Paul Moore &lt;paul.moore@hp.com&gt;
Signed-off-by: James Morris &lt;jmorris@namei.org&gt;
</content>
</entry>
<entry>
<title>selinux: Fix the NetLabel glue code for setsockopt()</title>
<updated>2009-02-22T23:05:55+00:00</updated>
<author>
<name>Paul Moore</name>
<email>paul.moore@hp.com</email>
</author>
<published>2009-02-20T21:33:02+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=09c50b4a52c01a1f450b8eec819089e228655bfb'/>
<id>urn:sha1:09c50b4a52c01a1f450b8eec819089e228655bfb</id>
<content type='text'>
At some point we (okay, I) managed to break the ability for users to use the
setsockopt() syscall to set IPv4 options when NetLabel was not active on the
socket in question.  The problem was noticed by someone trying to use the
"-R" (record route) option of ping:

 # ping -R 10.0.0.1
 ping: record route: No message of desired type

The solution is relatively simple, we catch the unlabeled socket case and
clear the error code, allowing the operation to succeed.  Please note that we
still deny users the ability to override IPv4 options on socket's which have
NetLabel labeling active; this is done to ensure the labeling remains intact.

Signed-off-by: Paul Moore &lt;paul.moore@hp.com&gt;
Signed-off-by: James Morris &lt;jmorris@namei.org&gt;
</content>
</entry>
<entry>
<title>selinux: Cache NetLabel secattrs in the socket's security struct</title>
<updated>2008-10-10T14:16:33+00:00</updated>
<author>
<name>Paul Moore</name>
<email>paul.moore@hp.com</email>
</author>
<published>2008-10-10T14:16:33+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=6c5b3fc0147f79d714d2fe748b5869d7892ef2e7'/>
<id>urn:sha1:6c5b3fc0147f79d714d2fe748b5869d7892ef2e7</id>
<content type='text'>
Previous work enabled the use of address based NetLabel selectors, which
while highly useful, brought the potential for additional per-packet overhead
when used.  This patch attempts to mitigate some of that overhead by caching
the NetLabel security attribute struct within the SELinux socket security
structure.  This should help eliminate the need to recreate the NetLabel
secattr structure for each packet resulting in less overhead.

Signed-off-by: Paul Moore &lt;paul.moore@hp.com&gt;
Acked-by: James Morris &lt;jmorris@namei.org&gt;
</content>
</entry>
<entry>
<title>selinux: Set socket NetLabel based on connection endpoint</title>
<updated>2008-10-10T14:16:33+00:00</updated>
<author>
<name>Paul Moore</name>
<email>paul.moore@hp.com</email>
</author>
<published>2008-10-10T14:16:33+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=014ab19a69c325f52d7bae54ceeda73d6307ae0c'/>
<id>urn:sha1:014ab19a69c325f52d7bae54ceeda73d6307ae0c</id>
<content type='text'>
Previous work enabled the use of address based NetLabel selectors, which while
highly useful, brought the potential for additional per-packet overhead when
used.  This patch attempts to solve that by applying NetLabel socket labels
when sockets are connect()'d.  This should alleviate the per-packet NetLabel
labeling for all connected sockets (yes, it even works for connected DGRAM
sockets).

Signed-off-by: Paul Moore &lt;paul.moore@hp.com&gt;
Reviewed-by: James Morris &lt;jmorris@namei.org&gt;
</content>
</entry>
<entry>
<title>netlabel: Add functionality to set the security attributes of a packet</title>
<updated>2008-10-10T14:16:32+00:00</updated>
<author>
<name>Paul Moore</name>
<email>paul.moore@hp.com</email>
</author>
<published>2008-10-10T14:16:32+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=948bf85c1bc9a84754786a9d5dd99b7ecc46451e'/>
<id>urn:sha1:948bf85c1bc9a84754786a9d5dd99b7ecc46451e</id>
<content type='text'>
This patch builds upon the new NetLabel address selector functionality by
providing the NetLabel KAPI and CIPSO engine support needed to enable the
new packet-based labeling.  The only new addition to the NetLabel KAPI at
this point is shown below:

 * int netlbl_skbuff_setattr(skb, family, secattr)

... and is designed to be called from a Netfilter hook after the packet's
IP header has been populated such as in the FORWARD or LOCAL_OUT hooks.

This patch also provides the necessary SELinux hooks to support this new
functionality.  Smack support is not currently included due to uncertainty
regarding the permissions needed to expand the Smack network access controls.

Signed-off-by: Paul Moore &lt;paul.moore@hp.com&gt;
Reviewed-by: James Morris &lt;jmorris@namei.org&gt;
</content>
</entry>
<entry>
<title>selinux: Fix missing calls to netlbl_skbuff_err()</title>
<updated>2008-10-10T14:16:31+00:00</updated>
<author>
<name>Paul Moore</name>
<email>paul.moore@hp.com</email>
</author>
<published>2008-10-10T14:16:31+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=dfaebe9825ff34983778f287101bc5f3bce00640'/>
<id>urn:sha1:dfaebe9825ff34983778f287101bc5f3bce00640</id>
<content type='text'>
At some point I think I messed up and dropped the calls to netlbl_skbuff_err()
which are necessary for CIPSO to send error notifications to remote systems.
This patch re-introduces the error handling calls into the SELinux code.

Signed-off-by: Paul Moore &lt;paul.moore@hp.com&gt;
Acked-by: James Morris &lt;jmorris@namei.org&gt;
</content>
</entry>
<entry>
<title>selinux: Cleanup the NetLabel glue code</title>
<updated>2008-10-10T14:16:29+00:00</updated>
<author>
<name>Paul Moore</name>
<email>paul.moore@hp.com</email>
</author>
<published>2008-10-10T14:16:29+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=accc609322ef5ed44cba6d2d70c741afc76385fb'/>
<id>urn:sha1:accc609322ef5ed44cba6d2d70c741afc76385fb</id>
<content type='text'>
We were doing a lot of extra work in selinux_netlbl_sock_graft() what wasn't
necessary so this patch removes that code.  It also removes the redundant
second argument to selinux_netlbl_sock_setsid() which allows us to simplify a
few other functions.

Signed-off-by: Paul Moore &lt;paul.moore@hp.com&gt;
Acked-by: James Morris &lt;jmorris@namei.org&gt;
</content>
</entry>
<entry>
<title>SELinux: netlabel.c whitespace, syntax, and static declaraction cleanups</title>
<updated>2008-04-21T09:05:04+00:00</updated>
<author>
<name>Eric Paris</name>
<email>eparis@redhat.com</email>
</author>
<published>2008-04-18T21:38:23+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=a6aaafeecca7ea1ddb5d7dac09e468ae14751fcd'/>
<id>urn:sha1:a6aaafeecca7ea1ddb5d7dac09e468ae14751fcd</id>
<content type='text'>
This patch changes netlabel.c to fix whitespace and syntax issues.  Things that
are fixed may include (does not not have to include)

whitespace at end of lines
spaces followed by tabs
spaces used instead of tabs
spacing around parenthesis
locateion of { around struct and else clauses
location of * in pointer declarations
removal of initialization of static data to keep it in the right section
useless {} in if statemetns
useless checking for NULL before kfree
fixing of the indentation depth of switch statements
and any number of other things I forgot to mention

Signed-off-by: Eric Paris &lt;eparis@redhat.com&gt;
Signed-off-by: James Morris &lt;jmorris@namei.org&gt;
</content>
</entry>
<entry>
<title>selinux: selinux/netlabel.c should #include "netlabel.h"</title>
<updated>2008-04-18T10:26:06+00:00</updated>
<author>
<name>Adrian Bunk</name>
<email>bunk@kernel.org</email>
</author>
<published>2008-02-27T21:20:42+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=d4ee4231a3a8731576ef0e0a7e1225e4fde1e659'/>
<id>urn:sha1:d4ee4231a3a8731576ef0e0a7e1225e4fde1e659</id>
<content type='text'>
Every file should include the headers containing the externs for its
global code.

Signed-off-by: Adrian Bunk &lt;bunk@kernel.org&gt;
Acked-by: Paul Moore &lt;paul.moore@hp.com&gt;
Signed-off-by: James Morris &lt;jmorris@namei.org&gt;
</content>
</entry>
</feed>
