All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Moore <paul.moore@hp.com>
To: "selinux list" <selinux@tycho.nsa.gov>,
	Stephen Smalley <sds@tycho.nsa.gov>
Cc: Venkat Yekkirala <vyekkirala@TrustedCS.com>,
	James Morris <jmorris@redhat.com>, Eric Paris <eparis@redhat.com>
Subject: [RFC] NetLabel: shift to using SECINITSID_UNLABLED as a base
Date: Thu, 05 Oct 2006 09:38:59 -0400	[thread overview]
Message-ID: <45250AF3.1020304@hp.com> (raw)

This patch changes NetLabel from using SECINITSID_NETMSG and the parent socket's
SID as the for the TE portion of the NetLabel context to now use
SECINITSID_UNLABELED.  This should address the issues brought up yesterday.
Please take a look and let me know if this what you had in mind; if it is
acceptable I'll repost this for inclusion.

This patch is independent of the secid patches and should be treated as a bugfix
for 2.6.19.  A similar patch to deal with the secid case will be coming later today.

Index: net-2.6_bugfix/security/selinux/ss/services.c
===================================================================
--- net-2.6_bugfix.orig/security/selinux/ss/services.c
+++ net-2.6_bugfix/security/selinux/ss/services.c
@@ -2331,7 +2331,7 @@ static int selinux_netlbl_secattr_to_sid
                        selinux_netlbl_cache_add(skb, &ctx_new);
                ebitmap_destroy(&ctx_new.range.level[0].cat);
        } else {
-               *sid = SECINITSID_UNLABELED;
+               *sid = SECSID_NULL;
                rc = 0;
        }

@@ -2514,7 +2514,7 @@ void selinux_netlbl_sock_graft(struct so
        if (netlbl_sock_getattr(sk, &secattr) == 0 &&
            selinux_netlbl_secattr_to_sid(NULL,
                                          &secattr,
-                                         sksec->sid,
+                                         SECINITSID_UNLABELED,
                                          &nlbl_peer_sid) == 0)
                sksec->peer_sid = nlbl_peer_sid;
        netlbl_secattr_destroy(&secattr, 0);
@@ -2547,9 +2547,6 @@ u32 selinux_netlbl_inet_conn_request(str
        if (rc != 0)
                return SECSID_NULL;

-       if (peer_sid == SECINITSID_UNLABELED)
-               return SECSID_NULL;
-
        return peer_sid;
 }

@@ -2611,11 +2608,13 @@ int selinux_netlbl_sock_rcv_skb(struct s
        u32 netlbl_sid;
        u32 recv_perm;

-       rc = selinux_netlbl_skbuff_getsid(skb, SECINITSID_NETMSG, &netlbl_sid);
+       rc = selinux_netlbl_skbuff_getsid(skb,
+                                         SECINITSID_UNLABELED,
+                                         &netlbl_sid);
        if (rc != 0)
                return rc;

-       if (netlbl_sid == SECINITSID_UNLABELED)
+       if (netlbl_sid == SECSID_NULL)
                return 0;

        switch (sksec->sclass) {
@@ -2653,10 +2652,6 @@ int selinux_netlbl_sock_rcv_skb(struct s
 u32 selinux_netlbl_socket_getpeersec_stream(struct socket *sock)
 {
        struct sk_security_struct *sksec = sock->sk->sk_security;
-
-       if (sksec->peer_sid == SECINITSID_UNLABELED)
-               return SECSID_NULL;
-
        return sksec->peer_sid;
 }

@@ -2681,8 +2676,6 @@ u32 selinux_netlbl_socket_getpeersec_dgr
        isec = SOCK_INODE(sk->sk_socket)->i_security;
        if (selinux_netlbl_skbuff_getsid(skb, isec->sid, &peer_sid) != 0)
                return SECSID_NULL;
-       if (peer_sid == SECINITSID_UNLABELED)
-               return SECSID_NULL;

        return peer_sid;
 }

-- 
paul moore
linux security @ hp

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

             reply	other threads:[~2006-10-05 13:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-05 13:38 Paul Moore [this message]
2006-10-05 15:33 ` [RFC] NetLabel: shift to using SECINITSID_UNLABLED as a base Paul Moore
2006-10-05 16:38   ` Paul Moore

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45250AF3.1020304@hp.com \
    --to=paul.moore@hp.com \
    --cc=eparis@redhat.com \
    --cc=jmorris@redhat.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    --cc=vyekkirala@TrustedCS.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.