Skip to contentSkip to conversation

threads

DISCUSSION Albert Cahalan 3 participants 5 messages Dec 26, 2003 – Jan 21, 2004 SELinux security module

lore
Share & tools
lore
#0 lore raw

Normal Linux security data (uid, capability bits)
is per-thread. There are at least two reasons for
this:

1. Multi-threaded server daemons can rely on
kernel-enforced security.

2. Race conditions are eliminated without locking. This deals with the problem of two threads simultaneously updating the security data, or one thread updating while another thread uses.

I'm told that SE Linux enforces shared security data. I suppose this is mostly required when implementing a mandatory system. Is this race-free? Is there a capability that would allow a suitably privileged process to have per-thread contexts?

Also, I'm told that a security context can only
change during exec. WHAT???? Besides the case of
a suitably privileged process, what about the
need to move some sort of watermark? AFAIK, your
security context needs to be tainted when you
read low-integrity data and so on.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#1 lore raw
Quoted 12 lines · Albert Cahalan

Normal Linux security data (uid, capability bits) is per-thread. There are at least two reasons for this:

1. Multi-threaded server daemons can rely on kernel-enforced security.

2. Race conditions are eliminated without locking. This deals with the problem of two threads simultaneously updating the security data, or one thread updating while another thread uses.

Quoted 5 lines

I'm told that SE Linux enforces shared security data. I suppose this is mostly required when implementing a mandatory system. Is this race-free? Is there a capability that would allow a suitably privileged process to have per-thread contexts?

For MAC, per-thread contexts make little sense since you cannot enforce any separation of the memory.

Quoted 6 lines

Also, I'm told that a security context can only change during exec. WHAT???? Besides the case of a suitably privileged process, what about the need to move some sort of watermark? AFAIK, your security context needs to be tainted when you read low-integrity data and so on.

Limiting security context transitions to execve allows the inheritance of state between the contexts and the initialization of the process in the new security context to be precisely controlled, including the particular entrypoint program used to enter the new context. A setuid(2)-like call for contexts would lack such controls and would provide no real separation between the two contexts. Introducing such an operation into the system would yield two different sets of controls and behaviors for context transitions.
The omission of such an operation from SELinux was noted in the original design documentation, and has been discussed on the list before.

With regard to "tainting", you are thinking about it the wrong way. A high integrity process shouldn't be allowed to read low integrity data (if that is your security goal), not magically migrated to a low integrity label upon performing such a read.

Signature · 8 lines
Stephen Smalley <[email protected]>
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#2 lore raw
Quoted 13 lines · Stephen Smalley
Quoted 12 lines · Albert Cahalan

Normal Linux security data (uid, capability bits) is per-thread. There are at least two reasons for this:

1. Multi-threaded server daemons can rely on kernel-enforced security.

2. Race conditions are eliminated without locking. This deals with the problem of two threads simultaneously updating the security data, or one thread updating while another thread uses.

Quoted 8 lines
Quoted 5 lines

I'm told that SE Linux enforces shared security data. I suppose this is mostly required when implementing a mandatory system. Is this race-free? Is there a capability that would allow a suitably privileged process to have per-thread contexts?

For MAC, per-thread contexts make little sense since you cannot enforce any separation of the memory.

This is not quite right. A server daemon using per-thread contexts is clearly within your trusted computing base, just as the kernel is. This can improve security over the obvious alternative of having the server run in a context that can do anything.

Quoted 7 lines
Quoted 6 lines

Also, I'm told that a security context can only change during exec. WHAT???? Besides the case of a suitably privileged process, what about the need to move some sort of watermark? AFAIK, your security context needs to be tainted when you read low-integrity data and so on.

Quoted 10 lines

Limiting security context transitions to execve allows the inheritance of state between the contexts and the initialization of the process in the new security context to be precisely controlled, including the particular entrypoint program used to enter the new context. A setuid(2)-like call for contexts would lack such controls and would provide no real separation between the two contexts. Introducing such an operation into the system would yield two different sets of controls and behaviors for context transitions.
The omission of such an operation from SELinux was noted in the original design documentation, and has been discussed on the list before.

I was assuming you wouldn't hand out such
privilige willy-nilly.

Quoted 4 lines

With regard to "tainting", you are thinking about it the wrong way. A high integrity process shouldn't be allowed to read low integrity data (if that is your security goal), not magically migrated to a low integrity label upon performing such a read.

Isn't this the way LOMAC works?

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#3 lore raw
Quoted 9 lines · Albert Cahalan
Quoted 2 lines

For MAC, per-thread contexts make little sense since you cannot enforce any separation of the memory.

This is not quite right. A server daemon using per-thread contexts is clearly within your trusted computing base, just as the kernel is. This can improve security over the obvious alternative of having the server run in a context that can do anything.

Also having threads in different contexts may be helpful for file servers.

Signature · 10 lines
http://www.coker.com.au/selinux/   My NSA Security Enhanced Linux packages
http://www.coker.com.au/bonnie++/  Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/    Postal SMTP/POP benchmark
http://www.coker.com.au/~russell/  My home page


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#4 lore raw
In reply to Albert Cahalan
Quoted 6 lines · Albert Cahalan

This is not quite right. A server daemon using per-thread contexts is clearly within your trusted computing base, just as the kernel is. This can improve security over the obvious alternative of having the server run in a context that can do anything.

With such a model, you'll quickly end up with everything in your TCB and your system will be just as easily broken as before. Split your daemon into multiple processes running in different contexts instead. Improve security? No, just provide an illusion of it; no real separation is ensured.

Quoted 2 lines

I was assuming you wouldn't hand out such privilige willy-nilly.

Once such a capability exists, people will use it for everything, and never even consider proper decomposition of their daemons.

Quoted 1 line

Isn't this the way LOMAC works?

Yes. But that doesn't mean it is a good idea.

Signature · 8 lines
Stephen Smalley <[email protected]>
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.