Bug 2317958

Summary: SELinux is preventing /usr/sbin/virtnodedevd from 'watch' accesses on the directory /etc/mdevctl.d.
Product: [Fedora] Fedora Reporter: Renich Bon Ciric <renich>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 41CC: dwalsh, lvrabec, mmalik, omosnacek, pkoncity, renich, vmojzis, zpytela
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:28a5992f4f52e774717d35672960214b450566cf1d0ac1e1baf5bfea013fab09;VARIANT_ID=workstation;
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-10-11 11:48:44 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
File: description
none
File: os_info none

Description Renich Bon Ciric 2024-10-11 03:12:09 UTC
Description of problem:
I started virt-manager. 
SELinux is preventing /usr/sbin/virtnodedevd from 'watch' accesses on the directory /etc/mdevctl.d.

*****  Plugin catchall_labels (83.8 confidence) suggests   *******************

If you want to allow virtnodedevd to have watch access on the mdevctl.d directory
Then you need to change the label on /etc/mdevctl.d
Do
# semanage fcontext -a -t FILE_TYPE '/etc/mdevctl.d'
where FILE_TYPE is one of the following: mdevctl_conf_t, virt_cache_t, virt_common_var_run_t, virt_etc_rw_t, virt_var_run_t, virtnodedevd_t, virtnodedevd_var_run_t.
Then execute:
restorecon -v '/etc/mdevctl.d'


*****  Plugin catchall (17.1 confidence) suggests   **************************

If you believe that virtnodedevd should be allowed watch access on the mdevctl.d directory 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:
# ausearch -c 'daemon-init' --raw | audit2allow -M my-daemoninit
# semodule -X 300 -i my-daemoninit.pp

Additional Information:
Source Context                system_u:system_r:virtnodedevd_t:s0
Target Context                system_u:object_r:etc_t:s0
Target Objects                /etc/mdevctl.d [ dir ]
Source                        daemon-init
Source Path                   /usr/sbin/virtnodedevd
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           libvirt-daemon-driver-nodedev-10.6.0-5.fc41.x86_64
Target RPM Packages           mdevctl-1.3.0-6.fc41.x86_64
SELinux Policy RPM            selinux-policy-targeted-41.20-1.fc41.noarch
Local Policy RPM              selinux-policy-targeted-41.20-1.fc41.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 6.11.2-300.fc41.x86_64 #1 SMP
                              PREEMPT_DYNAMIC Fri Oct 4 16:44:08 UTC 2024 x86_64
Alert Count                   40
First Seen                    2024-10-10 21:08:58 CST
Last Seen                     2024-10-10 21:11:34 CST
Local ID                      adf18d1b-2223-416d-902b-1634424241ee

Raw Audit Messages
type=AVC msg=audit(1728616294.691:620): avc:  denied  { watch } for  pid=98704 comm="gmain" path="/etc/mdevctl.d" dev="nvme1n1p2" ino=762 scontext=system_u:system_r:virtnodedevd_t:s0 tcontext=system_u:object_r:etc_t:s0 tclass=dir permissive=0


type=SYSCALL msg=audit(1728616294.691:620): arch=x86_64 syscall=inotify_add_watch success=no exit=EACCES a0=16 a1=7f7c240318e0 a2=1002fce a3=0 items=1 ppid=1 pid=98704 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=gmain exe=/usr/sbin/virtnodedevd subj=system_u:system_r:virtnodedevd_t:s0 key=(null)

type=CWD msg=audit(1728616294.691:620): cwd=/

type=PATH msg=audit(1728616294.691:620): item=0 name=/etc/mdevctl.d inode=762 dev=00:27 mode=040755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:etc_t:s0 nametype=NORMAL cap_fp=0 cap_fi=0 cap_fe=0 cap_fver=0 cap_frootid=0

Hash: daemon-init,virtnodedevd_t,etc_t,dir,watch

Version-Release number of selected component:
selinux-policy-targeted-41.20-1.fc41.noarch

Additional info:
reporter:       libreport-2.17.15
reason:         SELinux is preventing /usr/sbin/virtnodedevd from 'watch' accesses on the directory /etc/mdevctl.d.
package:        selinux-policy-targeted-41.20-1.fc41.noarch
component:      selinux-policy
hashmarkername: setroubleshoot
type:           libreport
kernel:         6.11.2-300.fc41.x86_64
comment:        I started virt-manager. 
component:      selinux-policy

Comment 1 Renich Bon Ciric 2024-10-11 03:12:12 UTC
Created attachment 2051443 [details]
File: description

Comment 2 Renich Bon Ciric 2024-10-11 03:12:13 UTC
Created attachment 2051444 [details]
File: os_info

Comment 3 Zdenek Pytela 2024-10-11 11:48:44 UTC

*** This bug has been marked as a duplicate of bug 2317726 ***