From: Paul Moore <paul.moore@hp.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 1/2] LSM: Add inet_sys_snd_skb() LSM hook
Date: Fri, 4 Jan 2008 17:37:50 -0500 [thread overview]
Message-ID: <200801041737.50883.paul.moore@hp.com> (raw)
In-Reply-To: <20080104.130902.217217806.davem@davemloft.net>
On Friday 04 January 2008 4:09:02 pm David Miller wrote:
> From: Paul Moore <paul.moore@hp.com>
> Date: Fri, 4 Jan 2008 09:38:27 -0500
>
> > Unfortunately, it's not quite that easy at present. The only field
> > we have in the skb where we could possibly set a flag is the
> > secmark field which is already taken.
>
> Herbert Xu added a "peeked" field in net-2.6.25 that is only used on
> input while processing socket receive queues. You could use it on
> output.
Actually, I went back to the drawing board and I think I found a
solution that _should_ work using the existing postroute hook. It
isn't as general but it is relatively simple.
Historically the problem has been with labeled IPsec and the fact that
the postroute hook can get hit multiple times when it is in use. While
yes, the packet is different each time through the hook but the packet's
security label never changes (the packet's security label is determined
by the original sender). From a security point of view we really only
want to check the packet once on the way out and we want that check to
happen at the very end, not while packet transforms are in progress.
This was the motivation for the new LSM hook.
After the new hook was rejected I took a step back and thought about the
problem a bit more. The multi-hit postroute hook problem was really
only an issue for IPsec; the other labeling protocols don't have this
problem because they don't do any transformation of the packet. If we
could find a quick way to determine when all of the IPsec processing
was finished would could use the existing postroute hook approach and
simply fall through if the hook was hit when IPsec processing was still
needed.
I still need to test this to make sure it does everything we need, but
I'm pretty certain that using the we can key off the skb->dst->xfrm
value as a way to determine if a packet is done with it's IPsec
transformation, if any. Basically we rewrite our postroute hook to
look something like this:
int hook(...)
{
/* stuff to do every time */
if (skb->dst->xfrm != NULL)
return NF_ACCEPT;
/* stuff to do only on the last time we are called */
}
If it doesn't end up meeting our needs I'll look into the 'peeked'
field, thanks for the suggestion.
--
paul moore
linux security @ hp
next prev parent reply other threads:[~2008-01-04 22:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-03 17:25 [PATCH 0/2] Labeled networking core stack changes for 2.6.25 Paul Moore
2008-01-03 17:25 ` [PATCH 1/2] LSM: Add inet_sys_snd_skb() LSM hook Paul Moore
2008-01-04 4:45 ` David Miller
2008-01-04 14:38 ` Paul Moore
2008-01-04 21:09 ` David Miller
2008-01-04 22:37 ` Paul Moore [this message]
2008-01-03 17:25 ` [PATCH 2/2] NET: Clone the sk_buff 'iif' field in __skb_clone() Paul Moore
2008-01-03 18:33 ` Joe Perches
2008-01-03 18:40 ` 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=200801041737.50883.paul.moore@hp.com \
--to=paul.moore@hp.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/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).