• D
    security: do not remember/recall labels for VFIO · dbf1f684
    Daniel Henrique Barboza 提交于
    Files inside /dev/vfio/ can't be opened more than once, meaning
    that any subsequent open calls will fail. This behavior was
    introduced in kernel v3.11, commit 6d6768c61b39.
    
    When using the VFIO driver, we open a FD to /dev/vfio/N and
    pass it to QEMU. If any other call attempt for the same
    /dev/vfio/N happens while QEMU is still using the file, we are
    unable to open it and QEMU will report -EBUSY. This can happen
    if we hotplug a PCI hostdev that belongs to the same IOMMU group
    of an existing domain hostdev.
    
    The problem and solution is similar to what we already dealt
    with for TPM in commit 4e95cdcb. This patch changes both
    DAC and SELinux drivers to disable 'remember' for VFIO hostdevs
    in virSecurityDACSetHostdevLabelHelper() and
    virSecurityDACSetHostdevLabel(), and 'recall'
    in virSecurityDACRestoreHostdevLabel() and
    virSecuritySELinuxRestoreHostdevSubsysLabel().
    Signed-off-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
    Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
    dbf1f684
security_dac.c 77.7 KB