Bug 670841 - SELinux is preventing /lib/systemd/systemd-readahead-collect from 'write' accesses on the directory readahead.
Summary: SELinux is preventing /lib/systemd/systemd-readahead-collect from 'write' acc...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: rawhide
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: setroubleshoot_trace_hash:e49ee6ae9cf...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-01-19 14:14 UTC by Paolo Bonzini
Modified: 2011-01-19 15:43 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-01-19 15:43:33 UTC
Type: ---


Attachments (Terms of Use)

Description Paolo Bonzini 2011-01-19 14:14:13 UTC
SELinux is preventing /lib/systemd/systemd-readahead-collect from 'write' accesses on the directory readahead.

I believe this to need a new context as well, however it failed:

# ls -lZ readahead/
-rw-rw-r--. root root system_u:object_r:device_t:s0    done
# semanage fcontext -a -t readahead_var_run_t '/dev/\.systemd/readahead(/.*)?'
[root@playground .systemd]
# restorecon -vR readahead/
restorecon reset /dev/.systemd/readahead context system_u:object_r:device_t:s0->system_u:object_r:readahead_var_run_t:s0
restorecon set context /dev/.systemd/readahead->system_u:object_r:readahead_var_run_t:s0 failed:'Permission denied'
# ls -lZ readahead/
-rw-rw-r--. root root system_u:object_r:device_t:s0    done

*****  Plugin catchall (100. confidence) suggests  ***************************

If you believe that systemd-readahead-collect should be allowed write access on the readahead directory 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 systemd-readahe /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:readahead_t:s0
Target Context                system_u:object_r:device_t:s0
Target Objects                readahead [ dir ]
Source                        systemd-readahe
Source Path                   /lib/systemd/systemd-readahead-collect
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           systemd-16-1.fc15
Target RPM Packages           
Policy RPM                    selinux-policy-3.9.12-8.fc15
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed)
                              2.6.37-2.fc15.x86_64 #1 SMP Fri Jan 7 14:57:36 UTC
                              2011 x86_64 x86_64
Alert Count                   1
First Seen                    Wed 19 Jan 2011 02:21:19 PM CET
Last Seen                     Wed 19 Jan 2011 02:21:19 PM CET
Local ID                      382e27ca-0218-4678-9bb8-a668ff606fbd

Raw Audit Messages
type=AVC msg=audit(1295443279.526:115): avc:  denied  { write } for  pid=6681 comm="systemd-readahe" name="readahead" dev=devtmpfs ino=53283 scontext=system_u:system_r:readahead_t:s0 tcontext=system_u:object_r:device_t:s0 tclass=dir


type=SYSCALL msg=audit(1295443279.526:115): arch=x86_64 syscall=open success=no exit=EACCES a0=407b90 a1=80042 a2=1a4 a3=7fffd4001be0 items=0 ppid=1 pid=6681 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=systemd-readahe exe=/lib/systemd/systemd-readahead-collect subj=system_u:system_r:readahead_t:s0 key=(null)

Hash: systemd-readahe,readahead_t,device_t,dir,write

audit2allow

#============= readahead_t ==============
#!!!! The source type 'readahead_t' can write to a 'dir' of the following types:
# readahead_var_lib_t, readahead_var_run_t, root_t, var_run_t, root_t

allow readahead_t device_t:dir write;

audit2allow -R

#============= readahead_t ==============
#!!!! The source type 'readahead_t' can write to a 'dir' of the following types:
# readahead_var_lib_t, readahead_var_run_t, root_t, var_run_t, root_t

allow readahead_t device_t:dir write;

Comment 1 Paolo Bonzini 2011-01-19 14:18:56 UTC
It failed in turn because of "SELinux is preventing /sbin/setfiles from associate access on the filesystem readahead" (that is /dev/.systemd/readahead).

I temporarily added a new policy for that and could relabel /dev/.systemd/readahead successfully to readahead_var_run_t.

Comment 2 Daniel Walsh 2011-01-19 15:43:33 UTC
Fixed in next version in rawhide.


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