Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 2156523

Summary: For disk hot-plug, RAWIO is not set actually
Product: Red Hat Enterprise Linux 9 Reporter: Han Han <hhan>
Component: libvirtAssignee: Virtualization Maintenance <virt-maint>
libvirt sub component: General QA Contact: Han Han <hhan>
Status: CLOSED MIGRATED Docs Contact:
Severity: low    
Priority: low CC: jsuchane, lmen, mprivozn, virt-maint, yisun
Version: 9.2Keywords: MigratedToJIRA, Triaged
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-07-07 21:19:27 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Han Han 2022-12-27 09:34:37 UTC
Description of problem:
As subject

Version-Release number of selected component (if applicable):
qemu-kvm-7.2.0-2.el9.x86_64
kernel-5.14.0-207.el9.x86_64
libvirt-8.10.0-2.el9.x86_64

How reproducible:


Steps to Reproduce:
1. Start an VM
➜  ~ virsh list 
 Id   Name       State
--------------------------
 4    rhel-9.2   running


2. Attach an disk with rawio='yes' then check the capabilities of the qemu-kvm process and its threads
➜  ~ virsh attach-device rhel-9.2 ./rawio.xml         
Device attached successfully 

➜  ~ cat rawio.xml 
    <disk type='block' device='lun' rawio='yes'>
      <driver name='qemu' type='raw'/>
      <source dev='/dev/sda'/>
      <target dev='sda' bus='scsi'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>


➜  ~ getpcaps `pidof qemu-kvm`
439898: =

➜  ~ for i in $(ps -T -p `pidof qemu-kvm`|awk 'NR!=1{print $2}');do getpcaps $i;done
439898: =
439917: =
439921: =
439922: =
439924: =

Actual results:
As above

Expected results:
- Disallow hot-plug with rawio='yes'
- Or support to set/unset the RAWIO capabilities for qemu-kvm process or its threads. Expect the results like starting VM with rawio='yes':
➜  ~ getpcaps `pidof qemu-kvm`                                                     
440300: cap_sys_rawio=eip

➜  ~ for i in $(ps -T -p `pidof qemu-kvm`|awk 'NR!=1{print $2}');do getpcaps $i;done
440300: cap_sys_rawio=eip
440315: cap_sys_rawio=eip
440319: cap_sys_rawio=eip
440320: cap_sys_rawio=eip
440323: cap_sys_rawio=eip

Additional info:

Comment 1 Han Han 2022-12-27 09:44:26 UTC
The same issue for hostdev@rawio:
  <hostdev mode='subsystem' type='scsi' rawio='yes'>
    <source>
      <adapter name='scsi_host2'/>
      <address bus='0' target='0' unit='0'/>
    </source>
    <readonly/>
  </hostdev>

Comment 2 Michal Privoznik 2023-01-18 12:09:27 UTC
I'm not sure this is a solvable issue. I mean, once QEMU permissions are dropped there's not a mechanism that would allow us to enable it in QEMU again. It would require us to not drop CAP_SYS_RAWIO from the bounding set and then notify QEMU to try and promote the capability. But yeah, QEMU knows nothing about its capabilities. In other words, we may as well deny hotplugging if QEMU was started without the capability.