1. 16 10月, 2019 2 次提交
  2. 15 10月, 2019 36 次提交
  3. 14 10月, 2019 2 次提交
    • M
      security_stack: Perform rollback if one of stacked drivers fails · 9d03e9ad
      Michal Privoznik 提交于
      In order to have multiple security drivers hidden under one
      virSecurity* call, we have virSecurityStack driver which holds a
      list of registered security drivers and for every virSecurity*
      call it iterates over the list and calls corresponding callback
      in real security drivers. For instance, for
      virSecurityManagerSetAllLabel() it calls
      domainSetSecurityAllLabel callback sequentially in NOP, DAC and
      (possibly) SELinux or AppArmor drivers. This works just fine if
      the callback from every driver returns success. Problem arises
      when one of the drivers fails. For instance, aforementioned
      SetAllLabel() succeeds for DAC but fails in SELinux in which
      case all files that DAC relabelled are now owned by qemu:qemu (or
      whomever runs qemu) and thus permissions are leaked. This is even
      more visible with XATTRs which remain set for DAC.
      
      The solution is to perform a rollback on failure, i.e. call
      opposite action on drivers that succeeded.
      
      I'm providing rollback only for set calls and intentionally
      omitting restore calls for two reasons:
      
      1) restore calls are less likely to fail (they merely remove
      XATTRs and chown()/setfilecon() file - all of these operations
      succeeded in set call),
      
      2) we are not really interested in restore failures - in a very
      few places we check for retval of a restore function we do so
      only to print a warning.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1740024Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NCole Robinson <crobinso@redhat.com>
      9d03e9ad
    • M
      security_stack: Turn list of nested drivers into a doubly linked list · cd355a52
      Michal Privoznik 提交于
      In near future we will need to walk through the list of internal
      drivers in reversed order. The simplest solution is to turn
      singly linked list into a doubly linked list.
      We will not need to start from the end really, so there's no tail
      pointer kept.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NCole Robinson <crobinso@redhat.com>
      cd355a52