From: Stephen Smalley <sds@tycho.nsa.gov>
To: Paul Moore <paul@paul-moore.com>
Cc: SELinux-NSA <selinux@tycho.nsa.gov>,
Andy Lutomirski <luto@amacapital.net>
Subject: Re: [PATCH v2] selinux: Permit bounded transitions under NO_NEW_PRIVS or NOSUID.
Date: Fri, 29 Aug 2014 09:12:10 -0400 [thread overview]
Message-ID: <54007C2A.1040504@tycho.nsa.gov> (raw)
In-Reply-To: <35237187.pLesj1POuT@sifl>
[-- Attachment #1: Type: text/plain, Size: 4387 bytes --]
On 08/28/2014 05:36 PM, Paul Moore wrote:
> On Tuesday, August 12, 2014 03:21:14 PM Stephen Smalley wrote:
>> Attached is the patch for the selinux-testsuite,
>> against git://git.selinuxproject.org/~serge/selinux-testsuite.
>> Once it goes into a kernel I can make the test kernel version-specific
>> and thus ensure it passes on old and new kernels.
>
> I just applied the kernel patch to the SELinux next branch and ran the
> testsuite against it to ensure everything was okay and ran into the problems
> below:
>
> <<<<
> Running as user root with context unconfined_u:unconfined_r:unconfined_t
>
> domain_trans/test ....... ok
> entrypoint/test ......... ok
> execshare/test .......... ok
> exectrace/test .......... ok
> execute_no_trans/test ... ok
> fdreceive/test .......... ok
> inherit/test ............ ok
> link/test ............... ok
> mkdir/test .............. ok
> msg/test ................ ok
> nnp/test ................ 1/4 # Test 1 got: "32256" (nnp/test at line 19)
> # Expected: "0"
> # nnp/test line 19 is: ok($result,0); #this should pass
> # Test 2 got: "256" (nnp/test at line 23)
> # Expected: "0"
> # nnp/test line 23 is: ok($result,0); #this should pass
> nnp/test ................ Failed 2/4 subtests
This is the output I get on an unpatched kernel.
On the patched kernel, all tests pass.
> open/test ............... ok
> ptrace/test ............. ok
> readlink/test ........... ok
> relabel/test ............ ok
> rename/test ............. ok
> rxdir/test .............. ok
> sem/test ................ ok
> setattr/test ............ ok
> setnice/test ............ ok
> shm/test ................ ok
> sigkill/test ............ ok
> stat/test ............... ok
> sysctl/test ............. ok
> task_create/test ........ ok
> task_setnice/test ....... ok
> task_setscheduler/test .. ok
> task_getscheduler/test .. ok
> task_getsid/test ........ ok
> task_getpgid/test ....... ok
> task_setpgid/test ....... ok
> wait/test ............... ok
> file/test ............... ok
> ioctl/test .............. ok
> capable_file/test ....... ok
> capable_net/test ........ ok
> capable_sys/test ........ ok
> dyntrans/test ........... ok
> dyntrace/test ........... ok
> bounds/test ............. ok
> <<<<
>
> When I run the test by hand using the command line below, the following
> appears in the audit log:
Just FYI, you can more easily re-run the failed test just by running its
test script, e.g. ./nnp/test, rather than manually running individual
commands from it.
>
> # ls -Z checkcon
> unconfined_u:object_r:test_nnp_bounded_exec_t:s0 checkcon
> # ./execnnp runcon -t test_nnp_bounded_t ./checkcon test_nnp_bounded_t
> runcon: ./checkcon: Permission denied
>
> <<<<
> type=SELINUX_ERR msg=audit(1409261360.961:1953): op=security_compute_av
> reason=bounds scontext=unconfined_u:unconfined_r:test_nnp_bounded_t:s0-
> s0:c0.c1023 tcontext=unconfined_u:object_r:test_nnp_bounded_exec_t:s0
> tclass=file perms=entrypoint
Ok, so since your base policy does not allow unconfined_t entrypoint to
all file types, it was denied to test_nnp_bounded_t since it is bounded
by unconfined_t.
> type=AVC msg=audit(1409261360.961:1953): avc: denied { entrypoint } for
> pid=15556 comm="runcon" path="/root/sources/selinux_testsuite-
> upstream/tests/nnp/checkcon" dev="vda3" ino=423593
> scontext=unconfined_u:unconfined_r:test_nnp_bounded_t:s0-s0:c0.c1023
> tcontext=unconfined_u:object_r:test_nnp_bounded_exec_t:s0 tclass=file
> permissive=0
> type=SYSCALL msg=audit(1409261360.961:1953): arch=c000003e syscall=59
> success=no exit=-13 a0=7fffd720e76c a1=7fffd720df50 a2=7fffd720df68
> a3=6e5f747365743a72 items=0 ppid=4569 pid=15556 auid=0 uid=0 gid=0 euid=0
> suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts1 ses=4 comm="runcon"
> exe="/usr/bin/runcon" subj=unconfined_u:unconfined_r:unconfined_t:s0-
> s0:c0.c1023 key=(null)
> <<<<
>
> Unfortunately that is about as far as I'm going to be able to get today on
> this, so I'm tossing this out hoping you'll have an answer before I can touch
> this next.
It runs fine on Fedora 20. I am guessing you are running on rawhide /
Fedora 21, and that this is a difference in your base policy. Try this
patch for selinux-testsuite on top of the current one.
[-- Attachment #2: 0001-Explicitly-allow-unconfined_t-entrypoint-to-test_nnp.patch --]
[-- Type: text/x-patch, Size: 864 bytes --]
>From fb7a3f11041213e3babba1b7b65d8aff014799bc Mon Sep 17 00:00:00 2001
From: Stephen Smalley <sds@tycho.nsa.gov>
Date: Fri, 29 Aug 2014 08:50:20 -0400
Subject: [PATCH] Explicitly allow unconfined_t entrypoint to
test_nnp_bounded_exec_t.
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
---
policy/test_nnp.te | 1 +
1 file changed, 1 insertion(+)
diff --git a/policy/test_nnp.te b/policy/test_nnp.te
index 55eccd8..206882d 100644
--- a/policy/test_nnp.te
+++ b/policy/test_nnp.te
@@ -13,6 +13,7 @@ typebounds unconfined_t test_nnp_bounded_t;
type test_nnp_bounded_exec_t;
files_type(test_nnp_bounded_exec_t)
domain_entry_file(test_nnp_bounded_t, test_nnp_bounded_exec_t)
+domain_entry_file(unconfined_t, test_nnp_bounded_exec_t)
# Run it! This should succeed on patched kernels, fail on old ones.
unconfined_runs_test(test_nnp_bounded_t)
--
1.9.3
next prev parent reply other threads:[~2014-08-29 13:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-04 17:36 [PATCH v2] selinux: Permit bounded transitions under NO_NEW_PRIVS or NOSUID Stephen Smalley
2014-08-12 18:01 ` Andy Lutomirski
2014-08-12 18:06 ` Stephen Smalley
2014-08-12 18:56 ` Andy Lutomirski
2014-08-12 19:08 ` Paul Moore
2014-08-12 19:12 ` Andy Lutomirski
2014-08-12 19:21 ` Stephen Smalley
2014-08-12 19:29 ` Andy Lutomirski
2014-08-28 21:36 ` Paul Moore
2014-08-29 13:12 ` Stephen Smalley [this message]
2014-08-29 18:20 ` 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=54007C2A.1040504@tycho.nsa.gov \
--to=sds@tycho.nsa.gov \
--cc=luto@amacapital.net \
--cc=paul@paul-moore.com \
--cc=selinux@tycho.nsa.gov \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.