Bug 707006 - SELinux is preventing /sbin/load_policy from read, write access on the unix_stream_socket unix_stream_socket.
Summary: SELinux is preventing /sbin/load_policy from read, write access on the unix_s...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 14
Hardware: i386
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: setroubleshoot_trace_hash:07d8cdf1b03...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-05-23 17:52 UTC by Robert Martin
Modified: 2011-07-12 05:17 UTC (History)
3 users (show)

Fixed In Version: selinux-policy-3.9.7-42.fc14
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-07-12 05:17:37 UTC
Type: ---


Attachments (Terms of Use)

Description Robert Martin 2011-05-23 17:52:16 UTC
SELinux is preventing /sbin/load_policy from read, write access on the unix_stream_socket unix_stream_socket.

*****  Plugin leaks (50.5 confidence) suggests  ******************************

If you want to ignore load_policy trying to read write access the unix_stream_socket unix_stream_socket, because you believe it should not need this access.
Then you should report this as a bug.  
You can generate a local policy module to dontaudit this access.
Do
# grep /sbin/load_policy /var/log/audit/audit.log | audit2allow -D -M mypol
# semodule -i mypol.pp

*****  Plugin catchall (50.5 confidence) suggests  ***************************

If you believe that load_policy should be allowed read write access on the unix_stream_socket unix_stream_socket by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# grep load_policy /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                unconfined_u:unconfined_r:load_policy_t:s0-s0:c0.c
                              1023
Target Context                unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1
                              023
Target Objects                unix_stream_socket [ unix_stream_socket ]
Source                        load_policy
Source Path                   /sbin/load_policy
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           policycoreutils-2.0.85-28.fc14
Target RPM Packages           
Policy RPM                    selinux-policy-3.9.7-40.fc14
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     (removed)
Platform                      Linux (removed) 2.6.35.13-91.fc14.i686
                              #1 SMP Tue May 3 13:36:36 UTC 2011 i686 i686
Alert Count                   1
First Seen                    Mon 23 May 2011 12:48:42 PM CDT
Last Seen                     Mon 23 May 2011 12:48:42 PM CDT
Local ID                      6141500a-b9e4-4989-a799-219bf75ff145

Raw Audit Messages
type=AVC msg=audit(1306172922.535:121): avc:  denied  { read write } for  pid=5469 comm="load_policy" path="socket:[117938]" dev=sockfs ino=117938 scontext=unconfined_u:unconfined_r:load_policy_t:s0-s0:c0.c1023 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tclass=unix_stream_socket


type=SYSCALL msg=audit(1306172922.535:121): arch=i386 syscall=execve success=yes exit=0 a0=9f08a20 a1=9c00360 a2=0 a3=0 items=0 ppid=5422 pid=5469 auid=500 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=1 comm=load_policy exe=/sbin/load_policy subj=unconfined_u:unconfined_r:load_policy_t:s0-s0:c0.c1023 key=(null)

Hash: load_policy,load_policy_t,unconfined_t,unix_stream_socket,read,write

audit2allow

#============= load_policy_t ==============
allow load_policy_t unconfined_t:unix_stream_socket { read write };

audit2allow -R

#============= load_policy_t ==============
allow load_policy_t unconfined_t:unix_stream_socket { read write };

Comment 1 Dominick Grift 2011-05-23 18:09:09 UTC
This seems to be a leaked file descriptor issue but besides that seems that this functionality is currently also missing i suspect.

Could you please try:

mkdir ~/mytest; cd ~/mytest; echo "policy_module(mytest, 1.0.0) gen_require(\` type unconfined_t; role unconfined_r; ') seutil_run_loadpolicy(unconfined_t, unconfined_r)" > mytest.pp

make -f /usr/share/selinux/devel/Makefile mytest.pp
sudo semodule -i mytest.pp

... reproduce the issue and see if this solves your problem?

Comment 2 Dominick Grift 2011-05-23 18:19:19 UTC
Actually that seems to be a bad idea.

Please remove the module i suggested above if you have installed it:

semodule -r mytest

Do you have any custom modules implemented with regard to running load_policy?

unconfined_t probably should not transition to the load_policy_t domain i suspect.

Could you provide us with some background information as to what you were trying to achieve?

Comment 3 Daniel Walsh 2011-05-23 19:31:14 UTC
I have a feeling this is happening as part of a transaction, like yum, which is leaking a file descriptor to load_policy.


unconfined_t transitions to semanage_t which transitions to load_policy.  It needs to do this in order to keep the labeling correct.  

In F15 we dontaudit these types of leaks.

Comment 4 Dominick Grift 2011-05-23 19:36:18 UTC
We could add the seutil_run_load_policy(unconfined_t) to unconfineduser.te. It is already able to transition to many other seutils. Adding this call will also take care of the leaks and any labeling issues.

Comment 5 Daniel Walsh 2011-05-23 19:53:01 UTC
yes

Comment 7 Miroslav Grepl 2011-05-27 10:51:12 UTC
Fixed in selinux-policy-3.9.7-42.fc14

Comment 8 Fedora Update System 2011-05-27 15:46:33 UTC
selinux-policy-3.9.7-42.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/selinux-policy-3.9.7-42.fc14

Comment 9 Fedora Update System 2011-05-27 20:28:29 UTC
Package selinux-policy-3.9.7-42.fc14:
* should fix your issue,
* was pushed to the Fedora 14 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.9.7-42.fc14'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/selinux-policy-3.9.7-42.fc14
then log in and leave karma (feedback).

Comment 10 Fedora Update System 2011-07-12 05:16:00 UTC
selinux-policy-3.9.7-42.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.