Bug 2314826 - SELinux is preventing daemon-init from 'watch' accesses on the directory /etc/mdevctl.d/scripts.d.
Summary: SELinux is preventing daemon-init from 'watch' accesses on the directory /etc...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 41
Hardware: x86_64
OS: Unspecified
medium
unspecified
Target Milestone: ---
Assignee: Zdenek Pytela
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:4a67e7019f4b3e6595803635335...
: 2316391 2317134 2317726 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-09-26 06:26 UTC by Ian Laurie
Modified: 2024-10-27 08:36 UTC (History)
11 users (show)

Fixed In Version: selinux-policy-41.20-1.fc41 selinux-policy-41.23-1.fc41
Clone Of:
Environment:
Last Closed: 2024-10-26 03:00:34 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
File: description (1.97 KB, text/plain)
2024-09-26 06:26 UTC, Ian Laurie
no flags Details
File: os_info (683 bytes, text/plain)
2024-09-26 06:26 UTC, Ian Laurie
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Github fedora-selinux selinux-policy pull 2363 0 None open Allow virtnodedev watch mdevctl config dirs 2024-09-26 14:54:18 UTC
Github fedora-selinux selinux-policy pull 2388 0 None open Fix the /etc/mdevctl\.d(/.*)? regexp 2024-10-14 14:21:45 UTC

Description Ian Laurie 2024-09-26 06:26:02 UTC
Description of problem:
Launched virt-manager.  
SELinux is preventing daemon-init from 'watch' accesses on the directory /etc/mdevctl.d/scripts.d.

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

If you believe that daemon-init should be allowed watch access on the scripts.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:mdevctl_conf_t:s0
Target Objects                /etc/mdevctl.d/scripts.d [ dir ]
Source                        daemon-init
Source Path                   daemon-init
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
SELinux Policy RPM            selinux-policy-targeted-41.18-1.fc41.noarch
Local Policy RPM              selinux-policy-targeted-41.18-1.fc41.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 6.11.0-63.fc41.x86_64 #1 SMP
                              PREEMPT_DYNAMIC Sun Sep 15 17:48:54 UTC 2024
                              x86_64
Alert Count                   33
First Seen                    2024-09-26 16:22:25 AEST
Last Seen                     2024-09-26 16:24:33 AEST
Local ID                      531cf96c-2c4b-4d6f-b580-308737a507e4

Raw Audit Messages
type=AVC msg=audit(1727331873.951:1167): avc:  denied  { watch } for  pid=254281 comm="gmain" path="/etc/mdevctl.d/scripts.d" dev="sdc3" ino=10149729 scontext=system_u:system_r:virtnodedevd_t:s0 tcontext=system_u:object_r:mdevctl_conf_t:s0 tclass=dir permissive=0


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

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

Additional info:
reporter:       libreport-2.17.15
reason:         SELinux is preventing daemon-init from 'watch' accesses on the directory /etc/mdevctl.d/scripts.d.
package:        selinux-policy-targeted-41.18-1.fc41.noarch
component:      selinux-policy
hashmarkername: setroubleshoot
type:           libreport
kernel:         6.11.0-63.fc41.x86_64
comment:        Launched virt-manager.  
component:      selinux-policy

Comment 1 Ian Laurie 2024-09-26 06:26:04 UTC
Created attachment 2048767 [details]
File: description

Comment 2 Ian Laurie 2024-09-26 06:26:05 UTC
Created attachment 2048768 [details]
File: os_info

Comment 3 Zdenek Pytela 2024-10-04 11:38:35 UTC
*** Bug 2316391 has been marked as a duplicate of this bug. ***

Comment 4 Fedora Update System 2024-10-04 12:30:27 UTC
FEDORA-2024-97e0eb13c3 (selinux-policy-41.20-1.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-97e0eb13c3

Comment 5 Fedora Update System 2024-10-05 02:58:27 UTC
FEDORA-2024-97e0eb13c3 has been pushed to the Fedora 41 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-97e0eb13c3`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-97e0eb13c3

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 6 Fedora Update System 2024-10-08 02:02:35 UTC
FEDORA-2024-97e0eb13c3 (selinux-policy-41.20-1.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 7 Zdenek Pytela 2024-10-09 13:48:24 UTC
*** Bug 2317134 has been marked as a duplicate of this bug. ***

Comment 8 Zdenek Pytela 2024-10-10 07:22:50 UTC
*** Bug 2317726 has been marked as a duplicate of this bug. ***

Comment 9 Adam Williamson (Red Hat non-Fedora) 2024-10-11 19:41:58 UTC
I'm still seeing this with 41.20.

SELinux is preventing daemon-init from watch access on the directory /etc/mdevctl.d.

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

If you want to allow daemon-init 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 daemon-init 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                   daemon-init
Port                          <Unknown>
Host                          xps13a.happyassassin.net
Source RPM Packages           
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                     xps13a.happyassassin.net
Platform                      Linux xps13a.happyassassin.net
                              6.11.2-300.fc41.x86_64 #1 SMP PREEMPT_DYNAMIC Fri
                              Oct  4 16:44:08 UTC 2024 x86_64
Alert Count                   21
First Seen                    2024-10-09 11:31:27 PDT
Last Seen                     2024-10-11 12:36:57 PDT
Local ID                      f511b329-0e18-4f0f-8b4f-9dfe0e42102c

Raw Audit Messages
type=AVC msg=audit(1728675417.18:522): avc:  denied  { watch } for  pid=31634 comm="gmain" path="/etc/mdevctl.d" dev="dm-0" ino=365 scontext=system_u:system_r:virtnodedevd_t:s0 tcontext=system_u:object_r:etc_t:s0 tclass=dir permissive=1


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

Comment 10 Milos Malik 2024-10-18 13:18:40 UTC
Found by one of our automated tests:
----
type=PROCTITLE msg=audit(10/18/2024 12:46:24.957:1780) : proctitle=/usr/sbin/virtnodedevd --timeout 120 
type=PATH msg=audit(10/18/2024 12:46:24.957:1780) : item=0 name=/etc/mdevctl.d inode=89317 dev=00:28 mode=dir,755 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:etc_t:s0 nametype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 cap_frootid=0 
type=CWD msg=audit(10/18/2024 12:46:24.957:1780) : cwd=/ 
type=SYSCALL msg=audit(10/18/2024 12:46:24.957:1780) : arch=x86_64 syscall=inotify_add_watch success=no exit=EACCES(Permission denied) a0=0x16 a1=0x555f33249820 a2=0x1002fce a3=0x4 items=1 ppid=1 pid=14697 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=daemon-init exe=/usr/sbin/virtnodedevd subj=system_u:system_r:virtnodedevd_t:s0 key=(null) 
type=AVC msg=audit(10/18/2024 12:46:24.957:1780) : avc:  denied  { watch } for  pid=14697 comm=daemon-init path=/etc/mdevctl.d dev="nvme0n1p4" ino=89317 scontext=system_u:system_r:virtnodedevd_t:s0 tcontext=system_u:object_r:etc_t:s0 tclass=dir permissive=0
----

# rpm -qa seli\*
selinux-policy-41.21-1.fc42.noarch
selinux-policy-targeted-41.21-1.fc42.noarch
#

Comment 11 Zdenek Pytela 2024-10-22 14:55:51 UTC
I believe v41.22 build addresses the issue with /etc/mdevctl.d label.

type=PATH msg=audit(10/18/2024 12:46:24.957:1780) : item=0 name=/etc/mdevctl.d inode=89317 dev=00:28 mode=dir,755 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:etc_t:s0 nametype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 cap_frootid=0

Comment 12 Fedora Update System 2024-10-23 19:57:56 UTC
FEDORA-2024-626c699a72 (selinux-policy-41.23-1.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-626c699a72

Comment 13 Fedora Update System 2024-10-24 01:57:42 UTC
FEDORA-2024-626c699a72 has been pushed to the Fedora 41 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-626c699a72`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-626c699a72

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 14 Fedora Update System 2024-10-26 03:00:34 UTC
FEDORA-2024-626c699a72 (selinux-policy-41.23-1.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, 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.