Bug 560488 - SELinux is preventing /usr/libexec/gdm-simple-slave "read" access on /root/.Xdefaults.
Summary: SELinux is preventing /usr/libexec/gdm-simple-slave "read" access on /root/.X...
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 12
Hardware: x86_64
OS: Linux
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
Whiteboard: setroubleshoot_trace_hash:b01b9457649...
Depends On:
TreeView+ depends on / blocked
Reported: 2010-01-31 22:33 UTC by Richard Calmbach
Modified: 2010-02-11 14:43 UTC (History)
2 users (show)

Fixed In Version: 3.6.32-84.fc12
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2010-02-11 14:43:37 UTC

Attachments (Terms of Use)

Description Richard Calmbach 2010-01-31 22:33:30 UTC
I get this SELinux alert even though I'm logging in as a regular user, not as root. Maybe it happens whenever a graphical app runs with elevated privileges, not sure. There don't seem to be any other problems due to this - just the alert. If I had settings in /root/.Xdefaults that matter for the apps running as root, they would probably be missing.

Looks like an SELinux policy/labeling problem.


SELinux is preventing /usr/libexec/gdm-simple-slave "read" access on

Detailed Description:

SELinux denied access requested by gdm-simple-slav. It is not expected that this
access is required by gdm-simple-slav and this access may signal an intrusion
attempt. It is also possible that the specific version or configuration of the
application is causing it to require additional access.

Allowing Access:

You can generate a local policy module to allow this access - see FAQ
(http://docs.fedoraproject.org/selinux-faq-fc5/#id2961385) Please file a bug

Additional Information:

Source Context                system_u:system_r:xdm_t:s0-s0:c0.c1023
Target Context                system_u:object_r:admin_home_t:s0
Target Objects                /root/.Xdefaults [ file ]
Source                        gdm-simple-slav
Source Path                   /usr/libexec/gdm-simple-slave
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           gdm-2.28.2-1.fc12
Target RPM Packages           
Policy RPM                    selinux-policy-3.6.32-73.fc12
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Plugin Name                   catchall
Host Name                     (removed)
Platform                      Linux (removed) #1 SMP
                              Mon Jan 18 19:52:07 UTC 2010 x86_64 x86_64
Alert Count                   42
First Seen                    Tue 12 Jan 2010 09:33:44 PM PST
Last Seen                     Sun 31 Jan 2010 01:24:20 PM PST
Local ID                      c08d7e59-ab10-48ba-9cc1-b39c80e3a50d
Line Numbers                  

Raw Audit Messages            

node=(removed) type=AVC msg=audit(1264973060.387:12): avc:  denied  { read } for  pid=1791 comm="gdm-simple-slav" name=".Xdefaults" dev=dm-0 ino=50712 scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=system_u:object_r:admin_home_t:s0 tclass=file

node=(removed) type=SYSCALL msg=audit(1264973060.387:12): arch=c000003e syscall=2 success=no exit=-13 a0=7fffc3ad9980 a1=0 a2=fef a3=1999999999999999 items=0 ppid=1714 pid=1791 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="gdm-simple-slav" exe="/usr/libexec/gdm-simple-slave" subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 key=(null)
Hash String generated from  selinux-policy-3.6.32-73.fc12,catchall,gdm-simple-slav,xdm_t,admin_home_t,file,read
audit2allow suggests:

#============= xdm_t ==============
allow xdm_t admin_home_t:file read;

Comment 1 Richard Calmbach 2010-01-31 23:27:01 UTC
Bug 505797 (reported against F11) seems to be related to this bug.

Comment 2 Daniel Walsh 2010-02-01 20:40:31 UTC
Remove this file from the /root directory and it will stop complaining.  I think this got created when you logged in as root via X?

Comment 3 Richard Calmbach 2010-02-01 21:35:38 UTC
Well, sure, removing the file will get rid of the alert and one can make all kinds of arguments that running X as root is not advisable. However, that's a policy question that is orthogonal to the problem at hand. There may be legitimate reasons why root needs a .Xdefaults file. Also, the alert did not happen under F10 and suddenly started with F12, so something about the SELinux configuration has changed and the access denial is - I think - unintended. There have been lots of unintended SELinux access denials in the past where the solution was to revise the SELinux policy definitions - why not this time?

Just to be sure: I put the .Xdefaults there deliberately. It contains my preferences for X properties such as xterm font and colors, keyboard shortcuts for window scrolling, etc. - just settings I rely on when running X (if that's as root it's only for rare troubleshooting purposes, but it has been useful before).

FWIW: I noticed that every time I reboot another 7 occurrences of this alert are created but not when I start a graphical app, even when it requires entering the root password (e.g. a tool from the System->Administration menu).

So, to summarize: I'm not disputing that root shouldn't run X. It just seems this access denial is not serving a useful purpose and may in fact be unintended.

Comment 4 Daniel Walsh 2010-02-02 13:17:39 UTC
Ok, we could label it xdm_home_t.

# semanage fcontext -a -t xdm_home_t /root/.Xdefaults
# restorecon -R -v /root

And then it the AVC will go away.  This would allow a corrupted xdm to write to this file.

We could label it with a gnome label gnome_home_t.  

Like these.

/root/\.config(/.*)?	gen_context(system_u:object_r:gnome_home_t,s0)
/root/\.gconf(d)?(/.*)?	gen_context(system_u:object_r:gconf_home_t,s0)
/root/\.gnome2(/.*)?	gen_context(system_u:object_r:gnome_home_t,s0)
/root/\.local.*		gen_context(system_u:object_r:gconf_home_t,s0)
/root/\.pulse(/.*)?	gen_context(system_u:object_r:gnome_home_t,s0)
/root/\.gstreamer-.*	gen_context(system_u:object_r:gstreamer_home_t,s0)

And then xdm could read it.  

Or we can create a new label for it.  xserver_conf_t?

Comment 5 Richard Calmbach 2010-02-02 20:13:23 UTC
This sounds good. I don't know enough about SELinux or xdm to comment on the finer details of which approach is better but read access is probably sufficient. It's your call.

Comment 6 Daniel Walsh 2010-02-02 21:37:39 UTC
For now Richard, just label it xdm_home_t

chcon -t xdm_home_t /root/.Xdefaults

Comment 7 Daniel Walsh 2010-02-02 21:42:10 UTC
Miroslav add

/root/\.Xdefaults	gen_context(system_u:object_r:gnome_home_t,s0)

Comment 8 Miroslav Grepl 2010-02-03 09:35:49 UTC
Fixed in selinux-policy-3.6.32-82.fc12

Comment 9 Fedora Update System 2010-02-03 23:21:07 UTC
selinux-policy-3.6.32-82.fc12 has been submitted as an update for Fedora 12.

Comment 10 Fedora Update System 2010-02-05 01:46:08 UTC
selinux-policy-3.6.32-84.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update selinux-policy'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F12/FEDORA-2010-1492

Comment 11 Fedora Update System 2010-02-11 14:39:13 UTC
selinux-policy-3.6.32-84.fc12 has been pushed to the Fedora 12 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.