1. 14 3月, 2013 3 次提交
    • D
      Fix parsing of SELinux ranges without a category · 1732c1c6
      Daniel P. Berrange 提交于
      Normally libvirtd should run with a SELinux label
      
        system_u:system_r:virtd_t:s0-s0:c0.c1023
      
      If a user manually runs libvirtd though, it is sometimes
      possible to get into a situation where it is running
      
        system_u:system_r:init_t:s0
      
      The SELinux security driver isn't expecting this and can't
      parse the security label since it lacks the ':c0.c1023' part
      causing it to complain
      
        internal error Cannot parse sensitivity level in s0
      
      This updates the parser to cope with this, so if no category
      is present, libvirtd will hardcode the equivalent of c0.c1023.
      
      Now this won't work if SELinux is in Enforcing mode, but that's
      not an issue, because the user can only get into this problem
      if in Permissive mode. This means they can now start VMs in
      Permissive mode without hitting that parsing error
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      1732c1c6
    • D
      Separate MCS range parsing from MCS range checking · 4a92fe44
      Daniel P. Berrange 提交于
      Pull the code which parses the current process MCS range
      out of virSecuritySELinuxMCSFind and into a new method
      virSecuritySELinuxMCSGetProcessRange.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      4a92fe44
    • D
      Fix memory leak on OOM in virSecuritySELinuxMCSFind · f2d8190c
      Daniel P. Berrange 提交于
      The body of the loop in virSecuritySELinuxMCSFind would
      directly 'return NULL' on OOM, instead of jumping to the
      cleanup label. This caused a leak of several local vars.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      f2d8190c
  2. 13 3月, 2013 1 次提交
    • P
      virCaps: conf: start splitting out irrelevat data · 27cf98e2
      Peter Krempa 提交于
      The virCaps structure gathered a ton of irrelevant data over time that.
      The original reason is that it was propagated to the XML parser
      functions.
      
      This patch aims to create a new data structure virDomainXMLConf that
      will contain immutable data that are used by the XML parser. This will
      allow two things we need:
      
      1) Get rid of the stuff from virCaps
      
      2) Allow us to add callbacks to check and add driver specific stuff
      after domain XML is parsed.
      
      This first attempt removes pointers to private data allocation functions
      to this new structure and update all callers and function that require
      them.
      27cf98e2
  3. 08 3月, 2013 1 次提交
    • G
      apparmor: use AppArmorSetFDLabel for both imageFD and tapFD · ce4557c3
      Guannan Ren 提交于
      Rename AppArmorSetImageFDLabel to AppArmorSetFDLabel which could
      be used as a common function for *ALL* fd relabelling in Linux.
      
      In apparmor profile for specific vm with uuid cdbebdfa-1d6d-65c3-be0f-fd74b978a773
      Path: /etc/apparmor.d/libvirt/libvirt-cdbebdfa-1d6d-65c3-be0f-fd74b978a773.files
      The last line is for the tapfd relabelling.
      
       # DO NOT EDIT THIS FILE DIRECTLY. IT IS MANAGED BY LIBVIRT.
        "/var/log/libvirt/**/rhel6qcow2.log" w,
        "/var/lib/libvirt/**/rhel6qcow2.monitor" rw,
        "/var/run/libvirt/**/rhel6qcow2.pid" rwk,
        "/run/libvirt/**/rhel6qcow2.pid" rwk,
        "/var/run/libvirt/**/*.tunnelmigrate.dest.rhel6qcow2" rw,
        "/run/libvirt/**/*.tunnelmigrate.dest.rhel6qcow2" rw,
        "/var/lib/libvirt/images/rhel6u3qcow2.img" rw,
        "/dev/tap45" rw,
      ce4557c3
  4. 01 3月, 2013 1 次提交
    • J
      Fix starting qemu instances when apparmor driver is enabled · 438a3850
      Jim Fehlig 提交于
      With the apparmor security driver enabled, qemu instances fail
      to start
      
      # grep ^security_driver /etc/libvirt/qemu.conf
      security_driver = "apparmor"
      # virsh start test-kvm
      error: Failed to start domain test-kvm
      error: internal error security label already defined for VM
      
      The model field of virSecurityLabelDef object is always populated
      by virDomainDefGetSecurityLabelDef(), so remove the check for a
      NULL model when verifying if a label is already defined for the
      instance.
      
      Checking for a NULL model and populating it later in
      AppArmorGenSecurityLabel() has been left in the code to be
      consistent with virSecuritySELinuxGenSecurityLabel().
      438a3850
  5. 16 2月, 2013 1 次提交
    • J
      security: Remove unnecessary checks for mgr == NULL · 676688b6
      John Ferlan 提交于
      Coverity found the DACGenLabel was checking for mgr == NULL after a
      possible dereference; however, in order to get into the function the
      virSecurityManagerGenLabel would have already dereferenced sec_managers[i]
      so the check was unnecessary. Same check is made in SELinuxGenSecurityLabel.
      676688b6
  6. 14 2月, 2013 1 次提交
    • L
      security: add new virSecurityManagerSetChildProcessLabel API · 7bf1aa0b
      Laine Stump 提交于
      The existing virSecurityManagerSetProcessLabel() API is designed so
      that it must be called after forking the child process, but before
      exec'ing the child. Due to the way the virCommand API works, that
      means it needs to be put in a "hook" function that virCommand is told
      to call out to at that time.
      
      Setting the child process label is a basic enough need when executing
      any process that virCommand should have a method of doing that. But
      virCommand must be told what label to set, and only the security
      driver knows the answer to that question.
      
      The new virSecurityManagerSet*Child*ProcessLabel() API is the way to
      transfer the knowledge about what label to set from the security
      driver to the virCommand object. It is given a virCommandPtr, and each
      security driver calls the appropriate virCommand* API to tell
      virCommand what to do between fork and exec.
      
      1) in the case of the DAC security driver, it calls
      virCommandSetUID/GID() to set a uid and gid that must be set for the
      child process.
      
      2) for the SELinux security driver, it calls
      virCommandSetSELinuxLabel() to save a copy of the char* that will be
      sent to setexeccon_raw() *after forking the child process*.
      
      3) for the AppArmor security drivers, it calls
      virCommandSetAppArmorProfile() to save a copy of the char* that will
      be sent to aa_change_profile() *after forking the child process*.
      
      With this new API in place, we will be able to remove
      virSecurityManagerSetProcessLabel() from any virCommand pre-exec
      hooks.
      
      (Unfortunately, the LXC driver uses clone() rather than virCommand, so
      it can't take advantage of this new security driver API, meaning that
      we need to keep around the older virSecurityManagerSetProcessLabel(),
      at least for now.)
      7bf1aa0b
  7. 12 2月, 2013 3 次提交
    • D
      Fix potential deadlock across fork() in QEMU driver · 61b52d2e
      Daniel P. Berrange 提交于
      The hook scripts used by virCommand must be careful wrt
      accessing any mutexes that may have been held by other
      threads in the parent process. With the recent refactoring
      there are 2 potential flaws lurking, which will become real
      deadlock bugs once the global QEMU driver lock is removed.
      
      Remove use of the QEMU driver lock from the hook function
      by passing in the 'virQEMUDriverConfigPtr' instance directly.
      
      Add functions to the virSecurityManager to be invoked before
      and after fork, to ensure the mutex is held by the current
      thread. This allows it to be safely used in the hook script
      in the child process.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      61b52d2e
    • E
      build: fix compilation of selinux on RHEL 5 · 736a87b9
      Eric Blake 提交于
      On RHEL 5, I got:
      
      security/security_selinux.c: In function 'getContext':
      security/security_selinux.c:971: warning: unused parameter 'mgr' [-Wunused-parameter]
      
      * src/security/security_selinux.c (getContext): Mark potentially
      unused parameter.
      736a87b9
    • D
      Remove re-entrant API call in SELinux/AppArmor security managers · 0ab49601
      Daniel P. Berrange 提交于
      The security manager drivers are not allowed to call back
      out to top level security manager APIs, since that results
      in recursive mutex acquisition and thus deadlock. Remove
      calls to virSecurityManagerGetModel from SELinux / AppArmor
      drivers
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      0ab49601
  8. 11 2月, 2013 2 次提交
  9. 08 2月, 2013 1 次提交
  10. 06 2月, 2013 2 次提交
  11. 24 1月, 2013 4 次提交
  12. 23 1月, 2013 1 次提交
  13. 22 1月, 2013 2 次提交
  14. 21 12月, 2012 13 次提交
  15. 19 12月, 2012 2 次提交
  16. 18 12月, 2012 2 次提交