linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* New skb extension for use by LSMs (skb "security blob")?
@ 2019-08-21 22:00 Paul Moore
  2019-08-21 22:50 ` David Miller
  2019-08-22  7:03 ` Florian Westphal
  0 siblings, 2 replies; 17+ messages in thread
From: Paul Moore @ 2019-08-21 22:00 UTC (permalink / raw)
  To: netdev; +Cc: linux-security-module, selinux

Hello netdev,

I was just made aware of the skb extension work, and it looks very
appealing from a LSM perspective.  As some of you probably remember,
we (the LSM folks) have wanted a proper security blob in the skb for
quite some time, but netdev has been resistant to this idea thus far.

If I were to propose a patchset to add a SKB_EXT_SECURITY skb
extension (a single extension ID to be shared among the different
LSMs), would that be something that netdev would consider merging, or
is there still a philosophical objection to things like this?

-- 
paul moore
www.paul-moore.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: New skb extension for use by LSMs (skb "security blob")?
  2019-08-21 22:00 New skb extension for use by LSMs (skb "security blob")? Paul Moore
@ 2019-08-21 22:50 ` David Miller
  2019-08-22  3:27   ` Paul Moore
  2019-08-22  7:03 ` Florian Westphal
  1 sibling, 1 reply; 17+ messages in thread
From: David Miller @ 2019-08-21 22:50 UTC (permalink / raw)
  To: paul; +Cc: netdev, linux-security-module, selinux

From: Paul Moore <paul@paul-moore.com>
Date: Wed, 21 Aug 2019 18:00:09 -0400

> I was just made aware of the skb extension work, and it looks very
> appealing from a LSM perspective.  As some of you probably remember,
> we (the LSM folks) have wanted a proper security blob in the skb for
> quite some time, but netdev has been resistant to this idea thus far.
> 
> If I were to propose a patchset to add a SKB_EXT_SECURITY skb
> extension (a single extension ID to be shared among the different
> LSMs), would that be something that netdev would consider merging, or
> is there still a philosophical objection to things like this?

Unlike it's main intended user (MPTCP), it sounds like LSM's would use
this in a way such that it would be enabled on most systems all the
time.

That really defeats the whole purpose of making it dynamic. :-/

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: New skb extension for use by LSMs (skb "security blob")?
  2019-08-21 22:50 ` David Miller
@ 2019-08-22  3:27   ` Paul Moore
  2019-08-22  3:54     ` David Miller
  0 siblings, 1 reply; 17+ messages in thread
From: Paul Moore @ 2019-08-22  3:27 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-security-module, selinux

On Wed, Aug 21, 2019 at 6:50 PM David Miller <davem@davemloft.net> wrote:
> From: Paul Moore <paul@paul-moore.com>
> Date: Wed, 21 Aug 2019 18:00:09 -0400
>
> > I was just made aware of the skb extension work, and it looks very
> > appealing from a LSM perspective.  As some of you probably remember,
> > we (the LSM folks) have wanted a proper security blob in the skb for
> > quite some time, but netdev has been resistant to this idea thus far.
> >
> > If I were to propose a patchset to add a SKB_EXT_SECURITY skb
> > extension (a single extension ID to be shared among the different
> > LSMs), would that be something that netdev would consider merging, or
> > is there still a philosophical objection to things like this?
>
> Unlike it's main intended user (MPTCP), it sounds like LSM's would use
> this in a way such that it would be enabled on most systems all the
> time.
>
> That really defeats the whole purpose of making it dynamic. :-/

I would be okay with only adding a skb extension when we needed it,
which I'm currently thinking would only be when we had labeled
networking actually configured at runtime and not just built into the
kernel.  In SELinux we do something similar today when it comes to our
per-packet access controls; if labeled networking is not configured we
bail out of the LSM hooks early to improve performance (we would just
be comparing unlabeled_t to unlabeled_t anyway).  I think the other
LSMs would be okay with this usage as well.

While a number of distros due enable some form of LSM and the labeled
networking bits at build time, vary few (if any?) provide a default
configuration so I would expect no additional overhead in the common
case.

Would that be acceptable?

-- 
paul moore
www.paul-moore.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: New skb extension for use by LSMs (skb "security blob")?
  2019-08-22  3:27   ` Paul Moore
@ 2019-08-22  3:54     ` David Miller
  2019-08-22 18:50       ` Casey Schaufler
  0 siblings, 1 reply; 17+ messages in thread
From: David Miller @ 2019-08-22  3:54 UTC (permalink / raw)
  To: paul; +Cc: netdev, linux-security-module, selinux

From: Paul Moore <paul@paul-moore.com>
Date: Wed, 21 Aug 2019 23:27:03 -0400

> On Wed, Aug 21, 2019 at 6:50 PM David Miller <davem@davemloft.net> wrote:
>> From: Paul Moore <paul@paul-moore.com>
>> Date: Wed, 21 Aug 2019 18:00:09 -0400
>>
>> > I was just made aware of the skb extension work, and it looks very
>> > appealing from a LSM perspective.  As some of you probably remember,
>> > we (the LSM folks) have wanted a proper security blob in the skb for
>> > quite some time, but netdev has been resistant to this idea thus far.
>> >
>> > If I were to propose a patchset to add a SKB_EXT_SECURITY skb
>> > extension (a single extension ID to be shared among the different
>> > LSMs), would that be something that netdev would consider merging, or
>> > is there still a philosophical objection to things like this?
>>
>> Unlike it's main intended user (MPTCP), it sounds like LSM's would use
>> this in a way such that it would be enabled on most systems all the
>> time.
>>
>> That really defeats the whole purpose of making it dynamic. :-/
> 
> I would be okay with only adding a skb extension when we needed it,
> which I'm currently thinking would only be when we had labeled
> networking actually configured at runtime and not just built into the
> kernel.  In SELinux we do something similar today when it comes to our
> per-packet access controls; if labeled networking is not configured we
> bail out of the LSM hooks early to improve performance (we would just
> be comparing unlabeled_t to unlabeled_t anyway).  I think the other
> LSMs would be okay with this usage as well.
> 
> While a number of distros due enable some form of LSM and the labeled
> networking bits at build time, vary few (if any?) provide a default
> configuration so I would expect no additional overhead in the common
> case.
> 
> Would that be acceptable?

I honestly don't know, I kinda feared that once the SKB extension went in
people would start dumping things there and that's exactly what's happening.
I just so happened to be reviewing:

	https://patchwork.ozlabs.org/patch/1150091/

while you were writing this email.

It's rediculous, the vultures are out.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: New skb extension for use by LSMs (skb "security blob")?
  2019-08-21 22:00 New skb extension for use by LSMs (skb "security blob")? Paul Moore
  2019-08-21 22:50 ` David Miller
@ 2019-08-22  7:03 ` Florian Westphal
  2019-08-22 16:32   ` Paul Moore
  1 sibling, 1 reply; 17+ messages in thread
From: Florian Westphal @ 2019-08-22  7:03 UTC (permalink / raw)
  To: Paul Moore; +Cc: netdev, linux-security-module, selinux

Paul Moore <paul@paul-moore.com> wrote:
> Hello netdev,
> 
> I was just made aware of the skb extension work, and it looks very
> appealing from a LSM perspective.  As some of you probably remember,
> we (the LSM folks) have wanted a proper security blob in the skb for
> quite some time, but netdev has been resistant to this idea thus far.

Is that "blob" in addition to skb->secmark, or a replacement?

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: New skb extension for use by LSMs (skb "security blob")?
  2019-08-22  7:03 ` Florian Westphal
@ 2019-08-22 16:32   ` Paul Moore
  2019-08-22 20:10     ` Casey Schaufler
  0 siblings, 1 reply; 17+ messages in thread
From: Paul Moore @ 2019-08-22 16:32 UTC (permalink / raw)
  To: Florian Westphal; +Cc: netdev, linux-security-module, selinux

On Thu, Aug 22, 2019 at 3:03 AM Florian Westphal <fw@strlen.de> wrote:
> Paul Moore <paul@paul-moore.com> wrote:
> > Hello netdev,
> >
> > I was just made aware of the skb extension work, and it looks very
> > appealing from a LSM perspective.  As some of you probably remember,
> > we (the LSM folks) have wanted a proper security blob in the skb for
> > quite some time, but netdev has been resistant to this idea thus far.
>
> Is that "blob" in addition to skb->secmark, or a replacement?

That's a good question.  While I thought about that, I wasn't sure if
that was worth bringing up as previous attempts to trade the secmark
field for a void pointer met with failure.  Last time I played with it
I was able to take the additional 32-bits from holes in the skb, and
possibly even improve some of the cacheline groupings (but that is
always going to be a dependent on use case I think), but that wasn't
enough.

I think we could consider freeing up the secmark in the main skb, and
move it to a skb extension, but this would potentially increase the
chances that we would need to add an extension to a skb.  I don't have
any hard numbers, but based on discussions and questions I suspect
Secmark is more widely used than NetLabel and/or labeled IPsec;
although I'm confident it is still a minor percentage of the overall
Linux installed base.

For me the big question is what would it take for us to get a security
blob associated with the skb?  Would moving the secmark into the skb
extension be enough?  Something else?  Or is this simply never going
to happen?  I want to remain optimistic, but I've been trying for this
off-and-on for over a decade and keep running into a brick wall ;)

-- 
paul moore
www.paul-moore.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: New skb extension for use by LSMs (skb "security blob")?
  2019-08-22  3:54     ` David Miller
@ 2019-08-22 18:50       ` Casey Schaufler
  0 siblings, 0 replies; 17+ messages in thread
From: Casey Schaufler @ 2019-08-22 18:50 UTC (permalink / raw)
  To: David Miller, paul; +Cc: netdev, linux-security-module, selinux, casey

On 8/21/2019 8:54 PM, David Miller wrote:
> From: Paul Moore <paul@paul-moore.com>
> Date: Wed, 21 Aug 2019 23:27:03 -0400
>
>> On Wed, Aug 21, 2019 at 6:50 PM David Miller <davem@davemloft.net> wrote:
>>> From: Paul Moore <paul@paul-moore.com>
>>> Date: Wed, 21 Aug 2019 18:00:09 -0400
>>>
>>>> I was just made aware of the skb extension work, and it looks very
>>>> appealing from a LSM perspective.  As some of you probably remember,
>>>> we (the LSM folks) have wanted a proper security blob in the skb for
>>>> quite some time, but netdev has been resistant to this idea thus far.
>>>>
>>>> If I were to propose a patchset to add a SKB_EXT_SECURITY skb
>>>> extension (a single extension ID to be shared among the different
>>>> LSMs), would that be something that netdev would consider merging, or
>>>> is there still a philosophical objection to things like this?
>>> Unlike it's main intended user (MPTCP), it sounds like LSM's would use
>>> this in a way such that it would be enabled on most systems all the
>>> time.

Only SELinux and Smack use the networking hooks today,
although I understand that AppArmor has plans to do so
in the not too distant future. Smack enables labeled
networking at all times. While Smack doesn't have the
expansive use that SELinux does because of Android, it
is used extensively in embedded systems via Tizen and
Yocto Project deployments.

>>> That really defeats the whole purpose of making it dynamic. :-/

It argues that fulfilling the needs of LSMs ought to be a basic
feature of the skb, rather than a dynamic extension. When LSMs were
introduced 20 years ago it was assumed their use would be rare, and
it was. Today almost all Linux systems use LSMs, and once AppArmor
adds network labeling it will be quite difficult to find a major
distribution that doesn't need the support.

>> I would be okay with only adding a skb extension when we needed it,
>> which I'm currently thinking would only be when we had labeled
>> networking actually configured at runtime and not just built into the
>> kernel.  In SELinux we do something similar today when it comes to our
>> per-packet access controls; if labeled networking is not configured we
>> bail out of the LSM hooks early to improve performance (we would just
>> be comparing unlabeled_t to unlabeled_t anyway).  I think the other
>> LSMs would be okay with this usage as well.

Smack uses labeled (CIPSO now, CALIPSO 'soon') networking by default
and depends on it heavily for basic system policy enforcement.

>> While a number of distros due enable some form of LSM and the labeled
>> networking bits at build time, vary few (if any?) provide a default
>> configuration so I would expect no additional overhead in the common
>> case.

Tizen isn't a distro, but neither is Android.

>> Would that be acceptable?
> I honestly don't know, I kinda feared that once the SKB extension went in
> people would start dumping things there and that's exactly what's happening.

As Paul has mentioned, the LSM community (Paul and me in particular)
have been looking for a better way to deal with the network stack
for a long time.

> I just so happened to be reviewing:
>
> 	https://patchwork.ozlabs.org/patch/1150091/
>
> while you were writing this email.
>
> It's rediculous, the vultures are out.


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: New skb extension for use by LSMs (skb "security blob")?
  2019-08-22 16:32   ` Paul Moore
@ 2019-08-22 20:10     ` Casey Schaufler
  2019-08-22 20:15       ` Florian Westphal
  2019-08-22 21:17       ` David Miller
  0 siblings, 2 replies; 17+ messages in thread
From: Casey Schaufler @ 2019-08-22 20:10 UTC (permalink / raw)
  To: Paul Moore, Florian Westphal
  Cc: netdev, linux-security-module, selinux, casey

On 8/22/2019 9:32 AM, Paul Moore wrote:
> On Thu, Aug 22, 2019 at 3:03 AM Florian Westphal <fw@strlen.de> wrote:
>> Paul Moore <paul@paul-moore.com> wrote:
>>> Hello netdev,
>>>
>>> I was just made aware of the skb extension work, and it looks very
>>> appealing from a LSM perspective.  As some of you probably remember,
>>> we (the LSM folks) have wanted a proper security blob in the skb for
>>> quite some time, but netdev has been resistant to this idea thus far.
>> Is that "blob" in addition to skb->secmark, or a replacement?
> That's a good question.  While I thought about that, I wasn't sure if
> that was worth bringing up as previous attempts to trade the secmark
> field for a void pointer met with failure.  Last time I played with it
> I was able to take the additional 32-bits from holes in the skb, and
> possibly even improve some of the cacheline groupings (but that is
> always going to be a dependent on use case I think), but that wasn't
> enough.
>
> I think we could consider freeing up the secmark in the main skb, and
> move it to a skb extension, but this would potentially increase the
> chances that we would need to add an extension to a skb.  I don't have
> any hard numbers, but based on discussions and questions I suspect
> Secmark is more widely used than NetLabel and/or labeled IPsec;
> although I'm confident it is still a minor percentage of the overall
> Linux installed base.

Smack uses both extensively. As far as Smack is concerned giving up
the secmark for a blob would be just fine.

I am also working on security module stacking, and a blob in the
skb would dramatically improve the options for making that work
rationally.

> For me the big question is what would it take for us to get a security
> blob associated with the skb?  Would moving the secmark into the skb
> extension be enough?  Something else?  Or is this simply never going
> to happen?  I want to remain optimistic, but I've been trying for this
> off-and-on for over a decade and keep running into a brick wall ;)

Given that the original objection to using a skb extension for a
security blob was that an extension is dynamic, and that the ubiquitous
nature of LSM use makes that unreasonable, it would seem that supporting
the security blob as a basic part if the skb would be the obvious and
correct solution. If the normal case is that there is an LSM that would
befit from the native (unextended) support of a blob, it would seem
that that is the case that should be optimized.



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: New skb extension for use by LSMs (skb "security blob")?
  2019-08-22 20:10     ` Casey Schaufler
@ 2019-08-22 20:15       ` Florian Westphal
  2019-08-22 20:35         ` Casey Schaufler
  2019-08-22 21:17       ` David Miller
  1 sibling, 1 reply; 17+ messages in thread
From: Florian Westphal @ 2019-08-22 20:15 UTC (permalink / raw)
  To: Casey Schaufler
  Cc: Paul Moore, Florian Westphal, netdev, linux-security-module, selinux

Casey Schaufler <casey@schaufler-ca.com> wrote:
> Given that the original objection to using a skb extension for a
> security blob was that an extension is dynamic, and that the ubiquitous
> nature of LSM use makes that unreasonable, it would seem that supporting
> the security blob as a basic part if the skb would be the obvious and
> correct solution. If the normal case is that there is an LSM that would
> befit from the native (unextended) support of a blob, it would seem
> that that is the case that should be optimized.

What is this "blob"? i.e., what would you like to add to sk_buff to make
whatever use cases you have in mind work?

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: New skb extension for use by LSMs (skb "security blob")?
  2019-08-22 20:15       ` Florian Westphal
@ 2019-08-22 20:35         ` Casey Schaufler
  2019-08-22 21:18           ` David Miller
  0 siblings, 1 reply; 17+ messages in thread
From: Casey Schaufler @ 2019-08-22 20:35 UTC (permalink / raw)
  To: Florian Westphal
  Cc: Paul Moore, netdev, linux-security-module, selinux, casey

On 8/22/2019 1:15 PM, Florian Westphal wrote:
> Casey Schaufler <casey@schaufler-ca.com> wrote:
>> Given that the original objection to using a skb extension for a
>> security blob was that an extension is dynamic, and that the ubiquitous
>> nature of LSM use makes that unreasonable, it would seem that supporting
>> the security blob as a basic part if the skb would be the obvious and
>> correct solution. If the normal case is that there is an LSM that would
>> befit from the native (unextended) support of a blob, it would seem
>> that that is the case that should be optimized.
> What is this "blob"? i.e., what would you like to add to sk_buff to make
> whatever use cases you have in mind work?

In LSM terminology a blob is a set of data managed and used by
the LSM (either in the infrastructure or the security module).
Blob pointers are included in the system data structures to which
they relate. The inode has an i_security field, which is a void *.
If the secmark where replaced by a security blob, the u32 secmark field
in an sk_buff would be replaced by a void * security field.



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: New skb extension for use by LSMs (skb "security blob")?
  2019-08-22 20:10     ` Casey Schaufler
  2019-08-22 20:15       ` Florian Westphal
@ 2019-08-22 21:17       ` David Miller
  1 sibling, 0 replies; 17+ messages in thread
From: David Miller @ 2019-08-22 21:17 UTC (permalink / raw)
  To: casey; +Cc: paul, fw, netdev, linux-security-module, selinux

From: Casey Schaufler <casey@schaufler-ca.com>
Date: Thu, 22 Aug 2019 13:10:43 -0700

> Given that the original objection to using a skb extension for a
> security blob was that an extension is dynamic, and that the ubiquitous
> nature of LSM use makes that unreasonable, it would seem that supporting
> the security blob as a basic part if the skb would be the obvious and
> correct solution. If the normal case is that there is an LSM that would
> befit from the native (unextended) support of a blob, it would seem
> that that is the case that should be optimized.

The objection is the cost, either in terms of dynamic allocation or in
terms of fixed space allocated inside of the SKB.

If you are given a u32 (which you already have) it can be used as an
IDR-like space to look up pointers if necessary.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: New skb extension for use by LSMs (skb "security blob")?
  2019-08-22 20:35         ` Casey Schaufler
@ 2019-08-22 21:18           ` David Miller
  2019-08-22 21:59             ` Casey Schaufler
  0 siblings, 1 reply; 17+ messages in thread
From: David Miller @ 2019-08-22 21:18 UTC (permalink / raw)
  To: casey; +Cc: fw, paul, netdev, linux-security-module, selinux

From: Casey Schaufler <casey@schaufler-ca.com>
Date: Thu, 22 Aug 2019 13:35:01 -0700

> If the secmark where replaced by a security blob, the u32 secmark field
> in an sk_buff would be replaced by a void * security field.

You can already use the secmark to hash to some kind of pointer or other
object.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: New skb extension for use by LSMs (skb "security blob")?
  2019-08-22 21:18           ` David Miller
@ 2019-08-22 21:59             ` Casey Schaufler
  2019-08-22 22:28               ` David Miller
  0 siblings, 1 reply; 17+ messages in thread
From: Casey Schaufler @ 2019-08-22 21:59 UTC (permalink / raw)
  To: David Miller; +Cc: fw, paul, netdev, linux-security-module, selinux, casey

On 8/22/2019 2:18 PM, David Miller wrote:
> From: Casey Schaufler <casey@schaufler-ca.com>
> Date: Thu, 22 Aug 2019 13:35:01 -0700
>
>> If the secmark where replaced by a security blob, the u32 secmark field
>> in an sk_buff would be replaced by a void * security field.
> You can already use the secmark to hash to some kind of pointer or other
> object.

Would you really want that used in the most common configuration?
Sure, you *can* do that, but it would be insane to do so.


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: New skb extension for use by LSMs (skb "security blob")?
  2019-08-22 21:59             ` Casey Schaufler
@ 2019-08-22 22:28               ` David Miller
  2019-08-22 22:34                 ` Casey Schaufler
  0 siblings, 1 reply; 17+ messages in thread
From: David Miller @ 2019-08-22 22:28 UTC (permalink / raw)
  To: casey; +Cc: fw, paul, netdev, linux-security-module, selinux

From: Casey Schaufler <casey@schaufler-ca.com>
Date: Thu, 22 Aug 2019 14:59:37 -0700

> Sure, you *can* do that, but it would be insane to do so.

We look up the neighbour table entries on every single packet we
transmit from the kernel in the same exact way.

And it was exactly to get rid of a pointer in a data structure.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: New skb extension for use by LSMs (skb "security blob")?
  2019-08-22 22:28               ` David Miller
@ 2019-08-22 22:34                 ` Casey Schaufler
  2019-08-22 22:36                   ` David Miller
  0 siblings, 1 reply; 17+ messages in thread
From: Casey Schaufler @ 2019-08-22 22:34 UTC (permalink / raw)
  To: David Miller; +Cc: fw, paul, netdev, linux-security-module, selinux, casey

On 8/22/2019 3:28 PM, David Miller wrote:
> From: Casey Schaufler <casey@schaufler-ca.com>
> Date: Thu, 22 Aug 2019 14:59:37 -0700
>
>> Sure, you *can* do that, but it would be insane to do so.
> We look up the neighbour table entries on every single packet we
> transmit from the kernel in the same exact way.
>
> And it was exactly to get rid of a pointer in a data structure.

I very much expect that the lifecycle management issues would
be completely different, but I'll admit to having little understanding
of the details of the neighbour table.


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: New skb extension for use by LSMs (skb "security blob")?
  2019-08-22 22:34                 ` Casey Schaufler
@ 2019-08-22 22:36                   ` David Miller
  2019-08-23 18:56                     ` Casey Schaufler
  0 siblings, 1 reply; 17+ messages in thread
From: David Miller @ 2019-08-22 22:36 UTC (permalink / raw)
  To: casey; +Cc: fw, paul, netdev, linux-security-module, selinux

From: Casey Schaufler <casey@schaufler-ca.com>
Date: Thu, 22 Aug 2019 15:34:44 -0700

> On 8/22/2019 3:28 PM, David Miller wrote:
>> From: Casey Schaufler <casey@schaufler-ca.com>
>> Date: Thu, 22 Aug 2019 14:59:37 -0700
>>
>>> Sure, you *can* do that, but it would be insane to do so.
>> We look up the neighbour table entries on every single packet we
>> transmit from the kernel in the same exact way.
>>
>> And it was exactly to get rid of a pointer in a data structure.
> 
> I very much expect that the lifecycle management issues would
> be completely different, but I'll admit to having little understanding
> of the details of the neighbour table.

Neighbour table entries can live anywhere from essentially forever down
to several microseconds.

If your hash is good, and you use RCU locking on the read side, it's a
single pointer dereference in cost.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: New skb extension for use by LSMs (skb "security blob")?
  2019-08-22 22:36                   ` David Miller
@ 2019-08-23 18:56                     ` Casey Schaufler
  0 siblings, 0 replies; 17+ messages in thread
From: Casey Schaufler @ 2019-08-23 18:56 UTC (permalink / raw)
  To: David Miller; +Cc: fw, paul, netdev, linux-security-module, selinux, casey

On 8/22/2019 3:36 PM, David Miller wrote:
> From: Casey Schaufler <casey@schaufler-ca.com>
> Date: Thu, 22 Aug 2019 15:34:44 -0700
>
>> On 8/22/2019 3:28 PM, David Miller wrote:
>>> From: Casey Schaufler <casey@schaufler-ca.com>
>>> Date: Thu, 22 Aug 2019 14:59:37 -0700
>>>
>>>> Sure, you *can* do that, but it would be insane to do so.
>>> We look up the neighbour table entries on every single packet we
>>> transmit from the kernel in the same exact way.
>>>
>>> And it was exactly to get rid of a pointer in a data structure.
>> I very much expect that the lifecycle management issues would
>> be completely different, but I'll admit to having little understanding
>> of the details of the neighbour table.
> Neighbour table entries can live anywhere from essentially forever down
> to several microseconds.
>
> If your hash is good, and you use RCU locking on the read side, it's a
> single pointer dereference in cost.

The secmark is the data used by the netfilter system.
While it would be (Turing compatible, after all) possible,
we're talking multiple attributes with different lifecycles
being managed in a table (list, whatever) that may expand
explosively. Using a single ID to reference into a table that
could contain:
	secmark from iptables for SELinux
	secmark from iptables for AppArmor
	SELinux secid/context for the packet
	AppArmor secid/context for the packet
will be hairy. In the netfilter processing we may have to
allocate a new table entry. There's no way to identify that
the entry is no longer necessary, as there is no lifecycle
on a secmark. Is it possible to come up with something that
will limp along? Possibly. If there's a blob pointer, we know
how to do all this effectively.



^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2019-08-23 18:56 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-21 22:00 New skb extension for use by LSMs (skb "security blob")? Paul Moore
2019-08-21 22:50 ` David Miller
2019-08-22  3:27   ` Paul Moore
2019-08-22  3:54     ` David Miller
2019-08-22 18:50       ` Casey Schaufler
2019-08-22  7:03 ` Florian Westphal
2019-08-22 16:32   ` Paul Moore
2019-08-22 20:10     ` Casey Schaufler
2019-08-22 20:15       ` Florian Westphal
2019-08-22 20:35         ` Casey Schaufler
2019-08-22 21:18           ` David Miller
2019-08-22 21:59             ` Casey Schaufler
2019-08-22 22:28               ` David Miller
2019-08-22 22:34                 ` Casey Schaufler
2019-08-22 22:36                   ` David Miller
2019-08-23 18:56                     ` Casey Schaufler
2019-08-22 21:17       ` David Miller

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).