Bug 2077750

Summary: SELinux is preventing colord from 'map' accesses on the file /var/lib/flatpak/exports/share/mime/mime.cache.
Product: [Fedora] Fedora Reporter: Kamil Páral <kparal>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 36CC: dwalsh, grepl.miroslav, lvrabec, mmalik, omosnace, pkoncity, vmojzis, zpytela
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:7c9ca15972d75381042db77ad8a3d71ec4a030fcccccaaeb259b31f9b231636b;VARIANT_ID=workstation;
Fixed In Version: selinux-policy-36.8-1.fc36 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-02 19:43:28 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:

Description Kamil Páral 2022-04-22 06:23:59 UTC
Description of problem:
Just logged in.
SELinux is preventing colord 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 colord 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, cert_t, colord_exec_t, data_home_t, etc_runtime_t, etc_t, file_context_t, fonts_cache_t, fonts_t, gconf_home_t, icc_data_home_t, ifconfig_exec_t, ld_so_cache_t, ld_so_t, lib_t, locale_t, nscd_var_run_t, passwd_file_t, pkcs11_modules_conf_t, policykit_auth_exec_t, prelink_exec_t, shell_exec_t, src_t, sssd_public_t, system_conf_t, system_db_t, systemd_hwdb_etc_t, textrel_shlib_t, user_home_t, user_tmp_t, usr_t, xdm_var_lib_t, xdm_var_run_t.
Then execute:
restorecon -v '/var/lib/flatpak/exports/share/mime/mime.cache'


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

If you believe that colord 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 'colord' --raw | audit2allow -M my-colord
# semodule -X 300 -i my-colord.pp

Additional Information:
Source Context                system_u:system_r:colord_t:s0
Target Context                system_u:object_r:var_lib_t:s0
Target Objects                /var/lib/flatpak/exports/share/mime/mime.cache [
                              file ]
Source                        colord
Source Path                   colord
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
SELinux Policy RPM            selinux-policy-targeted-36.7-1.fc36.noarch
Local Policy RPM              selinux-policy-targeted-36.7-1.fc36.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 5.17.4-300.fc36.x86_64 #1 SMP
                              PREEMPT Wed Apr 20 14:39:58 UTC 2022 x86_64 x86_64
Alert Count                   1
First Seen                    2022-04-22 08:22:40 CEST
Last Seen                     2022-04-22 08:22:40 CEST
Local ID                      235cf119-de85-4db4-aedc-1955ddc4af04

Raw Audit Messages
type=AVC msg=audit(1650608560.170:246): avc:  denied  { map } for  pid=1268 comm="colord" path="/var/lib/flatpak/exports/share/mime/mime.cache" dev="dm-0" ino=2279754 scontext=system_u:system_r:colord_t:s0 tcontext=system_u:object_r:var_lib_t:s0 tclass=file permissive=0


Hash: colord,colord_t,var_lib_t,file,map

Version-Release number of selected component:
selinux-policy-targeted-36.7-1.fc36.noarch

Additional info:
component:      selinux-policy
reporter:       libreport-2.17.1
hashmarkername: setroubleshoot
kernel:         5.17.4-300.fc36.x86_64
type:           libreport

Potential duplicate: bug 1917176

Comment 1 Fedora Update System 2022-04-27 08:00:53 UTC
FEDORA-2022-47789bbc9d has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2022-47789bbc9d

Comment 2 Fedora Update System 2022-04-28 05:11:14 UTC
FEDORA-2022-47789bbc9d has been pushed to the Fedora 36 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-47789bbc9d`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-47789bbc9d

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

Comment 3 Daniel 2022-04-28 14:34:37 UTC
Similar problem has been detected:

Occurs on login on a Fedroa 36 Beta system after installing any Flatpak apps via GNOME Software.

hashmarkername: setroubleshoot
kernel:         5.17.3-302.fc36.x86_64
package:        selinux-policy-targeted-36.7-1.fc36.noarch
reason:         SELinux is preventing colord from 'map' accesses on the file /var/lib/flatpak/exports/share/mime/mime.cache.
type:           libreport

Comment 4 Fedora Update System 2022-05-02 19:43:28 UTC
FEDORA-2022-47789bbc9d has been pushed to the Fedora 36 stable repository.
If problem still persists, please make note of it in this bug report.