All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Moore <paul.moore@hp.com>
To: Stephen Smalley <sds@epoch.ncsc.mil>
Cc: selinux@tycho.nsa.gov, James Morris <jmorris@redhat.com>
Subject: Re: socket options ... again
Date: Thu, 26 Oct 2006 14:51:17 -0400	[thread overview]
Message-ID: <454103A5.5080902@hp.com> (raw)
In-Reply-To: <1161885634.16681.274.camel@moss-spartans.epoch.ncsc.mil>

Stephen Smalley wrote:
> On Thu, 2006-10-26 at 13:23 -0400, Paul Moore wrote:
> 
>>Stephen Smalley wrote:
>>
>>>On Thu, 2006-10-26 at 12:21 -0400, Paul Moore wrote:
>>>
>>>
>>>>Thoughts on these options?  Can anyone else think of a better solution?
>>>
>>>ip_options_compile() checks CAP_NET_RAW for IPOPT_SEC, IPOPT_SID, and
>>>any unknown options.  Is there a reason to not do likewise for setting
>>>IPOPT_CIPSO from userspace (which you need to distinguish in some manner
>>>from your internal setting)?
>>
>>Ah ha ... thank you for the lightbulb moment.
>>
>>Adding CAP_NET_RAW in ip_options_compile() would solve the problem in a manner
>>which makes the most sense from an application point of view.  However, it does
>>present a problem in that potentially even applications without CAP_NET_RAW will
>>need to have a CIPSO options set by the kernel, as you noted in the comment
>>about distinguishing between NetLabel and applications.
>>
>>Right now the CIPSO code only makes use of ip_options_compile() in two places
>>(that I can think of): the first is when a packet enters the system via
>>ip_rcv_options() in ip_rcv_finish(), the second when a socket is created by an
>>application and cipso_v4_socket_setattr() is called.  I don't believe
>>CAP_NET_RAW should be an issue in the first case (please correct me if I'm
>>wrong) but it would cause problems in the second case.  Considering the blank
>>slate of a new socket and the very simple nature of the CIPSO code in
>>ip_options_compile() it may be the best option is to simply handle the
>>ip_options_compile() tasks directly in cipso_v4_socket_setattr().
>>
>>Does this sound reasonable?
> 
> To clarify, the existing capable checks in ip_options_compile() are only
> applied on the output processing (they check for a NULL skb), never on
> the input side.

Yep.

> It seems like your internal use of ip_options_compile() from cipso is
> overkill, since it then just calls back into your cipso code for the
> CIPSO option, right?  So just handling it directly within the cipso code
> makes sense to me.

Yes, you are right there is a lot of unnecessary stuff there; its a bit of a
holdover from the initial code which used ip_options_get().  The original
thought was that since it wasn't really a critical path it was probably better
to reuse what was there even if it was slower.

I'm working on a patch now which I should have out in a few hours.

-- 
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-26 18:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-26 16:21 socket options ... again Paul Moore
2006-10-26 16:46 ` Stephen Smalley
2006-10-26 17:23   ` Paul Moore
2006-10-26 18:00     ` Stephen Smalley
2006-10-26 18:51       ` Paul Moore [this message]
2006-10-26 19:07   ` Paul Moore
2006-10-26 20:37     ` [RFC] protect NetLabel options from setsockopt (was: socket options ... again) 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=454103A5.5080902@hp.com \
    --to=paul.moore@hp.com \
    --cc=jmorris@redhat.com \
    --cc=sds@epoch.ncsc.mil \
    --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 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.