1. 24 12月, 2019 1 次提交
    • N
      qemu: hide details of fake reboot · 6c6d93bc
      Nikolay Shirokovskiy 提交于
      If we use fake reboot then domain goes thru running->shutdown->running
      state changes with shutdown state only for short period of time.  At
      least this is implementation details leaking into API. And also there is
      one real case when this is not convinient. I'm doing a backup with the
      help of temporary block snapshot (with the help of qemu's API which is
      used in the newly created libvirt's backup API). If guest is shutdowned
      I want to continue to backup so I don't kill the process and domain is
      in shutdown state. Later when backup is finished I want to destroy qemu
      process. So I check if it is in shutdowned state and destroy it if it
      is. Now if instead of shutdown domain got fake reboot then I can destroy
      process in the middle of fake reboot process.
      
      After shutdown event we also get stop event and now as domain state is
      running it will be transitioned to paused state and back to running
      later. Though this is not critical for the described case I guess it is
      better not to leak these details to user too. So let's leave domain in
      running state on stop event if fake reboot is in process.
      
      Reconnection code handles this patch without modification. It detects
      that qemu is not running due to shutdown and then calls qemuProcessShutdownOrReboot
      which reboots as fake reboot flag is set.
      Signed-off-by: NNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
      Reviewed-by: NCole Robinson <crobinso@redhat.com>
      6c6d93bc
  2. 21 12月, 2019 4 次提交
  3. 17 12月, 2019 1 次提交
  4. 12 12月, 2019 2 次提交
    • D
      Revert "qemu: directly create virResctrlInfo ignoring capabilities" · 766c8ae9
      Daniel P. Berrangé 提交于
      This reverts commit 7be5fe66.
      
      This commit broke resctrl, because it missed the fact that the
      virResctrlInfoGetCache() has side-effects causing it to actually
      change the virResctrlInfo parameter, not merely get data from
      it.
      
      This code will need some refactoring before we can try separating
      it from virCapabilities again.
      Reviewed-by: NCole Robinson <crobinso@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      766c8ae9
    • 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
  5. 10 12月, 2019 1 次提交
  6. 09 12月, 2019 10 次提交
  7. 05 12月, 2019 1 次提交
  8. 03 12月, 2019 7 次提交
  9. 27 11月, 2019 1 次提交
  10. 26 11月, 2019 1 次提交
  11. 22 11月, 2019 2 次提交
    • M
      qemuProcessStop: Remove image metadata for running mirror jobs · 8fa0374c
      Michal Privoznik 提交于
      If user starts a blockcommit or a blockcopy then we modify access
      for qemu on both images and leave it like that until the job
      terminates.  So far so good. Problem is, if user instead of
      terminating the job (where we would modify the access again so
      that the state before the job is restored) calls destroy on the
      domain or if qemu dies whilst executing the block job.  In this
      case we don't ever clear the access we granted at the beginning.
      To fix this, maybe a bit harsh approach is used, but it works:
      after all labels were restored (that is after
      qemuSecurityRestoreAllLabel() was called), we iterate over each
      disk in the domain and remove XATTRs from the whole backing chain
      and also from any file the disk is being mirrored to.
      
      This would have been done at the time of pivot, but it isn't
      because user decided to kill the domain instead. If we don't do
      this and leave some XATTRs behind the domain might be unable to
      start.
      
      Also, secdriver can't do this because it doesn't know if there is
      any job running. It's outside of its scope - the hypervisor
      driver is responsible for calling secdriver's APIs.
      
      Moreover, this is safe to call because we don't remember labels
      for any member of a backing chain except of the top layer. But
      that one was restored in qemuSecurityRestoreAllLabel() call done
      earlier. Therefore, not only we don't remember labels (and thus
      this is basically a NOP for other images in the backing chain) it
      is also safe to call this when no blockjob was started in the
      first place, or if some parts of the backing chain are shared
      with some other domains - this is NOP, unless a block job is
      active at the time of domain destroy.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1741456#c19Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NPeter Krempa <pkrempa@redhat.com>
      8fa0374c
    • P
      qemu: Instantiate pflash via -machine when using blockdev · 86085c9a
      Peter Krempa 提交于
      Install the convertor function which enables the internals that will use
      -blockdev to make qemu open the firmware image and stop using -drive.
      Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
      Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
      86085c9a
  12. 21 11月, 2019 4 次提交
  13. 19 11月, 2019 2 次提交
  14. 18 11月, 2019 1 次提交
  15. 15 11月, 2019 2 次提交