Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

F40 s390x: SELinux breaks virsh nodedev-define #2134

Open
eaibmz opened this issue May 24, 2024 · 6 comments
Open

F40 s390x: SELinux breaks virsh nodedev-define #2134

eaibmz opened this issue May 24, 2024 · 6 comments

Comments

@eaibmz
Copy link

eaibmz commented May 24, 2024

Hi,

i'm having a problem defining a pass-through DASD disk for a KVM system on F40 s390x.
And it seem to be a problem with incorrect SELinux policies.
This worked on F39 and has appeared right after F40 upgrade.

----
time->Fri May 24 10:39:58 2024
type=AVC msg=audit(1716539998.789:2451): avc:  denied  { write } for  pid=15366 comm="mdevctl" name="mdevctl.d" dev="dasda1" ino=9438325 scontext=system_u:system_r:virtnodedevd_t:s0 tcontext=system_u:object_r:etc_t:s0 tclass=dir permissive=0
----
time->Fri May 24 10:40:00 2024
type=AVC msg=audit(1716540000.769:2452): avc:  denied  { write } for  pid=15455 comm="mdevctl" name="mdevctl.d" dev="dasda1" ino=9438325 scontext=system_u:system_r:virtnodedevd_t:s0 tcontext=system_u:object_r:etc_t:s0 tclass=dir permissive=0
----

Setup instructions for DASD pass-through: https://www.ibm.com/docs/en/linux-on-z?topic=dasd-create-mediated-device

Please advise how to fix it.
Thank you.

Regards
Alex

@mhartmay
Copy link

The problem is that virtnodedevd (from the libvirt project) needs access to /etc/mdevctl.d/ for two reasons:

  1. it starts mdevctl (https://github.com/mdevctl/mdevctl) to control and list mediated devices (e.g. https://gitlab.com/libvirt/libvirt/-/blob/master/src/node_device/node_device_driver.c?ref_type=heads#L824) - this is the issue reported by @eaibmz
  2. it monitors /etc/mdevctl.d/ for file changes (https://gitlab.com/libvirt/libvirt/-/blob/master/src/node_device/node_device_udev.c?ref_type=heads#L2156)

What I also see on Fedora 40 (not sure whether a separate issue should be created for this):

type=AVC msg=audit(1715674489.409:248): avc:  denied  { read write } for  pid=1862 comm="virtnodedevd" name="z90crypt" dev="devtmpfs" ino=124 scontext=system_u:system_r:virtnodedevd_t:s0 tcontext=system_u:object_r:crypt_device_t:s0 tclass=chr_file permissive=0
type=AVC msg=audit(1715674490.959:250): avc:  denied  { write } for  pid=1911 comm="ap-check" name="lock" dev="tmpfs" ino=27 scontext=system_u:system_r:virtnodedevd_t:s0 tcontext=system_u:object_r:var_lock_t:s0 tclass=dir permissive=0

ap-check is a so-called "callout" script of mdevctl (see https://github.com/mdevctl/mdevctl/blob/master/mdevctl.rst#call-out-event-scripts for more information).

@zpytela
Copy link
Contributor

zpytela commented Aug 30, 2024

As for the original report, please try copr build in #2319 -> Checks -> rawhide/f40.

For the lock file issue, I'd like to see more information, with full auditing and in permissive mode if possible.

@eaibmz
Copy link
Author

eaibmz commented Sep 2, 2024

As for the original report, please try copr build in #2319 -> Checks -> rawhide/f40.

For the lock file issue, I'd like to see more information, with full auditing and in permissive mode if possible.

Hmm, the problem occurs on 390x arch, i'm not able to use a x86_64 copr build.

@eaibmz
Copy link
Author

eaibmz commented Sep 2, 2024

As for the original report, please try copr build in #2319 -> Checks -> rawhide/f40.
For the lock file issue, I'd like to see more information, with full auditing and in permissive mode if possible.

Hmm, the problem occurs on 390x arch, i'm not able to use a x86_64 copr build.

okay, scratch it, was able to install them with some hacks :)
testing ....

@eaibmz
Copy link
Author

eaibmz commented Sep 3, 2024

Hmm, i enabled SELinux again and it seems to work again. BUT i didn't install your changes.
Is it already upstreamed to Fedora ?

selinux-policy-40.27-1.fc40.src.rpm is currently installed.

@zpytela
Copy link
Contributor

zpytela commented Sep 4, 2024

It was not even in rawhide, but I will create new builds containing the change soon to confirm if it is sufficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants