Bug 891705 - tmpwatch AVC denial with tmpfs /tmp
tmpwatch AVC denial with tmpfs /tmp
Product: Fedora
Classification: Fedora
Component: selinux-policy-targeted (Show other bugs)
x86_64 Linux
unspecified Severity low
: ---
: ---
Assigned To: Miroslav Grepl
Ben Levenson
Depends On:
  Show dependency treegraph
Reported: 2013-01-03 13:31 EST by Rob Millner
Modified: 2013-11-17 19:45 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-07-04 06:16:48 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 Rob Millner 2013-01-03 13:31:20 EST
Description of problem:
On Fedora 17, I have /tmp mounted as a tmpfs via /etc/fstab.

Tmpwatch occasionally gets an AVC denial on a specific directory in /tmp.  The directory holds certificate files and appear to be managed by libmobildevice.

Low severity since I could probably both ignore the denial and do away with tmpwatch in this configuration.

Version-Release number of selected component (if applicable):
Fedora 17
This may affect tmp-on-tmpfs for Fedora 18 ( Bug 826015 )

How reproducible:


Steps to Reproduce:
1. Make /tmp a tmpfs
2. Plug an iPhone in to USB to let it charge
3. Wait
Actual results:
AVC denial (see below)

Expected results:
No AVC denial.

Additional info:

The directory in question:

[root@splat tmp]# ls -lZRa root
drwxr-xr-x. root root system_u:object_r:tmpfs_t:s0     .
drwxrwxrwt. root root system_u:object_r:tmp_t:s0       ..
drwxr-xr-x. root root system_u:object_r:tmpfs_t:s0     .config

drwxr-xr-x. root root system_u:object_r:tmpfs_t:s0     .
drwxr-xr-x. root root system_u:object_r:tmpfs_t:s0     ..
drwxr-xr-x. root root system_u:object_r:tmpfs_t:s0     libimobiledevice

drwxr-xr-x. root root system_u:object_r:tmpfs_t:s0     .
drwxr-xr-x. root root system_u:object_r:tmpfs_t:s0     ..
-rw-r--r--. root root system_u:object_r:tmpfs_t:s0     42dcc181e41cef8041a4b23b8bfe4ccb422a6ef5.pem
-rw-r--r--. root root system_u:object_r:tmpfs_t:s0     HostCertificate.pem
-rw-r--r--. root root system_u:object_r:tmpfs_t:s0     HostPrivateKey.pem
-rw-r--r--. root root system_u:object_r:tmpfs_t:s0     libimobiledevicerc
-rw-r--r--. root root system_u:object_r:tmpfs_t:s0     RootCertificate.pem
-rw-r--r--. root root system_u:object_r:tmpfs_t:s0     RootPrivateKey.pem

The AVC Denial from SETroubleshoot:

SELinux is preventing /usr/sbin/tmpwatch from setattr access on the directory root.

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

If you believe that tmpwatch should be allowed setattr access on the root directory by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
allow this access for now by executing:
# grep tmpwatch /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:tmpreaper_t:s0-s0:c0.c1023
Target Context                system_u:object_r:tmpfs_t:s0
Target Objects                root [ dir ]
Source                        tmpwatch
Source Path                   /usr/sbin/tmpwatch
Port                          <Unknown>
Host                          splat
Source RPM Packages           tmpwatch-2.10.3-2.fc17.x86_64
Target RPM Packages           filesystem-3-2.fc17.x86_64
Policy RPM                    selinux-policy-3.10.0-161.fc17.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     splat
Platform                      Linux splat 3.6.10-2.fc17.x86_64 #1 SMP Tue Dec 11
                              18:07:34 UTC 2012 x86_64 x86_64
Alert Count                   3
First Seen                    2012-12-11 10:18:11 PST
Last Seen                     2013-01-03 10:13:17 PST
Local ID                      2657bb56-75fd-456b-bc7c-85fa99ec4802

Raw Audit Messages
type=AVC msg=audit(1357236797.911:108): avc:  denied  { setattr } for  pid=3083 comm="tmpwatch" name="root" dev="tmpfs" ino=13348 scontext=system_u:system_r:tmpreaper_t:s0-s0:c0.c1023 tcontext=system_u:object_r:tmpfs_t:s0 tclass=dir

type=SYSCALL msg=audit(1357236797.911:108): arch=x86_64 syscall=utime success=no exit=EACCES a0=404a07 a1=7fff75d51dc0 a2=0 a3=3c821b0778 items=0 ppid=3081 pid=3083 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=3 comm=tmpwatch exe=/usr/sbin/tmpwatch subj=system_u:system_r:tmpreaper_t:s0-s0:c0.c1023 key=(null)

Hash: tmpwatch,tmpreaper_t,tmpfs_t,dir,setattr


#============= tmpreaper_t ==============
allow tmpreaper_t tmpfs_t:dir setattr;

audit2allow -R

#============= tmpreaper_t ==============
allow tmpreaper_t tmpfs_t:dir setattr;
Comment 1 Daniel Walsh 2013-01-03 16:35:12 EST
Looks like /tmp is mislabled or content within this directory.

find /tmp --context "*:tmpfs_t:*"
Comment 2 Rob Millner 2013-01-03 20:03:24 EST
It just returns the directory reported in the AVC denial.

# find /tmp -context '*:tmpfs_t:*'
Comment 3 Daniel Walsh 2013-01-04 13:28:34 EST
Sorry I guess I should have read up.

chcon -Rt tmp_t /tmp/root

Will fix the labels.  Not sure how they got that label in the first place.  Or if you don't need this any longer remove it.

rm -rf /tmp/root
Comment 4 Fedora End Of Life 2013-07-03 20:55:32 EDT
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. 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 '17'.

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 17'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 17 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  change the 
'version' to a later Fedora version prior to Fedora 17's end of life.

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.

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