1. 27 1月, 2020 1 次提交
    • D
      qemu: add support for running QEMU driver in embedded mode · 068efae5
      Daniel P. Berrangé 提交于
      This enables support for running QEMU embedded to the calling
      application process using a URI:
      
         qemu:///embed?root=/some/path
      
      Note that it is important to keep the path reasonably short to
      avoid risk of hitting the limit on UNIX socket path names
      which is 108 characters.
      
      When using the embedded mode with a root=/var/tmp/embed, the
      driver will use the following paths:
      
                      logDir: /var/tmp/embed/log/qemu
                 swtpmLogDir: /var/tmp/embed/log/swtpm
               configBaseDir: /var/tmp/embed/etc/qemu
                    stateDir: /var/tmp/embed/run/qemu
               swtpmStateDir: /var/tmp/embed/run/swtpm
                    cacheDir: /var/tmp/embed/cache/qemu
                      libDir: /var/tmp/embed/lib/qemu
             swtpmStorageDir: /var/tmp/embed/lib/swtpm
       defaultTLSx509certdir: /var/tmp/embed/etc/pki/qemu
      
      These are identical whether the embedded driver is privileged
      or unprivileged.
      
      This compares with the system instance which uses
      
                      logDir: /var/log/libvirt/qemu
                 swtpmLogDir: /var/log/swtpm/libvirt/qemu
               configBaseDir: /etc/libvirt/qemu
                    stateDir: /run/libvirt/qemu
               swtpmStateDir: /run/libvirt/qemu/swtpm
                    cacheDir: /var/cache/libvirt/qemu
                      libDir: /var/lib/libvirt/qemu
             swtpmStorageDir: /var/lib/libvirt/swtpm
       defaultTLSx509certdir: /etc/pki/qemu
      
      At this time all features present in the QEMU driver are available when
      running in embedded mode, availability matching whether the embedded
      driver is privileged or unprivileged.
      Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      068efae5
  2. 12 12月, 2019 1 次提交
    • D
      qemu: keep capabilities when running QEMU as root · 19023562
      Daniel P. Berrangé 提交于
      When QEMU uid/gid is set to non-root this is pointless as if we just
      used a regular setuid/setgid call, the process will have all its
      capabilities cleared anyway by the kernel.
      
      When QEMU uid/gid is set to root, this is almost (always?) never
      what people actually want. People make QEMU run as root in order
      to access some privileged resource that libvirt doesn't support
      yet and this often requires capabilities. As a result they have
      to go find the qemu.conf param to turn this off. This is not
      viable for libguestfs - they want to control everything via the
      XML security label to request running as root regardless of the
      qemu.conf settings for user/group.
      
      Clearing capabilities was implemented originally because there
      was a proposal in Fedora to change permissions such that root,
      with no capabilities would not be able to compromise the system.
      ie a locked down root account. This never went anywhere though,
      and as a result clearing capabilities when running as root does
      not really get us any security benefit AFAICT. The root user
      can easily do something like create a cronjob, which will then
      faithfully be run with full capabilities, trivially bypassing
      the restriction we place.
      
      IOW, our clearing of capabilities is both useless from a security
      POV, and breaks valid use cases when people need to run as root.
      
      This removes the clear_emulator_capabilities configuration
      option from qemu.conf, and always runs QEMU with capabilities
      when root.  The behaviour when non-root is unchanged.
      Reviewed-by: NCole Robinson <crobinso@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      19023562
  3. 09 12月, 2019 4 次提交
  4. 22 11月, 2019 1 次提交
    • D
      util: consolidate on one free callback for hash data · bc7e7291
      Daniel P. Berrangé 提交于
      This previous commit introduced a simpler free callback for
      hash data with only 1 arg, the value to free:
      
        commit 49288fac
        Author: Peter Krempa <pkrempa@redhat.com>
        Date:   Wed Oct 9 15:26:37 2019 +0200
      
          util: hash: Add possibility to use simpler data free function in virHash
      
      It missed two functions in the hash table code which need
      to call the alternate data free function, virHashRemoveEntry
      and virHashRemoveSet.
      
      After the previous patch though, there is no code that
      makes functional use of the 2nd key arg in the data
      free function. There is merely one log message that can
      be dropped.
      
      We can thus purge the current virHashDataFree callback
      entirely, and rename virHashDataFreeSimple to replace
      it.
      Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      bc7e7291
  5. 12 11月, 2019 1 次提交
  6. 14 10月, 2019 1 次提交
  7. 06 9月, 2019 2 次提交
  8. 07 8月, 2019 1 次提交
  9. 29 7月, 2019 1 次提交
  10. 25 7月, 2019 1 次提交
    • J
      qemu: Add support for overriding max threads per process limit · d5572f62
      Jim Fehlig 提交于
      Some VM configurations may result in a large number of threads created by
      the associated qemu process which can exceed the system default limit. The
      maximum number of threads allowed per process is controlled by the pids
      cgroup controller and is set to 16k when creating VMs with systemd's
      machined service. The maximum number of threads per process is recorded
      in the pids.max file under the machine's pids controller cgroup hierarchy,
      e.g.
      
      $cgrp-mnt/pids/machine.slice/machine-qemu\\x2d1\\x2dtest.scope/pids.max
      
      Maximum threads per process is controlled with the TasksMax property of
      the systemd scope for the machine. This patch adds an option to qemu.conf
      which can be used to override the maximum number of threads allowed per
      qemu process. If the value of option is greater than zero, it will be set
      in the TasksMax property of the machine's scope after creating the machine.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
      d5572f62
  11. 11 7月, 2019 1 次提交
    • D
      qemu: acquire a pidfile in the driver root directory · 1af03e27
      Daniel P. Berrangé 提交于
      When we allow multiple instances of the driver for the same user
      account, using a separate root directory, we need to ensure mutual
      exclusion. Use a pidfile to guarantee this.
      
      In privileged libvirtd this ends up locking
      
         /var/run/libvirt/qemu/driver.pid
      
      In unprivileged libvirtd this ends up locking
      
        /run/user/$UID/libvirt/qemu/run/driver.pid
      
      NB, the latter can vary depending on $XDG_RUNTIME_DIR
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      1af03e27
  12. 21 6月, 2019 3 次提交
  13. 19 6月, 2019 2 次提交
  14. 10 4月, 2019 1 次提交
  15. 22 1月, 2019 1 次提交
  16. 18 1月, 2019 1 次提交
  17. 17 1月, 2019 1 次提交
  18. 14 12月, 2018 2 次提交
    • D
      Enforce a standard header file guard symbol name · 568a4172
      Daniel P. Berrangé 提交于
      Require that all headers are guarded by a symbol named
      
        LIBVIRT_$FILENAME
      
      where $FILENAME is the uppercased filename, with all characters
      outside a-z changed into '_'.
      
      Note we do not use a leading __ because that is technically a
      namespace reserved for the toolchain.
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      568a4172
    • D
      Remove all Author(s): lines from source file headers · 60046283
      Daniel P. Berrangé 提交于
      In many files there are header comments that contain an Author:
      statement, supposedly reflecting who originally wrote the code.
      In a large collaborative project like libvirt, any non-trivial
      file will have been modified by a large number of different
      contributors. IOW, the Author: comments are quickly out of date,
      omitting people who have made significant contribitions.
      
      In some places Author: lines have been added despite the person
      merely being responsible for creating the file by moving existing
      code out of another file. IOW, the Author: lines give an incorrect
      record of authorship.
      
      With this all in mind, the comments are useless as a means to identify
      who to talk to about code in a particular file. Contributors will always
      be better off using 'git log' and 'git blame' if they need to  find the
      author of a particular bit of code.
      
      This commit thus deletes all Author: comments from the source and adds
      a rule to prevent them reappearing.
      
      The Copyright headers are similarly misleading and inaccurate, however,
      we cannot delete these as they have legal meaning, despite being largely
      inaccurate. In addition only the copyright holder is permitted to change
      their respective copyright statement.
      Reviewed-by: NErik Skultety <eskultet@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      60046283
  19. 16 11月, 2018 2 次提交
  20. 08 10月, 2018 1 次提交
  21. 18 9月, 2018 1 次提交
  22. 08 6月, 2018 1 次提交
  23. 06 6月, 2018 1 次提交
  24. 05 6月, 2018 1 次提交
  25. 11 5月, 2018 1 次提交
  26. 22 2月, 2018 2 次提交
  27. 19 2月, 2018 1 次提交
  28. 12 2月, 2018 1 次提交
  29. 02 2月, 2018 1 次提交
  30. 08 11月, 2017 1 次提交