1. 17 4月, 2020 1 次提交
  2. 20 3月, 2020 1 次提交
  3. 14 3月, 2020 1 次提交
  4. 09 3月, 2020 1 次提交
    • M
      security: Introduce VIR_SECURITY_DOMAIN_IMAGE_PARENT_CHAIN_TOP flag · 62f3d8ad
      Michal Privoznik 提交于
      Our decision whether to remember seclabel for a disk image
      depends on a few factors. If the image is readonly or shared or
      not the chain top the remembering is suppressed for the image.
      However, the virSecurityManagerSetImageLabel() is too low level
      to determine whether passed @src is chain top or not. Even though
      the function has the @parent argument it does not necessarily
      reflect the chain top - it only points to the top level image in
      the chain we want to relabel and not to the topmost image of the
      whole chain. And this can't be derived from the passed domain
      definition reliably neither - in some cases (like snapshots or
      block copy) the @src is added to the definition only after the
      operation succeeded. Therefore, introduce a flag which callers
      can use to help us with the decision.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NPeter Krempa <pkrempa@redhat.com>
      62f3d8ad
  5. 25 2月, 2020 1 次提交
  6. 29 1月, 2020 3 次提交
  7. 07 1月, 2020 2 次提交
  8. 17 12月, 2019 1 次提交
  9. 03 12月, 2019 1 次提交
  10. 12 11月, 2019 1 次提交
  11. 23 10月, 2019 1 次提交
  12. 21 10月, 2019 3 次提交
  13. 16 10月, 2019 1 次提交
  14. 15 10月, 2019 2 次提交
  15. 14 10月, 2019 2 次提交
  16. 12 10月, 2019 6 次提交
  17. 11 10月, 2019 2 次提交
  18. 10 9月, 2019 1 次提交
  19. 31 8月, 2019 1 次提交
  20. 30 8月, 2019 5 次提交
  21. 22 8月, 2019 1 次提交
    • M
      security: Don't increase XATTRs refcounter on failure · 6a2806fd
      Michal Privoznik 提交于
      If user has two domains, each have the same disk (configured for
      RW) but each runs with different seclabel then we deny start of
      the second domain because in order to do that we would need to
      relabel the disk but that would cut the first domain off. Even if
      we did not do that, qemu would fail to start because it would be
      unable to lock the disk image for the second time. So far, this
      behaviour is expected. But what is not expected is that we
      increase the refcounter in XATTRs and leave it like that.
      
      What happens is that when the second domain starts,
      virSecuritySetRememberedLabel() is called, and since there are
      XATTRs from the first domain it increments the refcounter and
      returns it (refcounter == 2 at this point). Then callers
      (virSecurityDACSetOwnership() and
      virSecuritySELinuxSetFileconHelper()) realize that refcounter is
      greater than 1 and desired seclabel doesn't match the one the
      disk image already has and an error is produced. But the
      refcounter is never decremented.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1740024Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NMartin Kletzander <mkletzan@redhat.com>
      6a2806fd
  22. 03 7月, 2019 2 次提交
    • M
    • M
      security: Don't remember owner for shared resources · 8b1660e5
      Michal Privoznik 提交于
      This effectively reverts d7420430 and adds new code.
      
      Here is the problem: Imagine a file X that is to be shared
      between two domains as a disk. Let the first domain (vm1) have
      seclabel remembering turned on and the other (vm2) has it turned
      off. Assume that both domains will run under the same user, but
      the original owner of X is different (i.e. trying to access X
      without relabelling leads to EPERM).
      
      Let's start vm1 first. This will cause X to be relabelled and to
      gain new attributes:
      
        trusted.libvirt.security.ref_dac="1"
        trusted.libvirt.security.dac="$originalOwner"
      
      When vm2 is started, X will again be relabelled, but since the
      new label is the same as X already has (because of vm1) nothing
      changes and vm1 and vm2 can access X just fine. Note that no
      XATTR is changed (especially the refcounter keeps its value of 1)
      because the vm2 domain has the feature turned off.
      
      Now, vm1 is shut off and vm2 continues running. In seclabel
      restore process we would get to X and since its refcounter is 1
      we would restore the $originalOwner on it. But this is unsafe to
      do because vm2 is still using X (remember the assumption that
      $originalOwner and vm2's seclabel are distinct?).
      
      The problem is that refcounter stored in XATTRs doesn't reflect
      the actual times a resource is in use. Since I don't see any easy
      way around it let's just not store original owner on shared
      resources. Shared resource in world of domain disks is:
      
        - whole backing chain but the top layer,
        - read only disk (we don't require CDROM to be explicitly
          marked as shareable),
        - disk marked as shareable.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      8b1660e5