This bug has been migrated to another issue tracking site. It has been closed here and may no longer be being monitored.

If you would like to get updates for this issue, or to participate in it, you may do so at Red Hat Issue Tracker .
Bug 2156523 - For disk hot-plug, RAWIO is not set actually
Summary: For disk hot-plug, RAWIO is not set actually
Keywords:
Status: CLOSED MIGRATED
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: libvirt
Version: 9.2
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Virtualization Maintenance
QA Contact: Han Han
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-12-27 09:34 UTC by Han Han
Modified: 2023-07-07 21:19 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-07-07 21:19:27 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker   RHEL-749 0 None None None 2023-07-07 21:19:26 UTC
Red Hat Issue Tracker RHELPLAN-143238 0 None None None 2022-12-27 09:39:21 UTC

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.


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