From: Paul Moore <paul.moore@hp.com>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: netdev@vger.kernel.org, selinux@tycho.nsa.gov, jmorris@namei.org,
eparis@redhat.com
Subject: Re: [PATCH v2 1/1] NetLabel: secid reconciliation support
Date: Mon, 02 Oct 2006 15:39:21 -0400 [thread overview]
Message-ID: <45216AE9.8060305@hp.com> (raw)
In-Reply-To: <1159817041.6855.150.camel@moss-spartans.epoch.ncsc.mil>
Stephen Smalley wrote:
> On Mon, 2006-10-02 at 14:06 -0400, paul.moore@hp.com wrote:
>
>>plain text document attachment (netlabel-secid_support)
>>This patch provides the missing NetLabel support to the secid reconciliation
>>patchset.
>>
>>Signed-off-by: Paul Moore <paul.moore@hp.com>
>>---
>> security/selinux/hooks.c | 67 +++++++++++------
>> security/selinux/include/objsec.h | 1
>> security/selinux/include/selinux_netlabel.h | 28 +++----
>> security/selinux/ss/services.c | 106 ++++++++++------------------
>> 4 files changed, 98 insertions(+), 104 deletions(-)
>
>
>>@@ -3725,7 +3723,16 @@ static int selinux_skb_flow_in(struct sk
>> if (xfrm_sid)
>> skb->secmark = xfrm_sid;
>>
>>- /* See if NetLabel can flow in thru the current secmark here */
>>+ err = selinux_netlbl_skb_sid(skb, skb->secmark, &nlbl_sid);
>>+ BUG_ON(err);
>
>
> If this selinux_netlbl_skb_sid() call can fail for any reason other than
> a kernel bug, then this needs to goto out instead of using BUG_ON. For
> example, if the function can fail due to temporary memory pressure
> leading to a failed allocation, then you want to simply drop the packet,
> not panic the kernel.
That's fine - see the discussion Venkat and I had earlier. I'll change
it to jump to "out".
>>+
>>+ err = avc_has_perm(nlbl_sid, skb->secmark, SECCLASS_PACKET,
>>+ PACKET__FLOW_IN, NULL);
>
>
> This means we end up with two flow_in checks each time, even if only one
> or none of the two labeling mechanisms was used, right? Given the
> conclusion on the discussion of what it means to use them together (just
> redundant), this seems to be pointless overhead.
I was just trying to match what Venkat had already done.
It's easy enough to distinguish when there is not a NetLabel present and
skip the second check, but I think we need a second access check for
NetLabel when it is present as to skip that check could result in some
wierd behaviors if both forms of external labeling are used.
Yes, we all agree it's redundant to use both at the same time, but I
don't think there is anything preventing users from doing so at the
present time.
>>@@ -3749,6 +3757,12 @@ static int selinux_skb_flow_out(struct s
>> struct sk_security_struct *sksec = skb->sk->sk_security;
>> skb->secmark = sksec->sid;
>> }
>>+
>>+ err = selinux_netlbl_skb_sid(skb, skb->secmark, &nlbl_sid);
>>+ BUG_ON(err);
>
>
> Same concern about BUG_ON as above. Also, I'd have expected this to
> happen at the same point that selinux_skb_xfrm_sid() is called.
>
>>+ if (nlbl_sid)
>>+ skb->secmark = nlbl_sid;
>
>
> And then I'd expect this to be moved up prior to the if (xfrm_sid)
> clause, turning that into an else clause, e.g.:
> if (nlbl_sid)
> skb->secmark = nlbl_sid;
> else if (xfrm_sid)
> skb->secmark = xfrm_sid;
> else if (skb->sk) ...
Easy enough to change.
>>@@ -3913,9 +3928,15 @@ static unsigned int selinux_ip_postroute
>> skb->sk->sk_security;
>> skb->secmark = sksec->sid;
>> }
>>+
>>+ err = selinux_netlbl_skb_sid(skb,
>>+ skb->secmark,
>>+ &nlbl_sid);
>>+ BUG_ON(err);
>>+
>>+ if (nlbl_sid)
>>+ skb->secmark = nlbl_sid;
>
>
> Similar comments as above.
>
>> }
>>- err = avc_has_perm(skb->secmark, SECINITSID_UNLABELED,
>>- SECCLASS_PACKET, PACKET__FLOW_OUT, &ad);
>
>
> Why do you think you can remove this?
I don't, that was a mistake/typo that I missed. Thanks.
--
paul moore
linux security @ hp
next prev parent reply other threads:[~2006-10-02 19:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-02 18:06 [PATCH v2 0/1] Respun patch to match the latest secid patchset paul.moore
2006-10-02 18:06 ` [PATCH v2 1/1] NetLabel: secid reconciliation support paul.moore
2006-10-02 19:24 ` Stephen Smalley
2006-10-02 19:39 ` Paul Moore [this message]
2006-10-02 20:19 ` Paul Moore
-- strict thread matches above, loose matches on Subject: below --
2006-10-02 20:04 Venkat Yekkirala
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=45216AE9.8060305@hp.com \
--to=paul.moore@hp.com \
--cc=eparis@redhat.com \
--cc=jmorris@namei.org \
--cc=netdev@vger.kernel.org \
--cc=sds@tycho.nsa.gov \
--cc=selinux@tycho.nsa.gov \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).