Bug 801988 - SELinux AVC Denial
SELinux AVC Denial
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: selinux-policy (Show other bugs)
16
x86_64 Linux
unspecified Severity unspecified
: ---
: ---
Assigned To: Miroslav Grepl
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-09 22:39 EST by batth.maninder
Modified: 2013-02-13 13:53 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-02-13 13:53:15 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description batth.maninder 2012-03-09 22:39:18 EST
Description of problem:
I get an error in the SELinux Alert Browser with the description that SELinux has detected a problem.
The source process: /sbin/ldconfig Attempted this access: read 
On this lnk_file: libOpenCL.so
This happened when i recently updated fedora 16 to 3.3.9-1fc16.x86_64 version

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:


SELinux is preventing /sbin/ldconfig from read access on the lnk_file /opt/AMDAPP/lib/x86/libOpenCL.so.

*****  Plugin restorecon (99.5 confidence) suggests  *************************

If you want to fix the label. 
/opt/AMDAPP/lib/x86/libOpenCL.so default label should be lib_t.
Then you can run restorecon.
Do
# /sbin/restorecon -v /opt/AMDAPP/lib/x86/libOpenCL.so

*****  Plugin catchall (1.49 confidence) suggests  ***************************

If you believe that ldconfig should be allowed read access on the libOpenCL.so lnk_file 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 ldconfig /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                unconfined_u:system_r:ldconfig_t:s0-s0:c0.c1023
Target Context                unconfined_u:object_r:user_home_t:s0
Target Objects                /opt/AMDAPP/lib/x86/libOpenCL.so [ lnk_file ]
Source                        ldconfig
Source Path                   /sbin/ldconfig
Port                          <Unknown>
Host                          cplus
Source RPM Packages           glibc-2.14.90-24.fc16.6.x86_64
                              glibc-2.14.90-24.fc16.6.i686
Target RPM Packages           
Policy RPM                    selinux-policy-3.10.0-75.fc16.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     cplus
Platform                      Linux cplus 3.2.9-1.fc16.x86_64 #1 SMP Thu Mar 1
                              01:41:10 UTC 2012 x86_64 x86_64
Alert Count                   16
First Seen                    Wed 07 Mar 2012 12:51:10 PM CST
Last Seen                     Fri 09 Mar 2012 09:25:08 PM CST
Local ID                      64187bc5-98ea-4007-afdc-bd97cca18b03

Raw Audit Messages
type=AVC msg=audit(1331349908.920:80): avc:  denied  { read } for  pid=3174 comm="ldconfig" name="libOpenCL.so" dev=dm-1 ino=1453282 scontext=unconfined_u:system_r:ldconfig_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=lnk_file


type=SYSCALL msg=audit(1331349908.920:80): arch=x86_64 syscall=stat success=no exit=EACCES a0=7fffa16572a0 a1=7fffa16583a0 a2=7fffa16583a0 a3=1 items=0 ppid=2650 pid=3174 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts1 ses=2 comm=ldconfig exe=/sbin/ldconfig subj=unconfined_u:system_r:ldconfig_t:s0-s0:c0.c1023 key=(null)

Hash: ldconfig,ldconfig_t,user_home_t,lnk_file,read

audit2allow

#============= ldconfig_t ==============
allow ldconfig_t user_home_t:lnk_file read;

audit2allow -R

#============= ldconfig_t ==============
allow ldconfig_t user_home_t:lnk_file read;
Comment 1 Daniel Walsh 2012-03-10 06:22:55 EST
Do you have a symbolic link to a shared library in your homedir?
Comment 2 David K. Means 2012-03-22 13:37:47 EDT
It seems I have a similar problem:

I've just installed F16, and am finding AVC denials in /var/log.  Here are the extracted rules from the audit log.
________________________________________________________________
module recent 1.0;

require {
	type unconfined_t;
	type unlabeled_t;
	type var_log_t;
	type locate_t;
	type freshclam_t;
	type ldconfig_t;
	class dir { read getattr };
	class file { relabelto open };
}

#============= freshclam_t ==============
allow freshclam_t var_log_t:file open;

#============= ldconfig_t ==============
allow ldconfig_t var_log_t:dir read;

#============= locate_t ==============
allow locate_t unlabeled_t:dir getattr;

#============= unconfined_t ==============
allow unconfined_t freshclam_t:file relabelto;
__________________________________________________________________

The "unconfined_t: relabelto;" item is almost certainly due to my (failed) attempt to relabel one or more of the logfiles using chcon.

The offending accesses were freshclam attempting to open /var/log/freshclam.log and ldconfig attempting to read /var/log
Comment 3 Dominick Grift 2012-03-22 13:56:21 EDT
(In reply to comment #2)

> 
> #============= freshclam_t ==============
> allow freshclam_t var_log_t:file open;
> 
> #============= ldconfig_t ==============
> allow ldconfig_t var_log_t:dir read;

Can you enclose the raw audit message of the events above?

> 
> #============= locate_t ==============
> allow locate_t unlabeled_t:dir getattr;

That directory needs its context restored. (you can get the inode# of this object in the avc denial and use that to find this directory with find / -inum, then you can restorecon -R -v the location.

> #============= unconfined_t ==============
> allow unconfined_t freshclam_t:file relabelto;

freshclam_t is a process type you cannot label files with process types:

http://danwalsh.livejournal.com/54803.html

> __________________________________________________________________
> 
> The "unconfined_t: relabelto;" item is almost certainly due to my (failed)
> attempt to relabel one or more of the logfiles using chcon.
> 
> The offending accesses were freshclam attempting to open /var/log/freshclam.log
> and ldconfig attempting to read /var/log
Comment 4 David K. Means 2012-03-24 14:47:11 EDT
I appreciate Dan's comment about freshclam_t being a process type, not a file type.  My question then is why SELinux Troubleshooter recommended that I include such a rule for unconfined_t.  Maybe that is a separate bug belonging elsewhere?

The raw audit messages for the freshclam log open are:

type=AVC msg=audit(1332431920.466:599): avc:  denied  { open } for  pid=27578 comm="freshclam" name="freshclam.log" dev=md0 ino=6197 scontext=system_u:system_r:freshclam_t:s0-s0:c0.c1023 tcontext=system_u:object_r:var_log_t:s0 tclass=file
type=SYSCALL msg=audit(1332431920.466:599): arch=40000003 syscall=5 success=no exit=-13 a0=90ef6f8 a1=441 a2=1b6 a3=0 items=0 ppid=27431 pid=27578 auid=0 uid=991 gid=988 euid=991 suid=991 fsuid=

For ldconfig, there are several entries together:
type=AVC msg=audit(1332435928.254:622): avc:  denied  { read } for  pid=27801 comm="ldconfig" path="/var/log" dev=md0 ino=12 scontext=system_u:system_r:ldconfig_t:s0 tcontext=system_u:object_r:var_log_t:s0 tclass=dir
type=AVC msg=audit(1332435928.254:622): avc:  denied  { read } for  pid=27801 comm="ldconfig" path="/var/log" dev=md0 ino=12 scontext=system_u:system_r:ldconfig_t:s0 tcontext=system_u:object_r:var_log_t:s0 tclass=dir
type=SYSCALL msg=audit(1332435928.254:622): arch=40000003 syscall=11 success=yes exit=0 a0=b8e0300 a1=b06a400 a2=bfee1964 a3=bfee1964 items=0 ppid=27700 pid=27801 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts4 ses=4294967295 comm="ldconfig" exe="/sbin/ldconfig" subj=system_u:system_r:ldconfig_t:s0 key=(null)
type=AVC msg=audit(1332435955.653:623): avc:  denied  { read } for  pid=27868 comm="ldconfig" path="/var/log" dev=md0 ino=12 scontext=system_u:system_r:ldconfig_t:s0 tcontext=system_u:object_r:var_log_t:s0 tclass=dir
type=AVC msg=audit(1332435955.653:623): avc:  denied  { read } for  pid=27868 comm="ldconfig" path="/var/log" dev=md0 ino=12 scontext=system_u:system_r:ldconfig_t:s0 tcontext=system_u:object_r:var_log_t:s0 tclass=dir
type=SYSCALL msg=audit(1332435955.653:623): arch=40000003 syscall=11 success=yes exit=0 a0=b8e0300 a1=d010e78 a2=bfee1964 a3=bfee1964 items=0 ppid=27700 pid=27868 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts4 ses=4294967295 comm="ldconfig" exe="/sbin/ldconfig" subj=system_u:system_r:ldconfig_t:s0 key=(null)
Comment 5 Miroslav Grepl 2012-03-26 07:48:33 EDT
Do you have this sealert which recommended it to you?
Comment 6 David K. Means 2012-03-26 15:14:12 EDT
Sorry for the delay; I had to study some in order to resurrect this alert.  Here is the relevant stuff from "sealert -a /var/log/audit/audit.log"

I am working from memory, but I believe that the command I gave to provoke this response was
  " #chcon -t freshclam_t freshclam.log", which is clearly incorrect, in light of Dan Walsh's note above.

Raw Audit Messages
type=AVC msg=audit(1332434938.92:614): avc:  denied  { relabelto } for  pid=27669 comm="chcon" name="freshclam.log" dev=md0 ino=6197 scontext=system_u:unconfined_r:unconfined_t:s0 tcontext=system_u:object_r:freshclam_t:s0 tclass=file


type=SYSCALL msg=audit(1332434938.92:614): arch=i386 syscall=setxattr success=no exit=EACCES a0=999a8d8 a1=416db1cb a2=999bc80 a3=21 items=0 ppid=22280 pid=27669 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts4 ses=4294967295 comm=chcon exe=/usr/bin/chcon subj=system_u:unconfined_r:unconfined_t:s0 key=(null)

Hash: chcon,unconfined_t,freshclam_t,file,relabelto

audit2allow

#============= unconfined_t ==============
allow unconfined_t freshclam_t:file relabelto;

audit2allow -R

#============= unconfined_t ==============
allow unconfined_t freshclam_t:file relabelto;
Comment 7 Daniel Walsh 2012-03-27 15:09:50 EDT
We should back port the current setroubleshoot/setroubleshoot-plugins from F17 to F16. To give a good sealert for this.
Comment 8 Fedora End Of Life 2013-01-16 10:44:16 EST
This message is a reminder that Fedora 16 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 16. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '16'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 16's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 16 is end of life. If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora, you are encouraged to click on 
"Clone This Bug" and open it against that version of Fedora.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 9 Fedora End Of Life 2013-02-13 13:53:19 EST
Fedora 16 changed to end-of-life (EOL) status on 2013-02-12. Fedora 16 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

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