1. 25 11月, 2017 1 次提交
  2. 03 11月, 2017 4 次提交
    • A
      Remove backslash alignment attempts · 3e7db8d3
      Andrea Bolognani 提交于
      Right-aligning backslashes when defining macros or using complex
      commands in Makefiles looks cute, but as soon as any changes is
      required to the code you end up with either distractingly broken
      alignment or unnecessarily big diffs where most of the changes
      are just pushing all backslashes a few characters to one side.
      
      Generated using
      
        $ git grep -El '[[:blank:]][[:blank:]]\\$' | \
          grep -E '*\.([chx]|am|mk)$$' | \
          while read f; do \
            sed -Ei 's/[[:blank:]]*[[:blank:]]\\$/ \\/g' "$f"; \
          done
      Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
      3e7db8d3
    • P
      security: selinux: Take parent security label into account · cc16fa2a
      Peter Krempa 提交于
      Until now we ignored user-provided backing chains and while detecting
      the code inherited labels of the parent device. With user provided
      chains we should keep this functionality, so label of the parent image
      in the backing chain will be applied if an image-specific label is not
      present.
      cc16fa2a
    • P
      security: dac: Take parent security label into account · 2742dfee
      Peter Krempa 提交于
      Until now we ignored user-provided backing chains and while detecting
      the code inherited labels of the parent device. With user provided
      chains we should keep this functionality, so label of the parent image
      in the backing chain will be applied if an image-specific label is not
      present.
      2742dfee
    • P
      security: selinux: Pass parent storage source into image labeling helper · 023da7dd
      Peter Krempa 提交于
      virSecuritySELinuxSetImageLabelInternal assigns different labels to
      backing chain members than to the parent image. This was done via the
      'first' flag. Convert it to passing in pointer to the parent
      virStorageSource. This will allow us to use the parent virStorageSource
      in further changes.
      023da7dd
  3. 27 10月, 2017 1 次提交
  4. 26 10月, 2017 1 次提交
    • C
      virt-aa-helper: grant locking permission on -f · 07fc5c9c
      Christian Ehrhardt 提交于
      Hot-adding disks does not parse the full XML to generate apparmor rules.
      Instead it uses -f <PATH> to append a generic rule for that file path.
      
      580cdaa7: "virt-aa-helper: locking disk files for qemu 2.10" implemented
      the qemu 2.10 requirement to allow locking on disks images that are part of
      the domain xml.
      
      But on attach-device a user will still trigger an apparmor deny by going
      through virt-aa-helper -f, to fix that add the lock "k" permission to the
      append file case of virt-aa-helper.
      Signed-off-by: NChristian Ehrhardt <christian.ehrhardt@canonical.com>
      07fc5c9c
  5. 17 10月, 2017 1 次提交
    • P
      util: storagefile: Add helpers to check presence of backing store · 0a294a8e
      Peter Krempa 提交于
      Add helpers that will simplify checking if a backing file is valid or
      whether it has backing store. The helper virStorageSourceIsBacking
      returns true if the given virStorageSource is a valid backing store
      member. virStorageSourceHasBacking returns true if the virStorageSource
      has a backing store child.
      
      Adding these functions creates a central points for further refactors.
      0a294a8e
  6. 06 10月, 2017 3 次提交
    • C
      virt-aa-helper: put static rules in quotes · cbd60952
      Christian Ehrhardt 提交于
      To avoid any issues later on if paths ever change (unlikely but
      possible) and to match the style of other generated rules the paths
      of the static rules have to be quoted as well.
      Signed-off-by: NChristian Ehrhardt <christian.ehrhardt@canonical.com>
      cbd60952
    • C
      virt-aa-helper: allow spaces in vm names · e79211ed
      Christian Ehrhardt 提交于
      libvirt allows spaces in vm names, there were issues in the past but it
      seems not removed so the assumption has to be that spaces are continuing
      to be allowed.
      
      Therefore virt-aa-helper should not reject spaces in vm names anymore if
      it is going to be refused causing issues then the parser or xml schema
      should do so.
      Apparmor rules are in quotes, so a space in a path based on the name works.
      Signed-off-by: NChristian Ehrhardt <christian.ehrhardt@canonical.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      e79211ed
    • C
      virt-aa-helper: fix paths for usb hostdevs · 750e0844
      Christian Ehrhardt 提交于
      If users only specified vendor&product (the common case) then parsing
      the xml via virDomainHostdevSubsysUSBDefParseXML would only set these.
      Bus and Device would much later be added when the devices are prepared
      to be added.
      
      Due to that a hot-add of a usb hostdev works as the device is prepared
      and virt-aa-helper processes the new internal xml. But on an initial
      guest start at the time virt-aa-helper renders the apparmor rules the
      bus/device id's are not set yet:
      
      p ctl->def->hostdevs[0]->source.subsys.u.usb
      $12 = {autoAddress = false, bus = 0, device = 0, vendor = 1921, product
      = 21888}
      
      That causes rules to be wrong:
        "/dev/bus/usb/000/000" rw,
      
      The fix calls virHostdevFindUSBDevice after reading the XML from
      virt-aa-helper to only add apparmor rules for devices that could be found
      and now are fully known to be able to write the rule correctly.
      
      It uncondtionally sets virHostdevFindUSBDevice mandatory attribute as
      adding an apparmor rule for a device not found makes no sense no matter
      what startup policy it has set.
      Signed-off-by: NChristian Ehrhardt <christian.ehrhardt@canonical.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      750e0844
  7. 25 9月, 2017 1 次提交
  8. 22 9月, 2017 1 次提交
  9. 19 9月, 2017 1 次提交
  10. 13 9月, 2017 2 次提交
  11. 21 8月, 2017 1 次提交
    • J
      Don't autogenerate seclabels of type 'none' · 0f1993aa
      Jim Fehlig 提交于
      When security drivers are active but confinement is not enabled,
      there is no need to autogenerate <seclabel> elements when starting
      a domain def that contains no <seclabel> elements. In fact,
      autogenerating the elements can result in needless save/restore and
      migration failures when the security driver is not active on the
      restore/migration target.
      
      This patch changes the virSecurityManagerGenLabel function in
      src/security_manager.c to only autogenerate a <seclabel> element
      if none is already defined for the domain *and* default
      confinement is enabled. Otherwise the needless <seclabel>
      autogeneration is skipped.
      
      Resolves: https://bugzilla.opensuse.org/show_bug.cgi?id=1051017
      0f1993aa
  12. 17 8月, 2017 2 次提交
    • C
      virt-aa-helper: locking loader/nvram for qemu 2.10 · 03fb4e3d
      Christian Ehrhardt 提交于
      Testing qemu-2.10-rc3 shows issues like:
        qemu-system-aarch64: -drive file=/home/ubuntu/vm-start-stop/vms/
        7936-0_CODE.fd,if=pflash,format=raw,unit=1: Failed to unlock byte 100
      
      There is an apparmor deny due to qemu now locking those files:
       apparmor="DENIED" operation="file_lock" [...]
       name="/home/ubuntu/vm-start-stop/vms/7936-0_CODE.fd"
       name="/var/lib/uvtool/libvirt/images/kvmguest-artful-normal.qcow"
       [...] comm="qemu-system-aarch64" requested_mask="k" denied_mask="k"
      
      The profile needs to allow locking for loader and nvram files via
      the locking (k) rule.
      Signed-off-by: NChristian Ehrhardt <christian.ehrhardt@canonical.com>
      03fb4e3d
    • C
      virt-aa-helper: locking disk files for qemu 2.10 · 580cdaa7
      Christian Ehrhardt 提交于
      Testing qemu-2.10-rc2 shows issues like:
        qemu-system-x86_64: -drive file=/var/lib/uvtool/libvirt/images/kvmguest- \
        artful-normal.qcow,format=qcow2,if=none,id=drive-virtio-disk0:
        Failed to lock byte 100
      
      It seems the following qemu commit changed the needs for the backing
      image rules:
      
      (qemu) commit 244a5668106297378391b768e7288eb157616f64
      Author: Fam Zheng <famz@redhat.com>
          file-posix: Add image locking to perm operations
      
      The block appears as:
       apparmor="DENIED" operation="file_lock" [...]
       name="/var/lib/uvtool/libvirt/images/kvmguest-artful-normal.qcow"
       [...] comm="qemu-system-x86" requested_mask="k" denied_mask="k"
      
      With that qemu change in place the rules generated for the image
      and backing files need the allowance to also lock (k) the files.
      
      Disks are added via add_file_path and with this fix rules now get
      that permission, but no other rules are changed, example:
        -  "/var/lib/uvtool/libvirt/images/kvmguest-artful-normal-a2.qcow" rw,
        +  "/var/lib/uvtool/libvirt/images/kvmguest-artful-normal-a2.qcow" rwk
      Signed-off-by: NChristian Ehrhardt <christian.ehrhardt@canonical.com>
      580cdaa7
  13. 14 8月, 2017 1 次提交
  14. 27 7月, 2017 1 次提交
  15. 19 7月, 2017 1 次提交
  16. 11 7月, 2017 1 次提交
  17. 22 6月, 2017 1 次提交
    • M
      security: Don't skip relabel for all chardevs · e0d1a378
      Michal Privoznik 提交于
      Our commit e13e8808 was way too generic. Currently, virtlogd is
      used only for chardevs type of file and nothing else. True, we
      must not relabel the path in this case, but we have to in all
      other cases. For instance, if you want to have a physical console
      attached to your guest:
      
          <console type='dev'>
            <source path='/dev/ttyS0'/>
            <target type='virtio' port='1'/>
          </console>
      
      Starting such domain fails because qemu doesn't have access to
      /dev/ttyS0 because we haven't relabelled the path.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      e0d1a378
  18. 16 6月, 2017 4 次提交
  19. 07 6月, 2017 1 次提交
  20. 05 6月, 2017 1 次提交
  21. 24 5月, 2017 1 次提交
  22. 18 5月, 2017 1 次提交
  23. 27 4月, 2017 1 次提交
  24. 27 3月, 2017 2 次提交
    • E
      security: Enable labeling of vfio mediated devices · 606afafb
      Erik Skultety 提交于
      This patch updates all of our security driver to start labeling the
      VFIO IOMMU devices under /dev/vfio/ as well.
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      606afafb
    • E
      conf: Introduce new hostdev device type mdev · ec783d7c
      Erik Skultety 提交于
      A mediated device will be identified by a UUID (with 'model' now being
      a mandatory <hostdev> attribute to represent the mediated device API) of
      the user pre-created mediated device. We also need to make sure that if
      user explicitly provides a guest address for a mdev device, the address
      type will be matching the device API supported on that specific mediated
      device and error out with an incorrect XML message.
      
      The resulting device XML:
      <devices>
        <hostdev mode='subsystem' type='mdev' model='vfio-pci'>
          <source>
            <address uuid='c2177883-f1bb-47f0-914d-32a22e3a8804'>
          </source>
        </hostdev>
      </devices>
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      ec783d7c
  25. 15 3月, 2017 4 次提交
  26. 15 2月, 2017 1 次提交
    • J
      apparmor: don't fail on non-apparmor <seclabel> · ec94e14b
      Jim Fehlig 提交于
      If the apparmor security driver is loaded/enabled and domain config
      contains a <seclabel> element whose type attribute is not 'apparmor',
      starting the domain fails when attempting to label resources such
      as tap FDs.
      
      Many of the apparmor driver entry points attempt to retrieve the
      apparmor security label from the domain def, returning failure if
      not found. Functions such as AppArmorSetFDLabel fail even though
      domain config contains an explicit 'none' secuirty driver, e.g.
      
        <seclabel type='none' model='none'/>
      
      Change the entry points to succeed if the domain config <seclabel>
      is not apparmor. This matches the behavior of the selinux driver.
      ec94e14b