Bug 810959 - File contexts for nvidia libraries are overridden by the default rule
File contexts for nvidia libraries are overridden by the default rule
Product: Fedora
Classification: Fedora
Component: selinux-policy-targeted (Show other bugs)
x86_64 Linux
unspecified Severity unspecified
: ---
: ---
Assigned To: Miroslav Grepl
Ben Levenson
Depends On:
  Show dependency treegraph
Reported: 2012-04-09 14:20 EDT by Göran Uddeborg
Modified: 2012-04-25 00:59 EDT (History)
1 user (show)

See Also:
Fixed In Version: selinux-policy-3.10.0-118.fc17
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-04-25 00:59:15 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Göran Uddeborg 2012-04-09 14:20:10 EDT
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):

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 14:32:48 EDT
Fixed in selinux-policy-3.10.0-112.fc17
Comment 2 Fedora Update System 2012-04-23 02:43:34 EDT
selinux-policy-3.10.0-117.fc17 has been submitted as an update for Fedora 17.
Comment 3 Fedora Update System 2012-04-23 20:56:20 EDT
selinux-policy-3.10.0-118.fc17 has been submitted as an update for Fedora 17.
Comment 4 Fedora Update System 2012-04-23 23:15:05 EDT
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:
then log in and leave karma (feedback).
Comment 5 Fedora Update System 2012-04-25 00:59:15 EDT
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.

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