Skip to contentSkip to conversation

Fix running of the selinux tests

PATCH Serge E. Hallyn 2 participants 3 messages Apr 27, 2009 – Apr 29, 2009 2 messages not in the archive SELinux security module

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 9 lines · Quoting Jiri Palecek > ("<jirka"@debian.POK.IBM.COM):

Hello,

while running the ltp selinux tests on Debian, I found some problems:

1) the testdomain attribute cannot have setcurrent permission to itself. This is because in Debian refpolicy, only domains with attribute set_curr_context can have setcurrent permission on own processes (otherwise, it's forbidden by neverallow). And AFAIK, it's impossible to specify that domains having attribute testdomain also have attribute set_curr_context. Moreover, I found only two tests (dyntrans and dyntrace) that actually need it so far, so I'm not convinced it has to be granted globally.

2) the testscripts (eg. selinux_file.sh) have the test_file_t context, but they are to be run as sysadm_t. Sysadm_t therefore needs execute_no_trans permission on the test files.

Please correct me if I'm wrong.

Well we knew from the start that this method of trying to distribute test policy wasn't going to be sustainable, but I think it's at the point where we have to address it.

The way we were trying to handle policy changes over time was by having 'misc/update_policy.sh' make distro- and version-specific changes to the base refpolicy/ directory. Jiri, if your part (1) is a debian-specific fix, then another patch under misc/ probably should've been used. But as I say I think it's time to stop that nonsense. (I also notice a patch applied on Feb 2 by James which makes some of the changes which misc/sbin_deprecated.patch also does, thereby breaking its application.)

Chris, is it at all possible to distribute a module, never built into the policy, but shipped with the sources, for the testsuite? Then anyone who wanted to run the ltp testcases would install the distro policy sources (yum install selinux-policy-sources, apt-get source selinux-policy, whatever), compile the selinux-test module, and the testsuite would

semodule -i selinux-test.pp; run-tests; semodule -r selinux-test

?

The testcases don't really change (as far as i know) so that's not where the churn is. (If it was, then keeping them in uptream policy would be more painful) The policy just needs to change to reflect changes in the base policy.

thanks,
-serge

--
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 31 lines · Serge E. Hallyn
Quoted 9 lines · Quoting Jiri Palecek > ("<jirka"@debian.POK.IBM.COM):

Hello,

while running the ltp selinux tests on Debian, I found some problems:

1) the testdomain attribute cannot have setcurrent permission to itself. This is because in Debian refpolicy, only domains with attribute set_curr_context can have setcurrent permission on own processes (otherwise, it's forbidden by neverallow). And AFAIK, it's impossible to specify that domains having attribute testdomain also have attribute set_curr_context. Moreover, I found only two tests (dyntrans and dyntrace) that actually need it so far, so I'm not convinced it has to be granted globally.

2) the testscripts (eg. selinux_file.sh) have the test_file_t context, but they are to be run as sysadm_t. Sysadm_t therefore needs execute_no_trans permission on the test files.

Please correct me if I'm wrong.

Well we knew from the start that this method of trying to distribute test policy wasn't going to be sustainable, but I think it's at the point where we have to address it.

The way we were trying to handle policy changes over time was by having 'misc/update_policy.sh' make distro- and version-specific changes to the base refpolicy/ directory. Jiri, if your part (1) is a debian-specific fix, then another patch under misc/ probably should've been used. But as I say I think it's time to stop that nonsense. (I also notice a patch applied on Feb 2 by James which makes some of the changes which misc/sbin_deprecated.patch also does, thereby breaking its application.)

Chris, is it at all possible to distribute a module, never built into the policy, but shipped with the sources, for the testsuite? Then anyone who wanted to run the ltp testcases would install the distro policy sources (yum install selinux-policy-sources, apt-get source selinux-policy, whatever), compile the selinux-test module, and the testsuite would

Quoted 8 lines

semodule -i selinux-test.pp; run-tests; semodule -r selinux-test

?

The testcases don't really change (as far as i know) so that's not where the churn is. (If it was, then keeping them in uptream policy would be more painful) The policy just needs to change to reflect changes in the base policy.

While I think that would be a better way forward for maintainability, it won't help with the continued use of the ltp selinux tests as a regression test on updates to existing distribution releases (e.g. RHEL 4.x and 5.x). So we'll at least have to keep a legacy test policy in the ltp tree for that purpose.

Also, I expect it will be painful to convert the current test policy into a form fully acceptable to refpolicy, as it was never fully converted over to using interfaces for all references to external types and doing so requires creating a number of interfaces that will only ever be used by the test policy.

Signature · 8 lines
Stephen Smalley
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.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 21 lines · Jiri Palecek
Quoted 11 lines · On Tuesday 28 April 2009 01:14:21 Serge E. Hallyn wrote:
Quoted 9 lines · Quoting Jiri Palecek > ([email protected]):

Hello,

while running the ltp selinux tests on Debian, I found some problems:

1) the testdomain attribute cannot have setcurrent permission to itself. This is because in Debian refpolicy, only domains with attribute set_curr_context can have setcurrent permission on own processes (otherwise, it's forbidden by neverallow). And AFAIK, it's impossible to specify that domains having attribute testdomain also have attribute set_curr_context. Moreover, I found only two tests (dyntrans and dyntrace) that actually need it so far, so I'm not convinced it has to be granted globally.

2) the testscripts (eg. selinux_file.sh) have the test_file_t context, but they are to be run as sysadm_t. Sysadm_t therefore needs execute_no_trans permission on the test files.

Please correct me if I'm wrong.

Quoted 8 lines

Well we knew from the start that this method of trying to distribute test policy wasn't going to be sustainable, but I think it's at the point where we have to address it.

The way we were trying to handle policy changes over time was by having 'misc/update_policy.sh' make distro- and version-specific changes to the base refpolicy/ directory. Jiri, if your part (1) is a debian-specific fix,

Quoted 4 lines

Note that I'm not sure about this; I just assume it's Debian specific, because I assume it works for everybody else :) On the second sight, I just checked upstream refpolicy and it seems the offending neverallow was there at lest from 2006.

That's why the selinux-testsuite/README says you have to put expand-check=0 in your /etc/selinux/semanage.conf file, which test_selinux.sh does automatically.

Quoted 42 lines
Quoted 14 lines

then another patch under misc/ probably
should've been used. But as I say I think it's time to stop that nonsense. (I also notice a patch applied on Feb 2 by James which makes some of the changes which misc/sbin_deprecated.patch also does, thereby breaking its application.)

Chris, is it at all possible to distribute a module, never built into the policy, but shipped with the sources, for the testsuite? Then anyone who wanted to run the ltp testcases would install the distro policy sources (yum install selinux-policy-sources, apt-get source selinux-policy, whatever), compile the selinux-test module, and the testsuite would

Quoted 3 lines

semodule -i selinux-test.pp; run-tests; semodule -r selinux-test

?

It isn't like this now? I had the impression most of the policy needed to run ltp selinux tests was build from the ltp sources and loaded by

semodule -i test_policy.pp

There are some remnants of the test policy in refpolicy, but these are only few macros and types.

Quoted 4 lines

The testcases don't really change (as far as i know) so that's not where the churn is. (If it was, then keeping them in uptream policy would be more painful) The policy just needs to change to reflect changes in the base policy.

Regards
Jiri Palecek

------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations Conference from O'Reilly Media. Velocity features a full day of expert-led, hands-on workshops and two days of sessions from industry leaders in dedicated Performance & Operations tracks. Use code vel09scf and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Signature · 8 lines
Stephen Smalley
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.