Skip to contentSkip to conversation

SMP mode?

DISCUSSION Leslie J. French 2 participants 9 messages Mar 20, 2002 – Mar 25, 2002 SELinux security module

lore
Share & tools
lore
#0 lore raw

Apologies for a newbie question, but I can't find anything explicit in the archive.

Is it known if SELinux works/doesn't work when installed on top of RedHat7.1-smp? I'm running a dual-processor system and the apps (which are very CPU & network intensive) work OK in the normal boot and fail mysteriously in SELinux (e.g. "Operation not permitted" but with nothing in the log, even in avc "permissive" mode). It's running 2002011718 version.

I'll repeat the experiment on a single-CPU box, since it is most likely my fault, but I'd appreciate it if it's *known* that there are problems in this area.

Leslie French
Semandex Networks

--
You have received this message because you are subscribed to the selinux 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 9 lines · Leslie J. French

Is it known if SELinux works/doesn't work when installed on top of RedHat7.1-smp? I'm running a dual-processor system and the apps (which are very CPU & network intensive) work OK in the normal boot and fail mysteriously in SELinux (e.g. "Operation not permitted" but with nothing in the log, even in avc "permissive" mode). It's running 2002011718 version.

I'll repeat the experiment on a single-CPU box, since it is most likely my fault, but I'd appreciate it if it's *known* that there are problems in this area.

As far as I know, SELinux _should_ work on SMP, but it hasn't been tested. SELinux uses coarse-grained locking at present, but that shouldn't manifest as denials. What are your kernel config option settings, particularly the CONFIG_SECURITY_* settings?

--
Stephen D. Smalley, NAI Labs
[email protected]

--
You have received this message because you are subscribed to the selinux 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 4 lines · Stephen D. Smalley

As far as I know, SELinux _should_ work on SMP, but it hasn't been tested. SELinux uses coarse-grained locking at present, but that shouldn't manifest as denials. What are your kernel config option settings, particularly the CONFIG_SECURITY_* settings?

I have =y on the following options (via modules/lsm-patch)

_PACKET _NETLINK _RTNETLINK _NETFILTER _UNIX _INET
security: _CAPABILITIES _IP _SELINUX _SELINUX_DEVELOP

the errors are occuring on a UDP socket, at random positions in a dataflow.

Leslie

--
You have received this message because you are subscribed to the selinux 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 6 lines · Leslie J. French

I have =y on the following options (via modules/lsm-patch)

_PACKET _NETLINK _RTNETLINK _NETFILTER _UNIX _INET
security: _CAPABILITIES _IP _SELINUX _SELINUX_DEVELOP

the errors are occuring on a UDP socket, at random positions in a dataflow.

Is it failing on a sendto/sendmsg call or some other call?

Also, see whether the same error occurs with a kernel built without CONFIG_SECURITY_IP.

--
Stephen D. Smalley, NAI Labs
[email protected]

--
You have received this message because you are subscribed to the selinux 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
Quoted 6 lines · Leslie J. French

I have =y on the following options (via modules/lsm-patch)

_PACKET _NETLINK _RTNETLINK _NETFILTER _UNIX _INET
security: _CAPABILITIES _IP _SELINUX _SELINUX_DEVELOP

the errors are occuring on a UDP socket, at random positions in a

dataflow.

To follow up on my own message -- the same code works perfectly on a single-processor board built with the "enterprise" kernel with the above security settings.

Also, I can get the programs to run on the SMP if I slow them down, for example
by adding print statements. There is a point at which the operation is "marginal,"
i.e. sometimes works sometimes doesn't, which is at around 1-character-output-per-packet.
More, and it runs, less and it fails.

I read somewhere that SeLinux will return EPERM if it thinks I'm trying a buffer overflow exploitation. Is it possible that running the network at a very high rate on a dual-processor could confuse the kernel into thinking it's being attacked? Is there any way I can check why the EPERM is being generated?

Thx, Leslie

--
You have received this message because you are subscribed to the selinux list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#7 lore raw

Location of policy rules

In reply to Stephen Smalley

I have a meta-policy question, if I may:

I want to enable the "halt" userid for console login and ssh access to shut down a machine remotely, *without* allowing root access over ssh. Naturally, I want to limit the exposure this gives. So, I created a "halt_t" domain similar to the other
daemon-type domains, and I lock the "halt" user id into that domain, giving it exec access to /sbin/halt, which is now of type halt_exec_t etc...

This has the side-effect of locking out /sbin/halt from root, since it doesn't have any access to halt_exec_t.

Here is my question:
Assuming this is the right approach [if not, do tell what is], where should I put the additional rules to allow sysadm to halt the machine. Is it:
(a) in sysadm.te so that all the sysadm rules are in the same place; or
(b) in halt.te so that this "feature" becomes a stand-alone domain definition in the system?

I know they all end up in the same place, but I'm torn between wanting to build a modular configuration vs not introducing potentially dangerous sysadm_t permissions in an unexpected place.

All guidance for the novice gratefully received.

Leslie

PS - I'm a SeLinux convert. If there's anything I can do to help....

--
You have received this message because you are subscribed to the selinux list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#5 lore raw
In reply to Leslie J. French
Quoted 2 lines · Leslie J. French

I read somewhere that SeLinux will return EPERM if it thinks I'm trying a buffer overflow exploitation.

That isn't correct. SELinux simply enforces access controls in accordance with the security policy configuration. It doesn't perform any kind of dynamic detection and response to anamolous behavior.

You never responded to my earlier questions, sent on 3/20 to the list. Is it failing on a sendto/sendmsg call or some other call? Does the problem occur with a kernel built with the CONFIG_SECURITY_IP option disabled?

--
Stephen D. Smalley, NAI Labs
[email protected]

--
You have received this message because you are subscribed to the selinux list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#8 lore raw

Re: Location of policy rules

In reply to Leslie J. French
Quoted 6 lines · Leslie J. French

I want to enable the "halt" userid for console login and ssh access to shut down a machine remotely, *without* allowing root access over ssh. Naturally, I want to limit the exposure this gives. So, I created a "halt_t" domain similar to the other
daemon-type domains, and I lock the "halt" user id into that domain, giving it exec access to /sbin/halt, which is now of type halt_exec_t etc...

So /sbin/halt (halt_exec_t) is the entrypoint for the halt_t domain, and this domain can be entered from local_login_t or sshd_t.

Quoted 2 lines

This has the side-effect of locking out /sbin/halt from root, since it doesn't have any access to halt_exec_t.

I don't think so. If you associated the "exec_type" attribute with halt_exec_t (which you should have done), then sysadm_t should still be able to execute /sbin/halt without any problem, since it includes the can_exec_any macro and this macro grants execute access to all of the exec_type types. By default, sysadm_t would not transition to halt_t, and there is no obvious reason to define a domain transition in that case, since sysadm_t already has the necessary permissions to halt the system. Notice that domain transitions are context-dependent (i.e. you can have login or sshd transition to halt_t upon executing /sbin/halt while leaving sysadm_t unchanged when executing /sbin/halt).

Restricting execute access to /sbin/halt has little meaning for the user domains (user_t, sysadm_t), since a user domain can always create its own halt program unless you impose restrictions on the creation of executables by user domains. The issue is not whether a user domain can execute /sbin/halt, but whether the user domain has the necessary permissions to invoke the kernel operations required to perform a halt (e.g. Can the user domain signal init? Can the user domain invoke the reboot system call?). The user_t domain lacks these permissions, while the sysadm_t domain has them.

Quoted 10 lines

Here is my question:
Assuming this is the right approach [if not, do tell what is], where should I put the additional rules to allow sysadm to halt the machine. Is it:
(a) in sysadm.te so that all the sysadm rules are in the same place; or
(b) in halt.te so that this "feature" becomes a stand-alone domain definition in the system?

I know they all end up in the same place, but I'm torn between wanting to build a modular configuration vs not introducing potentially dangerous sysadm_t permissions in an unexpected place.

The sysadm_t domain shouldn't require any changes to continue being able to execute /sbin/halt or to halt the machine.

With regard to the general question of where to place rules, it is difficult to define a single convention that always applies. My original intent was to always place rules in the .te file of the source domain, so that you could see all permissions and outgoing transitions for a given domain by inspecting its .te file. But this convention is often contrary to cleanly encapsulating domains, and it doesn't work well in many cases where you have domains or types that are instantiated through macro definitions. Hence, we've been gradually seeking to provide greater encapsulation of each program and daemon domain. Ultimately, policy analysis tools should make it easy to obtain either "view" of a domain.

--
Stephen D. Smalley, NAI Labs
[email protected]

--
You have received this message because you are subscribed to the selinux list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#6 lore raw
In reply to Stephen Smalley
Quoted 3 lines · NAI Labs

You never responded to my earlier questions, sent on 3/20 to the list. Is it failing on a sendto/sendmsg call or some other call? Does the problem occur with a kernel built with the CONFIG_SECURITY_IP option disabled?

The EPERM is returned on a sendto call.
The program worked with CONFIG_SECURITY_IP disabled (just tested it).

Leslie
--
[email protected]

--
You have received this message because you are subscribed to the selinux list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.