Bug 2025714 - SELinux is preventing qemu-system-x86 from 'map' accesses on the anon_inode anon_inode.
Summary: SELinux is preventing qemu-system-x86 from 'map' accesses on the anon_inode a...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 35
Hardware: x86_64
OS: Unspecified
medium
medium
Target Milestone: ---
Assignee: Zdenek Pytela
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:f13538195eecfc669e909a5a078...
: 2026746 2028275 2031415 2047947 2051195 2051827 2053425 2053467 2053857 2053973 2054616 2058029 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-11-22 19:35 UTC by Fabrice GALERA
Modified: 2023-05-19 15:58 UTC (History)
45 users (show)

Fixed In Version: selinux-policy-35.15-1.fc35
Clone Of:
Environment:
Last Closed: 2022-02-17 03:15:07 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github fedora-selinux selinux-policy pull 1054 0 None Merged Add the map permission to common_anon_inode_perm permission set 2022-02-08 10:21:59 UTC

Internal Links: 2187745

Description Fabrice GALERA 2021-11-22 19:35:00 UTC
Description of problem:
Error when i lauch a vm throught virt-manager 

my qcow2 file are not in original folder 
SELinux is preventing qemu-system-x86 from 'map' accesses on the anon_inode anon_inode.

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

Si vous pensez que qemu-system-x86 devrait être autorisé à accéder map sur anon_inode anon_inode par défaut.
Then vous devriez rapporter ceci en tant qu'anomalie.
Vous pouvez générer un module de stratégie local pour autoriser cet accès.
Do
autoriser cet accès pour le moment en exécutant :
# ausearch -c "qemu-system-x86" --raw | audit2allow -M my-qemusystemx86
# semodule -X 300 -i my-qemusystemx86.pp

Additional Information:
Source Context                system_u:system_r:svirt_t:s0:c155,c410
Target Context                system_u:object_r:svirt_t:s0:c155,c410
Target Objects                anon_inode [ anon_inode ]
Source                        qemu-system-x86
Source Path                   qemu-system-x86
Port                          <Inconnu>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
SELinux Policy RPM            selinux-policy-targeted-35.5-1.fc35.noarch
Local Policy RPM              selinux-policy-targeted-35.5-1.fc35.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     (removed)
Platform                      Linux (removed) 5.16.0-
                              0.rc1.20211115git8ab774587903.14.fc36.x86_64 #1
                              SMP PREEMPT Mon Nov 15 16:24:53 UTC 2021 x86_64
                              x86_64
Alert Count                   1
First Seen                    2021-11-22 20:19:01 CET
Last Seen                     2021-11-22 20:19:01 CET
Local ID                      c5b24265-95c9-40c4-b100-7871f7f3bd92

Raw Audit Messages
type=AVC msg=audit(1637608741.832:330): avc:  denied  { map } for  pid=2712 comm="qemu-system-x86" path="anon_inode:[io_uring]" dev="anon_inodefs" ino=35955 scontext=system_u:system_r:svirt_t:s0:c155,c410 tcontext=system_u:object_r:svirt_t:s0:c155,c410 tclass=anon_inode permissive=1


Hash: qemu-system-x86,svirt_t,svirt_t,anon_inode,map

Version-Release number of selected component:
selinux-policy-targeted-35.5-1.fc35.noarch

Additional info:
component:      selinux-policy
reporter:       libreport-2.15.2
hashmarkername: setroubleshoot
kernel:         5.16.0-0.rc1.20211115git8ab774587903.14.fc36.x86_64
type:           libreport

Comment 1 Zdenek Pytela 2021-12-14 19:20:15 UTC
The map permission is currently not allowed:

  #sesearch -A -s svirt_t -t svirt_t -c anon_inode
allow svirt_t svirt_t:anon_inode { create getattr ioctl read write };

policy/modules/kernel/domain.te:allow domain self:anon_inode userfaultfd_anon_inode_perms;
policy/support/obj_perm_sets.spt:define(`userfaultfd_anon_inode_perms',`{ create getattr ioctl read write }')

Comment 2 Zdenek Pytela 2021-12-14 19:20:45 UTC
*** Bug 2031415 has been marked as a duplicate of this bug. ***

Comment 3 Zdenek Pytela 2021-12-14 19:29:55 UTC
*** Bug 2028275 has been marked as a duplicate of this bug. ***

Comment 4 Ian Laurie 2022-01-28 22:45:08 UTC
*** Bug 2047947 has been marked as a duplicate of this bug. ***

Comment 5 Christian Labisch 2022-01-30 16:15:10 UTC
I can confirm the same - whenever I launch a KVM virtual machine, I get this alert.
SELinux is preventing qemu-system-x86 from map access on the anon_inode anon_inode.

Source Context                system_u:system_r:svirt_t:s0:c585,c973
Target Context                system_u:object_r:svirt_t:s0:c585,c973
Target Objects                anon_inode [ anon_inode ]
Source                        qemu-system-x86
Source Path                   qemu-system-x86
Port                          <Unknown>
Host                          ********
Source RPM Packages           
Target RPM Packages           
SELinux Policy RPM            selinux-policy-targeted-35.11-1.fc35.noarch
Local Policy RPM              selinux-policy-targeted-35.11-1.fc35.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     ********
Platform                      Linux ******** 5.16.4-200.fc35.x86_64 #1 SMP

Comment 6 Alexander Dyadyun 2022-02-05 12:34:01 UTC
Similar problem has been detected:

1.  Start system after power on
2. Start VM in virt-manager

hashmarkername: setroubleshoot
kernel:         5.16.5-200.fc35.x86_64
package:        selinux-policy-targeted-35.13-1.fc35.noarch
reason:         SELinux is preventing qemu-system-x86 from 'map' accesses on the anon_inode anon_inode.
type:           libreport

Comment 7 Jim H 2022-02-05 20:06:07 UTC
Similar problem has been detected:

Restarting after Fedora updates

hashmarkername: setroubleshoot
kernel:         5.16.5-200.fc35.x86_64
package:        selinux-policy-targeted-35.13-1.fc35.noarch
reason:         SELinux is preventing qemu-system-x86 from 'map' accesses on the anon_inode anon_inode.
type:           libreport

Comment 8 Zdenek Pytela 2022-02-07 09:13:00 UTC
*** Bug 2051195 has been marked as a duplicate of this bug. ***

Comment 9 Zdenek Pytela 2022-02-07 09:13:11 UTC
*** Bug 2026746 has been marked as a duplicate of this bug. ***

Comment 10 Zdenek Pytela 2022-02-07 09:17:15 UTC
Ondrej,

Denials like this started to appear. We currently have support for anon_inode consisting of

allow domain self:anon_inode userfaultfd_anon_inode_perms;
define(`userfaultfd_anon_inode_perms',`{ create getattr ioctl read write }')

and unused interface fs_rw_anon_inodefs_files().

Should handling of io_uring be different, or can we just add the map permission to the existing set?

Comment 11 Ondrej Mosnacek 2022-02-07 17:16:01 UTC
For now let's just add the map permission to the macro (and rename it to e.g. general_anon_inode_perms, since userfaultfd is no longer the only anon_inode kind supported). To handle anon_inode better we would need the self keyword support for type transitions, which is yet to be implemented...

Comment 12 Zdenek Pytela 2022-02-07 17:36:21 UTC
Thank you, done.
https://github.com/fedora-selinux/selinux-policy/pull/1052

Comment 13 Drew Dowling 2022-02-07 21:40:46 UTC
Similar problem has been detected:

opening up viirtual machine manager throws this SELinux warning. VM still starts

hashmarkername: setroubleshoot
kernel:         5.16.5-200.fc35.x86_64
package:        selinux-policy-targeted-35.13-1.fc35.noarch
reason:         SELinux is preventing qemu-system-x86 from 'map' accesses on the anon_inode anon_inode.
type:           libreport

Comment 14 Zdenek Pytela 2022-02-08 07:49:42 UTC
*** Bug 2051827 has been marked as a duplicate of this bug. ***

Comment 15 Alex Finkel 2022-02-09 15:34:26 UTC
Similar problem has been detected:

Launching Virtual Machine Manager from Gnome Desktop on F35

hashmarkername: setroubleshoot
kernel:         5.16.5-200.fc35.x86_64
package:        selinux-policy-targeted-35.13-1.fc35.noarch
reason:         SELinux is preventing qemu-system-x86 from 'map' accesses on the anon_inode anon_inode.
type:           libreport

Comment 16 Szymon Dykty 2022-02-10 19:20:00 UTC
Similar problem has been detected:

Happened at the startup. The only thing i did before rebooting was updating, and a day ago I disabled nvidia-powerd.service. Those are the only clues i have

hashmarkername: setroubleshoot
kernel:         5.16.7-200.fc35.x86_64
package:        selinux-policy-targeted-35.13-1.fc35.noarch
reason:         SELinux is preventing qemu-system-x86 from 'map' accesses on the anon_inode anon_inode.
type:           libreport

Comment 17 vywunm0jfimu 2022-02-10 19:26:11 UTC
Similar problem has been detected:

Even qemu-img (from qemu-img-6.1.0.x86_64) called without arguments triggers this alert.

hashmarkername: setroubleshoot
kernel:         5.16.7-200.fc35.x86_64
package:        selinux-policy-targeted-35.13-1.fc35.noarch
reason:         SELinux is preventing qemu-img from 'map' accesses on the anon_inode anon_inode.

Comment 18 Zdenek Pytela 2022-02-11 11:28:39 UTC
*** Bug 2053425 has been marked as a duplicate of this bug. ***

Comment 19 Zdenek Pytela 2022-02-11 11:45:43 UTC
*** Bug 2053467 has been marked as a duplicate of this bug. ***

Comment 20 brizly vaan van Ulciputz 2022-02-11 21:18:14 UTC
Similar problem has been detected:

i sent my laptop to suspend a few hours ago, it wont come up from that, the led keeps "dimming", an the mic-mute-led kept shining.
i hard stopped the notebook py pressing power 8sec. after reboot the SELinux-Thing here come up.

hashmarkername: setroubleshoot
kernel:         5.16.7-200.fc35.x86_64
package:        selinux-policy-targeted-35.13-1.fc35.noarch
reason:         SELinux is preventing qemu-kvm from 'map' accesses on the anon_inode anon_inode.
type:           libreport

Comment 21 Robert Becht 2022-02-13 17:01:04 UTC
Similar problem has been detected:

Lancement de libvirt-manager

hashmarkername: setroubleshoot
kernel:         5.16.7-200.fc35.x86_64
package:        selinux-policy-targeted-35.13-1.fc35.noarch
reason:         SELinux is preventing qemu-system-x86 from 'map' accesses on the anon_inode anon_inode.
type:           libreport

Comment 22 Katsuya Tomioka 2022-02-14 01:23:29 UTC
Similar problem has been detected:

Starting virt-manager after reboot.

hashmarkername: setroubleshoot
kernel:         5.16.8-200.fc35.x86_64
package:        selinux-policy-targeted-35.13-1.fc35.noarch
reason:         SELinux is preventing qemu-system-x86 from 'map' accesses on the anon_inode anon_inode.
type:           libreport

Comment 23 Zdenek Pytela 2022-02-14 09:48:58 UTC
*** Bug 2053857 has been marked as a duplicate of this bug. ***

Comment 24 Zdenek Pytela 2022-02-14 09:49:21 UTC
*** Bug 2053973 has been marked as a duplicate of this bug. ***

Comment 25 Vasco Rodrigues 2022-02-14 10:55:50 UTC
Similar problem has been detected:

At system startup

hashmarkername: setroubleshoot
kernel:         5.16.8-200.fc35.x86_64
package:        selinux-policy-targeted-35.13-1.fc35.noarch
reason:         SELinux is preventing qemu-system-x86 from 'map' accesses on the anon_inode anon_inode.
type:           libreport

Comment 26 Fedora Update System 2022-02-14 11:20:58 UTC
FEDORA-2022-5bcfd81271 has been submitted as an update to Fedora 35. https://bodhi.fedoraproject.org/updates/FEDORA-2022-5bcfd81271

Comment 27 Matthias Andree 2022-02-14 22:53:52 UTC
Similar problem has been detected:

I am running a FreeBSD VM in a qemu-based libvirtd (virt-manager) managed machine. This may be related.

hashmarkername: setroubleshoot
kernel:         5.16.8-200.fc35.x86_64
package:        selinux-policy-targeted-35.13-1.fc35.noarch
reason:         SELinux is preventing qemu-img from 'map' accesses on the anon_inode anon_inode.
type:           libreport

Comment 28 Carlos Mogas da Silva 2022-02-15 10:03:17 UTC
Similar problem has been detected:

Just opening up gnome-boxes

hashmarkername: setroubleshoot
kernel:         5.16.8-200.fc35.x86_64
package:        selinux-policy-targeted-35.13-1.fc35.noarch
reason:         SELinux is preventing qemu-system-x86 from 'map' accesses on the anon_inode anon_inode.
type:           libreport

Comment 29 Zdenek Pytela 2022-02-15 10:49:29 UTC
*** Bug 2054616 has been marked as a duplicate of this bug. ***

Comment 30 Fedora Update System 2022-02-15 14:58:10 UTC
FEDORA-2022-aa5df3a7eb has been submitted as an update to Fedora 35. https://bodhi.fedoraproject.org/updates/FEDORA-2022-aa5df3a7eb

Comment 31 Christian Labisch 2022-02-15 15:35:42 UTC
Hi Zdenek ! FYI @zpytela : selinux-policy-35.15-1.fc35 seems to work fine - no messages after launching virtual machines. 
No warnings during the installation process like those that appeared while installing selinux-policy-35.14-1.fc35 before.

Comment 32 Zdenek Pytela 2022-02-15 17:27:03 UTC
(In reply to Christian Labisch from comment #31)
> Hi Zdenek ! FYI @zpytela : selinux-policy-35.15-1.fc35 seems to work fine -
> no messages after launching virtual machines. 
> No warnings during the installation process like those that appeared while
> installing selinux-policy-35.14-1.fc35 before.

Glad to hear that, thanks for the feedback.

Comment 33 Fedora Update System 2022-02-16 01:50:54 UTC
FEDORA-2022-aa5df3a7eb has been pushed to the Fedora 35 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-aa5df3a7eb`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-aa5df3a7eb

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

Comment 34 David Auer (2nd Account) 2022-02-16 13:08:39 UTC
Similar problem has been detected:

Running "vagrant up"

hashmarkername: setroubleshoot
kernel:         5.16.8-200.fc35.x86_64
package:        selinux-policy-targeted-35.13-1.fc35.noarch
reason:         SELinux is preventing qemu-system-x86 from 'map' accesses on the anon_inode anon_inode.
type:           libreport

Comment 35 David Auer (2nd Account) 2022-02-16 13:15:15 UTC
Unfortunately I'm still seeing this with the following version:
selinux-policy.noarch                   35.13-1.fc35           @updates-testing
selinux-policy-targeted.noarch          35.13-1.fc35           @updates-testing

Comment 36 Christian Labisch 2022-02-16 13:20:12 UTC
(In reply to David Auer (2nd Account) from comment #35)
> Unfortunately I'm still seeing this with the following version:
> selinux-policy.noarch                   35.13-1.fc35          
> @updates-testing
> selinux-policy-targeted.noarch          35.13-1.fc35          
> @updates-testing

Hi David,

You may want to apply the latest patches -> https://bodhi.fedoraproject.org/updates/FEDORA-2022-aa5df3a7eb ... selinux-policy-35.15-1.fc35 has resolved the issues.

Regards,
Christian

Comment 37 David Auer (2nd Account) 2022-02-16 13:31:57 UTC
Hi Christian,

sorry I failed to spot the difference between 35.1*3* and 35.1*5* here, my bad.
Additionally I ran into the rare situation where dnf needed a `--refresh` to get that update. Thanks for the fix and for the help!

Cheers,
David

Comment 38 Robert Moskowitz 2022-02-16 16:02:42 UTC
Similar problem has been detected:

Applied current updates (as of 10am ET 2-16-2022) and rebooted.

qemu was running at time of reboot and suspended the running image as part of shutdown.

At login, I received this error.  Then when I went to connect to qemu via the consule, I got lots of errors reported.

I did catch that this is supposedly fixed with selinux-policy-35.15-1.fc35 from the testing repo, and have applied it.
Note, this was not easy.  The command was in a dialog box that did not support copy to clipboard, and I had to read
the needed command and type it into a terminal window.

Will see if this update will address the problem.

hashmarkername: setroubleshoot
kernel:         5.16.8-200.fc35.x86_64
package:        selinux-policy-targeted-35.13-1.fc35.noarch
reason:         SELinux is preventing qemu-system-x86 from 'map' accesses on the anon_inode anon_inode.
type:           libreport

Comment 39 Robert Moskowitz 2022-02-16 16:08:00 UTC
FWIIW:

I see that I got this error 78 times before I was able to get it to 'ignore':

SELinux is preventing qemu-system-x86 from map access on the anon_inode anon_inode.

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

If you believe that qemu-system-x86 should be allowed map access on the anon_inode anon_inode 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 'qemu-system-x86' --raw | audit2allow -M my-qemusystemx86
# semodule -X 300 -i my-qemusystemx86.pp

Additional Information:
Source Context                system_u:system_r:virtd_t:s0-s0:c0.c1023
Target Context                system_u:object_r:virtd_t:s0
Target Objects                anon_inode [ anon_inode ]
Source                        qemu-system-x86
Source Path                   qemu-system-x86
Port                          <Unknown>
Host                          lx140e.htt-consult.com
Source RPM Packages           
Target RPM Packages           
SELinux Policy RPM            selinux-policy-targeted-35.13-1.fc35.noarch
Local Policy RPM              selinux-policy-targeted-35.13-1.fc35.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     lx140e.htt-consult.com
Platform                      Linux lx140e.htt-consult.com
                              5.16.8-200.fc35.x86_64 #1 SMP PREEMPT Tue Feb 8
                              20:58:59 UTC 2022 x86_64 x86_64
Alert Count                   78
First Seen                    2022-02-16 10:22:46 EST
Last Seen                     2022-02-16 10:30:41 EST
Local ID                      545770cf-60d6-4bcb-8b77-6e9ee0b6d2c2

Raw Audit Messages
type=AVC msg=audit(1645025441.136:403): avc:  denied  { map } for  pid=4531 comm="qemu-system-xte" path="anon_inode:[io_uring]" dev="anon_inodefs" ino=71921 scontext=system_u:system_r:virtd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:virtd_t:s0 tclass=anon_inode permissive=0


Hash: qemu-system-x86,virtd_t,virtd_t,anon_inode,map

======

As noted above, I have applied the selinux-policy update.

Comment 40 Fedora Update System 2022-02-17 03:15:07 UTC
FEDORA-2022-aa5df3a7eb has been pushed to the Fedora 35 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 41 Aleksandar Kostadinov 2022-02-21 14:27:14 UTC
Similar problem has been detected:

I started a virtual machine from /dev/sdd

hashmarkername: setroubleshoot
kernel:         5.16.8-200.fc35.x86_64
package:        selinux-policy-targeted-35.13-1.fc35.noarch
reason:         SELinux is preventing qemu-system-x86 from 'map' accesses on the anon_inode anon_inode.
type:           libreport

Comment 42 David Auer (2nd Account) 2022-02-21 14:39:50 UTC
Hey Aleksandar, Hey Robert,

you both report seeing this issue with selinux-policy-targeted-35.13. Please make sure you update to 35.15 and try again, that should fix it.

Best regards

David

Comment 43 Zdenek Pytela 2022-02-24 10:42:58 UTC
*** Bug 2058029 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.