Bug 2276779

Summary: SELinux is preventing daemon-init from 'map' accesses on the file /var/lib/flatpak/exports/share/mime/mime.cache.
Product: [Fedora] Fedora Reporter: Adam Williamson <awilliam>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: low    
Version: 40CC: awilliam, dwalsh, knazekovan, kparal, lvrabec, mmalik, omosnacek, pkoncity, vmojzis, zpytela
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:3f2b9baedae43e61b303696490e594a0fcafe5037dada047c1dcf75c1c24a291;VARIANT_ID=workstation;
Fixed In Version: selinux-policy-40.18-2.fc40 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-05-12 04:17:46 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 Adam Williamson 2024-04-23 23:43:45 UTC
Description of problem:
Seems to happen on start of libvirtd on current Fedora 40 with selinux-policy patched with https://github.com/fedora-selinux/selinux-policy/pull/2078 .
SELinux is preventing daemon-init from 'map' accesses on the file /var/lib/flatpak/exports/share/mime/mime.cache.

*****  Plugin catchall_boolean (57.6 confidence) suggests   ******************

If you want to allow domain to can mmap files
Then you must tell SELinux about this by enabling the 'domain_can_mmap_files' boolean.

Do
setsebool -P domain_can_mmap_files 1

*****  Plugin catchall_labels (36.2 confidence) suggests   *******************

If you want to allow daemon-init to have map access on the mime.cache file
Then you need to change the label on /var/lib/flatpak/exports/share/mime/mime.cache
Do
# semanage fcontext -a -t FILE_TYPE '/var/lib/flatpak/exports/share/mime/mime.cache'
where FILE_TYPE is one of the following: abrt_helper_exec_t, bin_t, boot_t, etc_runtime_t, etc_t, fonts_cache_t, fonts_t, ld_so_cache_t, ld_so_t, lib_t, locale_t, nscd_var_run_t, pkcs11_modules_conf_t, prelink_exec_t, shell_exec_t, src_t, sssd_public_t, system_conf_t, system_db_t, systemd_notify_exec_t, textrel_shlib_t, usr_t, virtnodedevd_exec_t.
Then execute:
restorecon -v '/var/lib/flatpak/exports/share/mime/mime.cache'


*****  Plugin catchall (7.64 confidence) suggests   **************************

If you believe that daemon-init should be allowed map access on the mime.cache 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:
# 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:var_lib_t:s0
Target Objects                /var/lib/flatpak/exports/share/mime/mime.cache [
                              file ]
Source                        daemon-init
Source Path                   daemon-init
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
SELinux Policy RPM            selinux-policy-targeted-40.16-1.1awb.fc40.noarch
Local Policy RPM              selinux-policy-targeted-40.16-1.1awb.fc40.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 6.8.7-300.fc40.x86_64 #1 SMP
                              PREEMPT_DYNAMIC Wed Apr 17 19:21:08 UTC 2024
                              x86_64
Alert Count                   43
First Seen                    2024-01-03 15:54:14 PST
Last Seen                     2024-04-23 16:39:16 PDT
Local ID                      17501d85-914d-4c88-863a-429b800816bb

Raw Audit Messages
type=AVC msg=audit(1713915556.702:327): avc:  denied  { map } for  pid=6585 comm="daemon-init" path="/var/lib/flatpak/exports/share/mime/mime.cache" dev="dm-0" ino=23772517 scontext=system_u:system_r:virtnodedevd_t:s0 tcontext=system_u:object_r:var_lib_t:s0 tclass=file permissive=0


Hash: daemon-init,virtnodedevd_t,var_lib_t,file,map

Version-Release number of selected component:
selinux-policy-targeted-40.16-1.1awb.fc40.noarch

Additional info:
reporter:       libreport-2.17.15
reason:         SELinux is preventing daemon-init from 'map' accesses on the file /var/lib/flatpak/exports/share/mime/mime.cache.
package:        selinux-policy-targeted-40.16-1.1awb.fc40.noarch
component:      selinux-policy
hashmarkername: setroubleshoot
type:           libreport
kernel:         6.8.7-300.fc40.x86_64
comment:        Seems to happen on start of libvirtd on current Fedora 40 with selinux-policy patched with https://github.com/fedora-selinux/selinux-policy/pull/2078 .
component:      selinux-policy

Comment 1 Adam Williamson 2024-04-23 23:43:48 UTC
Created attachment 2028644 [details]
File: description

Comment 2 Adam Williamson 2024-04-23 23:43:50 UTC
Created attachment 2028645 [details]
File: os_info

Comment 3 Zdenek Pytela 2024-05-02 12:44:38 UTC
*** Bug 2271829 has been marked as a duplicate of this bug. ***

Comment 4 Fedora Update System 2024-05-07 08:33:29 UTC
FEDORA-2024-759c80369d (selinux-policy-40.18-2.fc40) has been submitted as an update to Fedora 40.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-759c80369d

Comment 5 Fedora Update System 2024-05-08 02:21:17 UTC
FEDORA-2024-759c80369d has been pushed to the Fedora 40 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-759c80369d`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-759c80369d

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

Comment 6 Fedora Update System 2024-05-12 04:17:46 UTC
FEDORA-2024-759c80369d (selinux-policy-40.18-2.fc40) has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.