Bug 1456199

Summary: selinux AVC denial seen when qemu-kvm process tries to write in to /var/run/gluster
Product: [Red Hat Storage] Red Hat Gluster Storage Reporter: SATHEESARAN <sasundar>
Component: libgfapiAssignee: Niels de Vos <ndevos>
Status: CLOSED CURRENTRELEASE QA Contact: SATHEESARAN <sasundar>
Severity: high Docs Contact:
Priority: unspecified    
Version: rhgs-3.3CC: amukherj, rcyriac, rhinduja, rhs-bugs, storage-qa-internal
Target Milestone: ---   
Target Release: RHGS 3.3.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.13.1-160 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-09-25 11:22:26 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:
Embargoed:
Bug Depends On: 1455994    
Bug Blocks: 1411323, 1417151, 1445570    

Description SATHEESARAN 2017-05-27 15:56:52 UTC
Description of problem:
-----------------------
When triggering the statedump of gfapi application(QEMU), avc denial logged in audit.log and statedump is not dumped in to /var/run/gluster

Version-Release number of selected component (if applicable):
-------------------------------------------------------------
RHEL 7.3 ( 3.10.0-514.16.1.el7.x86_64 )
libselinux-utils-2.5-6.el7.x86_64
selinux-policy-3.13.1-102.el7_3.16.noarch
libselinux-2.5-6.el7.x86_64
libselinux-python-2.5-6.el7.x86_64
selinux-policy-targeted-3.13.1-102.el7_3.16.noarch
RHGS 3.3.0 interim build ( glusterfs-3.8.4-25.el7rhgs )

How reproducible:
------------------
Always

Steps to Reproduce:
-------------------
1. Create a QEMU process that uses QEMU driver for glusterfs (libgfapi)
2. Trigger gfapi application statedump from gluster node

Actual results:
---------------
No gfapi statedump under /var/run/gluster and AVC denial message logged in audit.log

Expected results:
-----------------
gfapi application should dump the statedump under /var/run/gluster


Additional info:
----------------
Snip from audit.log
<snip>
type=AVC msg=audit(1495796194.193:981): avc:  denied  { write } for  pid=14873 comm="qemu-kvm" name="gluster" dev="tmpfs" ino=109984 scontext=system_u:system_r:svirt_t:s0:c399,c698 tcontext=system_u:object_r:glusterd_var_run_t:s0 tclass=dir
</snip>

Comment 3 SATHEESARAN 2017-06-19 18:12:32 UTC
Tested with selinux-policy-3.13.1-160

1. selinux boolean virt_use_glusterd is available
# getsebool -a | grep glusterd
virt_use_glusterd --> on

2. When this boolean is set to 'on' and gfapi statedump could be triggered and written to /var/run/gluster

Comment 4 SATHEESARAN 2017-06-19 18:13:07 UTC
(In reply to SATHEESARAN from comment #3)
> Tested with selinux-policy-3.13.1-160
> 
> 1. selinux boolean virt_use_glusterd is available
> # getsebool -a | grep glusterd
> virt_use_glusterd --> on
> 
> 2. When this boolean is set to 'on' and gfapi statedump could be triggered
> and written to /var/run/gluster

Also tested with RHGS 3.3.0 interim build ( glusterfs-3.8.4-27.el7rhgs )