Bug 810959

Summary: File contexts for nvidia libraries are overridden by the default rule
Product: [Fedora] Fedora Reporter: Göran Uddeborg <goeran>
Component: selinux-policy-targetedAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Ben Levenson <benl>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 17CC: dwalsh
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.10.0-118.fc17 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-04-25 04:59:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Göran Uddeborg 2012-04-09 18:20:10 UTC
Description of problem:
Setroubleshoot reported the following AVC:

type=AVC msg=audit(1333912858.743:429): avc:  denied  { execmod } for  pid=7118 comm="npviewer.bin" path="/usr/lib/nvidia/libnvidia-glcore.so.290.10" dev="sda2" ino=3926043 scontext=unconfined_u:unconfined_r:mozilla_plugin_t:s0-s0:c0.c1023 tcontext=system_u:object_r:lib_t:s0 tclass=file

Setroubleshoot suggests changing the context to textrel_shlib_t.  I believe that used to be the default, and there are still file context rules in the policy intended to give them that context.  But they are overridden by the default rule for the entire /usr/lib tree.  The Nvidia patterns have regular expressions that start earlier in the path than the default rule, which I guess is the reason this happens.

freddi$ findcon /etc/selinux/targeted/contexts/files/file_contexts -p /usr/lib/nvidia/libnvidia-glcore.so.290.10
/.*             system_u:object_r:default_t:s0
/usr/.*         system_u:object_r:usr_t:s0
/usr/(.*/)?lib(/.*)?            system_u:object_r:lib_t:s0
/usr/(local/)?.*\.so(\.[^/]*)*  --      system_u:object_r:lib_t:s0
/usr/(.*/)?nvidia/.+\.so(\..*)? --      system_u:object_r:textrel_shlib_t:s0
/usr/(.*/)?lib(/.*)?/nvidia/.+\.so(\..*)?       --      system_u:object_r:textrel_shlib_t:s0
/usr/lib(/.*)?/nvidia/.+\.so(\..*)?     --      system_u:object_r:textrel_shlib_t:s0
/usr/lib(/.*)?/libnvidia.+\.so(\.[^/]*)*        --      system_u:object_r:textrel_shlib_t:s0
/usr/lib/.*             system_u:object_r:lib_t:s0



Version-Release number of selected component (if applicable):
selinux-policy-targeted-3.10.0-110.fc17.noarch

How reproducible:
It is persistent.  Changing the contexts to something else and running restorecon on one of the files puts it back to lib_t.

Steps to Reproduce:
1. Install nvidia libraries in /usr/lib/nvidia
2. Run restorecon on the files in the directory

Actual results:
freddi$ ll -Z /usr/lib/nvidia/libnvidia-glcore.so.290.10
-rwxr-xr-x. root root system_u:object_r:lib_t:SystemLow /usr/lib/nvidia/libnvidia-glcore.so.290.10


Expected results:
freddi$ ll -Z /usr/lib/nvidia/libnvidia-glcore.so.290.10
-rwxr-xr-x. root root system_u:object_r:textrel_shlib_t:SystemLow /usr/lib/nvidia/libnvidia-glcore.so.290.10

Comment 1 Daniel Walsh 2012-04-09 18:32:48 UTC
Fixed in selinux-policy-3.10.0-112.fc17

Comment 2 Fedora Update System 2012-04-23 06:43:34 UTC
selinux-policy-3.10.0-117.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/selinux-policy-3.10.0-117.fc17

Comment 3 Fedora Update System 2012-04-24 00:56:20 UTC
selinux-policy-3.10.0-118.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/selinux-policy-3.10.0-118.fc17

Comment 4 Fedora Update System 2012-04-24 03:15:05 UTC
Package selinux-policy-3.10.0-118.fc17:
* should fix your issue,
* was pushed to the Fedora 17 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.10.0-118.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-6452/selinux-policy-3.10.0-118.fc17
then log in and leave karma (feedback).

Comment 5 Fedora Update System 2012-04-25 04:59:15 UTC
selinux-policy-3.10.0-118.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.