• J
    implement usb and pci hot attach in AppArmor driver · 593e0072
    Jamie Strandboge 提交于
    Description: Implement AppArmorSetSecurityHostdevLabel() and
    AppArmorRestoreSecurityHostdevLabel() for hostdev and pcidev attach.
    
    virt-aa-helper also has to be adjusted because *FileIterate() is used for pci
    and usb devices and the corresponding XML for hot attached hostdev and pcidev
    is not in the XML passed to virt-aa-helper. The new '-F filename' option is
    added to append a rule to the profile as opposed to the existing '-f
    filename', which rewrites the libvirt-<uuid>.files file anew. This new '-F'
    option will append a rule to an existing libvirt-<uuid>.files if it exists,
    otherwise it acts the same as '-f'.
    
    load_profile() and reload_profile() have been adjusted to add an 'append'
    argument, which when true will use '-F' instead of '-f' when executing
    virt-aa-helper.
    
    All existing calls to load_profile() and reload_profile() have been adjusted
    to use the old behavior (ie append==false) except AppArmorSetSavedStateLabel()
    where it made sense to use the new behavior.
    
    This patch also adds tests for '-F'.
    
    Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/640993
    593e0072
security_apparmor.c 21.7 KB