Bug 2087222 - SELinux is preventing qemu-system-x86 from using the dac_read_search capability
Summary: SELinux is preventing qemu-system-x86 from using the dac_read_search capability
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 36
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Nikola Knazekova
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-05-17 15:42 UTC by Andy Heath
Modified: 2023-05-25 19:30 UTC (History)
10 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2023-05-25 19:30:37 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Custom module for the svirt_t (227 bytes, text/plain)
2022-07-11 13:00 UTC, Andy Heath
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 2000881 1 medium CLOSED SELinux is preventing rpc-worker from connectto access on the unix_stream_socket /run/libvirt/virtlockd-sock 2023-06-26 09:17:43 UTC

Description Andy Heath 2022-05-17 15:42:32 UTC
Description of problem:
Upgraded to Fedora 36, trying to launch existing KVM VM's get the following SELinux error "SELinux is preventing qemu-system-x86 from using the dac_read_search capability."

Version-Release number of selected component (if applicable):
virt-manager-4.0.0-1.fc36.noarch
selinux-policy-36.8-2.fc36.noarch
kernel-5.17.6-300.fc36.x86_64

How reproducible:
Upgrade from Fedora 35 to Fedora 36 with existing VM's in virt-manager. Try to launch VM's via the virt-manager GUI. Get error followed by SELinux Alerts

Actual results:
Get SELinux errors for ipc_lock & dac_override

Expected results:
VM's to launch normaly

Additional info:
sudo ausearch -m avc -ts recent 
----
time->Tue May 17 11:37:57 2022
type=PROCTITLE msg=audit(1652801877.539:1207): proctitle=2F7573722F62696E2F71656D752D73797374656D2D7838365F3634002D6E616D650067756573743D416E7369626C652C64656275672D746872656164733D6F6E002D53002D6F626A656374007B22716F6D2D74797065223A22736563726574222C226964223A226D61737465724B657930222C22666F726D6174223A22726177
type=SYSCALL msg=audit(1652801877.539:1207): arch=c000003e syscall=425 success=yes exit=3 a0=80 a1=7ffe94419380 a2=0 a3=80 items=0 ppid=1 pid=16478 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="qemu-system-x86" exe="/usr/bin/qemu-system-x86_64" subj=system_u:system_r:svirt_t:s0:c181,c587 key=(null)
type=AVC msg=audit(1652801877.539:1207): avc:  denied  { ipc_lock } for  pid=16478 comm="qemu-system-x86" capability=14  scontext=system_u:system_r:svirt_t:s0:c181,c587 tcontext=system_u:system_r:svirt_t:s0:c181,c587 tclass=capability permissive=0
----
time->Tue May 17 11:37:57 2022
type=PROCTITLE msg=audit(1652801877.540:1208): proctitle=2F7573722F62696E2F71656D752D73797374656D2D7838365F3634002D6E616D650067756573743D416E7369626C652C64656275672D746872656164733D6F6E002D53002D6F626A656374007B22716F6D2D74797065223A22736563726574222C226964223A226D61737465724B657930222C22666F726D6174223A22726177
type=SYSCALL msg=audit(1652801877.540:1208): arch=c000003e syscall=425 success=yes exit=7 a0=80 a1=7ffe94419320 a2=0 a3=80 items=0 ppid=1 pid=16478 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="qemu-system-x86" exe="/usr/bin/qemu-system-x86_64" subj=system_u:system_r:svirt_t:s0:c181,c587 key=(null)
type=AVC msg=audit(1652801877.540:1208): avc:  denied  { ipc_lock } for  pid=16478 comm="qemu-system-x86" capability=14  scontext=system_u:system_r:svirt_t:s0:c181,c587 tcontext=system_u:system_r:svirt_t:s0:c181,c587 tclass=capability permissive=0
----
time->Tue May 17 11:37:57 2022
type=PROCTITLE msg=audit(1652801877.547:1209): proctitle=2F7573722F62696E2F71656D752D73797374656D2D7838365F3634002D6E616D650067756573743D416E7369626C652C64656275672D746872656164733D6F6E002D53002D6F626A656374007B22716F6D2D74797065223A22736563726574222C226964223A226D61737465724B657930222C22666F726D6174223A22726177
type=PATH msg=audit(1652801877.547:1209): item=0 name="/home/anheath/CentOS-Stream-GenericCloud-8-20210210.0.x86_64.qcow2" nametype=UNKNOWN cap_fp=0 cap_fi=0 cap_fe=0 cap_fver=0 cap_frootid=0
type=CWD msg=audit(1652801877.547:1209): cwd="/"
type=SYSCALL msg=audit(1652801877.547:1209): arch=c000003e syscall=257 success=no exit=-13 a0=ffffff9c a1=55e6d7a78f70 a2=80000 a3=0 items=1 ppid=1 pid=16478 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="qemu-system-x86" exe="/usr/bin/qemu-system-x86_64" subj=system_u:system_r:svirt_t:s0:c181,c587 key=(null)
type=AVC msg=audit(1652801877.547:1209): avc:  denied  { dac_override } for  pid=16478 comm="qemu-system-x86" capability=1  scontext=system_u:system_r:svirt_t:s0:c181,c587 tcontext=system_u:system_r:svirt_t:s0:c181,c587 tclass=capability permissive=0
type=AVC msg=audit(1652801877.547:1209): avc:  denied  { dac_read_search } for  pid=16478 comm="qemu-system-x86" capability=2  scontext=system_u:system_r:svirt_t:s0:c181,c587 tcontext=system_u:system_r:svirt_t:s0:c181,c587 tclass=capability permissive=0

sudo ausearch -m avc -ts recent | audit2allow -m f36-kvm-bugzilla

module f36-kvm-bugzilla 1.0;

require {
	type svirt_t;
	class capability { dac_override dac_read_search ipc_lock };
}

#============= svirt_t ==============
allow svirt_t self:capability { dac_override dac_read_search ipc_lock };

Comment 1 Zdenek Pytela 2022-05-17 17:49:16 UTC
The denials interpreted:

----
type=PROCTITLE msg=audit(05/17/2022 11:37:57.539:1207) : proctitle=/usr/bin/qemu-system-x86_64 -name guest=Ansible,debug-threads=on -S -object {"qom-type":"secret","id":"masterKey0","format":"raw 
type=AVC msg=audit(05/17/2022 11:37:57.539:1207) : avc:  denied  { ipc_lock } for  pid=16478 comm=qemu-system-x86 capability=ipc_lock  scontext=system_u:system_r:svirt_t:s0:c181 c587 tcontext=system_u:system_r:svirt_t:s0:c181 c587 tclass=capability permissive=0 
type=SYSCALL msg=audit(05/17/2022 11:37:57.539:1207) : arch=x86_64 syscall=io_uring_setup success=yes exit=3 a0=0x80 a1=0x7ffe94419380 a2=0x0 a3=0x80 items=0 ppid=1 pid=16478 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=qemu-system-x86 exe=/usr/bin/qemu-system-x86_64 subj=system_u:system_r:svirt_t:s0:c181,c587 key=(null)
----
type=PROCTITLE msg=audit(05/17/2022 11:37:57.540:1208) : proctitle=/usr/bin/qemu-system-x86_64 -name guest=Ansible,debug-threads=on -S -object {"qom-type":"secret","id":"masterKey0","format":"raw
type=AVC msg=audit(05/17/2022 11:37:57.540:1208) : avc:  denied  { ipc_lock } for  pid=16478 comm=qemu-system-x86 capability=ipc_lock  scontext=system_u:system_r:svirt_t:s0:c181 c587 tcontext=system_u:system_r:svirt_t:s0:c181 c587 tclass=capability permissive=0
type=SYSCALL msg=audit(05/17/2022 11:37:57.540:1208) : arch=x86_64 syscall=io_uring_setup success=yes exit=7 a0=0x80 a1=0x7ffe94419320 a2=0x0 a3=0x80 items=0 ppid=1 pid=16478 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=qemu-system-x86 exe=/usr/bin/qemu-system-x86_64 subj=system_u:system_r:svirt_t:s0:c181,c587 key=(null)
----
type=PROCTITLE msg=audit(05/17/2022 11:37:57.547:1209) : proctitle=/usr/bin/qemu-system-x86_64 -name guest=Ansible,debug-threads=on -S -object {"qom-type":"secret","id":"masterKey0","format":"raw
type=AVC msg=audit(05/17/2022 11:37:57.547:1209) : avc:  denied  { dac_read_search } for  pid=16478 comm=qemu-system-x86 capability=dac_read_search  scontext=system_u:system_r:svirt_t:s0:c181 c587 tcontext=system_u:system_r:svirt_t:s0:c181 c587 tclass=capability permissive=0
type=AVC msg=audit(05/17/2022 11:37:57.547:1209) : avc:  denied  { dac_override } for  pid=16478 comm=qemu-system-x86 capability=dac_override  scontext=system_u:system_r:svirt_t:s0:c181 c587 tcontext=system_u:system_r:svirt_t:s0:c181 c587 tclass=capability permissive=0
type=SYSCALL msg=audit(05/17/2022 11:37:57.547:1209) : arch=x86_64 syscall=openat success=no exit=EACCES(Permission denied) a0=AT_FDCWD a1=0x55e6d7a78f70 a2=O_RDONLY|O_CLOEXEC a3=0x0 items=1 ppid=1 pid=16478 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=qemu-system-x86 exe=/usr/bin/qemu-system-x86_64 subj=system_u:system_r:svirt_t:s0:c181,c587 key=(null)
type=CWD msg=audit(05/17/2022 11:37:57.547:1209) : cwd=/
type=PATH msg=audit(05/17/2022 11:37:57.547:1209) : item=0 name=/home/anheath/CentOS-Stream-GenericCloud-8-20210210.0.x86_64.qcow2 nametype=UNKNOWN cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 cap_frootid=0


capabilities(7):
       CAP_IPC_LOCK
              * Lock memory (mlock(2), mlockall(2), mmap(2), shmctl(2));
              * Allocate memory using huge pages (memfd_create(2) mmap(2), shmctl(2)).

Comment 2 Andy Heath 2022-07-11 13:00:23 UTC
Created attachment 1896072 [details]
Custom module for the svirt_t

I have created a custom module and tested it

Comment 3 Ben Cotton 2023-04-25 18:24:20 UTC
This message is a reminder that Fedora Linux 36 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 36 on 2023-05-16.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '36'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 36 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 4 Ludek Smid 2023-05-25 19:30:37 UTC
Fedora Linux 36 entered end-of-life (EOL) status on 2023-05-16.

Fedora Linux 36 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.


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