RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2035702 - SELinux is preventing /usr/libexec/qemu-kvm from map access on the chr_file /dev/vhost-vdpa-0
Summary: SELinux is preventing /usr/libexec/qemu-kvm from map access on the chr_file /...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: selinux-policy
Version: 9.0
Hardware: Unspecified
OS: Linux
medium
medium
Target Milestone: rc
: 9.0
Assignee: Zdenek Pytela
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-12-27 03:27 UTC by yafu
Modified: 2022-05-17 16:12 UTC (History)
4 users (show)

Fixed In Version: selinux-policy-34.1.21-1.el9
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-05-17 15:50:02 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-106593 0 None None None 2021-12-27 03:34:24 UTC
Red Hat Product Errata RHBA-2022:3918 0 None None None 2022-05-17 15:50:11 UTC

Internal Links: 2122920

Description yafu 2021-12-27 03:27:47 UTC
Description of problem:
 SELinux is preventing /usr/libexec/qemu-kvm from map access on the chr_file /dev/vhost-vdpa-0

Version-Release number of selected component (if applicable):
selinux-policy-34.1.20-1.el9.noarch

How reproducible:
100%

Steps to Reproduce:
1.Create vdpa device:
1). load the kmod with the following commands:
[user@host ~]# modprobe vdpa
[user@host ~]# modprobe vhost_vdpa
[user@host ~]# modprobe vdpa_sim
[user@host ~]# modprobe vdpa_sim_net

check the module is probed successfully:
[user@host ~]# vdpa mgmtdev show 
vdpasim_net: 
  supported_classes net

2). create vdpa device by vdpa tool:
[user@host ~]# vdpa dev add name vdpa0 mgmtdev vdpasim_net
[user@host ~]#  ls -l /sys/bus/vdpa/devices
total 0
lrwxrwxrwx. 1 root root 0 Aug  9 01:19 vdpa0 -> ../../../devices/vdpa0


2.Edit guest with vdpa device:
#virsh edit r9
...
<interface type='vdpa'>
<source dev='/dev/vhost-vdpa-0'/>
</interface>
...

3.Start the guest:
# date; virsh start r9 ; date
Sun Dec 26 10:21:03 PM EST 2021
Domain 'r9' started

Sun Dec 26 10:21:04 PM EST 2021

4.Check the syslog during guest booting:
Dec 26 22:21:16 dell-per740xd-15 setroubleshoot[31404]: SELinux is preventing /usr/libexec/qemu-kvm from map access on the chr_file /dev/vhost-vdpa-0. For complete SELinux messages run: sealert -l ab58ed2a-51a8-48ae-8cce-a808bd6d0136
Dec 26 22:21:16 dell-per740xd-15 setroubleshoot[31404]: SELinux is preventing /usr/libexec/qemu-kvm from map access on the chr_file /dev/vhost-vdpa-0.#012#012*****  Plugin catchall (100. confidence) suggests   **************************#012#012If you believe that qemu-kvm should be allowed map access on the vhost-vdpa-0 chr_file by default.#012Then you should report this as a bug.#012You can generate a local policy module to allow this access.#012Do#012allow this access for now by executing:#012# ausearch -c 'CPU 0/KVM' --raw | audit2allow -M my-CPU0KVM#012# semodule -X 300 -i my-CPU0KVM.pp#012

5.Avc deny:
time->Sun Dec 26 22:21:14 2021
type=PROCTITLE msg=audit(1640575274.465:1513): proctitle=2F7573722F6C6962657865632F71656D752D6B766D002D6E616D650067756573743D72392C64656275672D746872656164733D6F6E002D53002D6F626A656374007B22716F6D2D74797065223A22736563726574222C226964223A226D61737465724B657930222C22666F726D6174223A22726177222C2266696C65223A222F
type=SYSCALL msg=audit(1640575274.465:1513): arch=c000003e syscall=9 success=no exit=-13 a0=0 a1=1000 a2=2 a3=1 items=0 ppid=1 pid=31328 auid=4294967295 uid=107 gid=107 euid=107 suid=107 fsuid=107 egid=107 sgid=107 fsgid=107 tty=(none) ses=4294967295 comm=43505520302F4B564D exe="/usr/libexec/qemu-kvm" subj=system_u:system_r:svirt_t:s0:c135,c969 key=(null)
type=AVC msg=audit(1640575274.465:1513): avc:  denied  { map } for  pid=31328 comm=43505520302F4B564D path="/dev/vhost-vdpa-0" dev="devtmpfs" ino=876 scontext=system_u:system_r:svirt_t:s0:c135,c969 tcontext=system_u:object_r:vhost_device_t:s0 tclass=chr_file permissive=0



Actual results:


Expected results:
No avc deny during booting guest with vdpa device.


Additional info:

Comment 1 Zdenek Pytela 2022-01-05 17:18:46 UTC
These permissions are already allowed:
rhel9# sesearch -A -s svirt_t -t vhost_device_t -c chr_file
allow virt_domain vhost_device_t:chr_file { append getattr ioctl lock read write };

Comment 8 errata-xmlrpc 2022-05-17 15:50:02 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (new packages: selinux-policy), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:3918


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