Skip to content
Snippets Groups Projects
  1. Sep 13, 2022
  2. Sep 09, 2022
  3. Aug 26, 2022
  4. Aug 25, 2022
  5. Aug 18, 2022
    • Priyankar Jain's avatar
      dbus-vmstate: Restrict error checks to registered proxies in dbus_get_proxies · 27485832
      Priyankar Jain authored
      
      The purpose of dbus_get_proxies to construct the proxies corresponding to the
      IDs registered to dbus-vmstate.
      
      Currenty, this function returns an error in case there is any failure
      while instantiating proxy for "all" the names on dbus.
      
      Ideally this function should error out only if it is not able to find and
      validate the proxies registered to the backend otherwise any offending
      process(for eg: the process purposefully may not export its Id property on
      the dbus) may connect to the dbus and can lead to migration failures.
      
      This commit ensures that dbus_get_proxies returns an error if it is not
      able to find and validate the proxies of interest(the IDs registered
      during the dbus-vmstate instantiation).
      
      Signed-off-by: default avatarPriyankar Jain <priyankar.jain@nutanix.com>
      Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1637936117-37977-1-git-send-email-priyankar.jain@nutanix.com>
      27485832
  6. Jun 16, 2022
    • Zhenwei Pi's avatar
      crypto: Introduce RSA algorithm · 0e660a6f
      Zhenwei Pi authored
      
      There are two parts in this patch:
      1, support akcipher service by cryptodev-builtin driver
      2, virtio-crypto driver supports akcipher service
      
      In principle, we should separate this into two patches, to avoid
      compiling error, merge them into one.
      
      Then virtio-crypto gets request from guest side, and forwards the
      request to builtin driver to handle it.
      
      Test with a guest linux:
      1, The self-test framework of crypto layer works fine in guest kernel
      2, Test with Linux guest(with asym support), the following script
      test(note that pkey_XXX is supported only in a newer version of keyutils):
        - both public key & private key
        - create/close session
        - encrypt/decrypt/sign/verify basic driver operation
        - also test with kernel crypto layer(pkey add/query)
      
      All the cases work fine.
      
      Run script in guest:
      rm -rf *.der *.pem *.pfx
      modprobe pkcs8_key_parser # if CONFIG_PKCS8_PRIVATE_KEY_PARSER=m
      rm -rf /tmp/data
      dd if=/dev/random of=/tmp/data count=1 bs=20
      
      openssl req -nodes -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -subj "/C=CN/ST=BJ/L=HD/O=qemu/OU=dev/CN=qemu/emailAddress=qemu@qemu.org"
      openssl pkcs8 -in key.pem -topk8 -nocrypt -outform DER -out key.der
      openssl x509 -in cert.pem -inform PEM -outform DER -out cert.der
      
      PRIV_KEY_ID=`cat key.der | keyctl padd asymmetric test_priv_key @s`
      echo "priv key id = "$PRIV_KEY_ID
      PUB_KEY_ID=`cat cert.der | keyctl padd asymmetric test_pub_key @s`
      echo "pub key id = "$PUB_KEY_ID
      
      keyctl pkey_query $PRIV_KEY_ID 0
      keyctl pkey_query $PUB_KEY_ID 0
      
      echo "Enc with priv key..."
      keyctl pkey_encrypt $PRIV_KEY_ID 0 /tmp/data enc=pkcs1 >/tmp/enc.priv
      echo "Dec with pub key..."
      keyctl pkey_decrypt $PRIV_KEY_ID 0 /tmp/enc.priv enc=pkcs1 >/tmp/dec
      cmp /tmp/data /tmp/dec
      
      echo "Sign with priv key..."
      keyctl pkey_sign $PRIV_KEY_ID 0 /tmp/data enc=pkcs1 hash=sha1 > /tmp/sig
      echo "Verify with pub key..."
      keyctl pkey_verify $PRIV_KEY_ID 0 /tmp/data /tmp/sig enc=pkcs1 hash=sha1
      
      echo "Enc with pub key..."
      keyctl pkey_encrypt $PUB_KEY_ID 0 /tmp/data enc=pkcs1 >/tmp/enc.pub
      echo "Dec with priv key..."
      keyctl pkey_decrypt $PRIV_KEY_ID 0 /tmp/enc.pub enc=pkcs1 >/tmp/dec
      cmp /tmp/data /tmp/dec
      
      echo "Verify with pub key..."
      keyctl pkey_verify $PUB_KEY_ID 0 /tmp/data /tmp/sig enc=pkcs1 hash=sha1
      
      Reviewed-by: default avatarGonglei <arei.gonglei@huawei.com>
      Signed-off-by: default avatarlei he <helei.sig11@bytedance.com>
      Signed-off-by: default avatarzhenwei pi <pizhenwei@bytedance.com>
      Message-Id: <20220611064243.24535-2-pizhenwei@bytedance.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      0e660a6f
  7. May 23, 2022
    • Jaroslav Jindrak's avatar
      hostmem: default the amount of prealloc-threads to smp-cpus · f8d426a6
      Jaroslav Jindrak authored
      
      Prior to the introduction of the prealloc-threads property, the amount
      of threads used to preallocate memory was derived from the value of
      smp-cpus passed to qemu, the amount of physical cpus of the host
      and a hardcoded maximum value. When the prealloc-threads property
      was introduced, it included a default of 1 in backends/hostmem.c and
      a default of smp-cpus using the sugar API for the property itself. The
      latter default is not used when the property is not specified on qemu's
      command line, so guests that were not adjusted for this change suddenly
      started to use the default of 1 thread to preallocate memory, which
      resulted in observable slowdowns in guest boots for guests with large
      memory (e.g. when using libvirt <8.2.0 or managing guests manually).
      
      This commit restores the original behavior for these cases while not
      impacting guests started with the prealloc-threads property in any way.
      
      Fixes: 220c1fd864e9d ("hostmem: introduce "prealloc-threads" property")
      Signed-off-by: default avatarJaroslav Jindrak <dzejrou@gmail.com>
      Message-Id: <20220517123858.7933-1-dzejrou@gmail.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      f8d426a6
  8. May 14, 2022
  9. May 07, 2022
  10. Apr 28, 2022
  11. Apr 06, 2022
  12. Mar 21, 2022
  13. Feb 21, 2022
  14. Dec 21, 2021
  15. Sep 30, 2021
    • Sean Christopherson's avatar
      hostmem: Add hostmem-epc as a backend for SGX EPC · c6c02320
      Sean Christopherson authored
      
      EPC (Enclave Page Cahe) is a specialized type of memory used by Intel
      SGX (Software Guard Extensions).  The SDM desribes EPC as:
      
          The Enclave Page Cache (EPC) is the secure storage used to store
          enclave pages when they are a part of an executing enclave. For an
          EPC page, hardware performs additional access control checks to
          restrict access to the page. After the current page access checks
          and translations are performed, the hardware checks that the EPC
          page is accessible to the program currently executing. Generally an
          EPC page is only accessed by the owner of the executing enclave or
          an instruction which is setting up an EPC page.
      
      Because of its unique requirements, Linux manages EPC separately from
      normal memory.  Similar to memfd, the device /dev/sgx_vepc can be
      opened to obtain a file descriptor which can in turn be used to mmap()
      EPC memory.
      
      Signed-off-by: default avatarSean Christopherson <sean.j.christopherson@intel.com>
      Signed-off-by: default avatarYang Zhong <yang.zhong@intel.com>
      Message-Id: <20210719112136.57018-3-yang.zhong@intel.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      c6c02320
  16. Sep 27, 2021
    • Markus Armbruster's avatar
      qapi: Convert simple union TpmTypeOptions to flat one · 39dc3e4a
      Markus Armbruster authored
      
      Simple unions predate flat unions.  Having both complicates the QAPI
      schema language and the QAPI generator.  We haven't been using simple
      unions in new code for a long time, because they are less flexible and
      somewhat awkward on the wire.
      
      To prepare for their removal, convert simple union TpmTypeOptions to
      an equivalent flat one, with existing enum TpmType replacing implicit
      enum TpmTypeOptionsKind.  Adds some boilerplate to the schema, which
      is a bit ugly, but a lot easier to maintain than the simple union
      feature.
      
      Cc: Stefan Berger <stefanb@linux.vnet.ibm.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Acked-by: default avatarStefan Berger <stefanb@linux.ibm.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <20210917143134.412106-6-armbru@redhat.com>
      [Indentation tidied up]
      39dc3e4a
  17. Aug 26, 2021
  18. Jun 30, 2021
  19. Jun 15, 2021
  20. Jun 02, 2021
  21. May 13, 2021
  22. May 02, 2021
  23. Apr 01, 2021
    • Priyankar Jain's avatar
      dbus-vmstate: Increase the size of input stream buffer used during load · 1d9fa7a8
      Priyankar Jain authored
      
      This commit fixes an issue where migration is failing in the load phase
      because of a false alarm about data unavailability.
      
      Following is the error received when the amount of data to be transferred
      exceeds the default buffer size setup by G_BUFFERED_INPUT_STREAM(4KiB),
      even when the maximum data size supported by this backend is 1MiB
      (DBUS_VMSTATE_SIZE_LIMIT):
      
        dbus_vmstate_post_load: Invalid vmstate size: 4364
        qemu-kvm: error while loading state for instance 0x0 of device 'dbus-vmstate/dbus-vmstate'
      
      This commit sets the size of the input stream buffer used during load to
      DBUS_VMSTATE_SIZE_LIMIT which is the maximum amount of data a helper can
      send during save phase.
      Secondly, this commit makes sure that the input stream buffer is loaded before
      checking the size of the data available in it, rectifying the false alarm about
      data unavailability.
      
      Fixes: 5010cec2 ("Add dbus-vmstate object")
      Signed-off-by: default avatarPriyankar Jain <priyankar.jain@nutanix.com>
      Message-Id: <cdaad4718e62bf22fd5e93ef3e252de20da5c17c.1612273156.git.priyankar.jain@nutanix.com>
      [ Modified printf format for gsize ]
      Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      1d9fa7a8
  24. Mar 09, 2021
  25. Feb 18, 2021
  26. Feb 09, 2021
  27. Feb 08, 2021
    • Pavel Dovgalyuk's avatar
      replay: rng-builtin support · 54550d88
      Pavel Dovgalyuk authored
      
      This patch enables using rng-builtin with record/replay
      by making the callbacks deterministic.
      
      Signed-off-by: default avatarPavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
      Message-Id: <161233201286.170686.7858208964037376305.stgit@pasha-ThinkPad-X280>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      54550d88
    • Igor Mammedov's avatar
      machine: add missing doc for memory-backend option · 8db0b204
      Igor Mammedov authored
      
      Add documentation for '-machine memory-backend' CLI option and
      how to use it.
      
      And document that x-use-canonical-path-for-ramblock-id,
      is considered to be stable to make sure it won't go away by accident.
      
      x- was intended for unstable/iternal properties, and not supposed to
      be stable option. However it's too late to rename (drop x-)
      it as it would mean that users will have to mantain both
      x-use-canonical-path-for-ramblock-id (for QEMU 5.0-5.2) versions
      and prefix-less for later versions.
      
      Signed-off-by: default avatarIgor Mammedov <imammedo@redhat.com>
      Message-Id: <20210121161504.1007247-1-imammedo@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      8db0b204
    • David Gibson's avatar
      confidential guest support: Introduce new confidential guest support class · f91f9f25
      David Gibson authored
      
      Several architectures have mechanisms which are designed to protect
      guest memory from interference or eavesdropping by a compromised
      hypervisor.  AMD SEV does this with in-chip memory encryption and
      Intel's TDX can do similar things.  POWER's Protected Execution
      Framework (PEF) accomplishes a similar goal using an ultravisor and
      new memory protection features, instead of encryption.
      
      To (partially) unify handling for these, this introduces a new
      ConfidentialGuestSupport QOM base class.  "Confidential" is kind of vague,
      but "confidential computing" seems to be the buzzword about these schemes,
      and "secure" or "protected" are often used in connection to unrelated
      things (such as hypervisor-from-guest or guest-from-guest security).
      
      The "support" in the name is significant because in at least some of the
      cases it requires the guest to take specific actions in order to protect
      itself from hypervisor eavesdropping.
      
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      f91f9f25
  28. Feb 01, 2021
  29. Jan 28, 2021
  30. Dec 18, 2020
    • Keqian Zhu's avatar
      bugfix: hostmem: Free host_nodes list right after visited · bdd5ce05
      Keqian Zhu authored
      
      In host_memory_backend_get_host_nodes, we build host_nodes
      list and output it to v (a StringOutputVisitor) but forget
      to free the list. This fixes the memory leak.
      
      The memory leak stack:
      
       Direct leak of 32 byte(s) in 2 object(s) allocated from:
          #0 0xfffda30b3393 in __interceptor_calloc (/usr/lib64/libasan.so.4+0xd3393)
          #1 0xfffda1d28b9b in g_malloc0 (/usr/lib64/libglib-2.0.so.0+0x58b9b)
          #2 0xaaab05ca6e43 in host_memory_backend_get_host_nodes backends/hostmem.c:94
          #3 0xaaab061ddf83 in object_property_get_uint16List qom/object.c:1478
          #4 0xaaab05866513 in query_memdev hw/core/machine-qmp-cmds.c:312
          #5 0xaaab061d980b in do_object_child_foreach qom/object.c:1001
          #6 0xaaab0586779b in qmp_query_memdev hw/core/machine-qmp-cmds.c:328
          #7 0xaaab0615ed3f in qmp_marshal_query_memdev qapi/qapi-commands-machine.c:327
          #8 0xaaab0632d647 in do_qmp_dispatch qapi/qmp-dispatch.c:147
          #9 0xaaab0632d647 in qmp_dispatch qapi/qmp-dispatch.c:190
          #10 0xaaab0610f74b in monitor_qmp_dispatch monitor/qmp.c:120
          #11 0xaaab0611074b in monitor_qmp_bh_dispatcher monitor/qmp.c:209
          #12 0xaaab063caefb in aio_bh_poll util/async.c:117
          #13 0xaaab063d30fb in aio_dispatch util/aio-posix.c:459
          #14 0xaaab063cac8f in aio_ctx_dispatch util/async.c:268
          #15 0xfffda1d22a6b in g_main_context_dispatch (/usr/lib64/libglib-2.0.so.0+0x52a6b)
          #16 0xaaab063d0e97 in glib_pollfds_poll util/main-loop.c:218
          #17 0xaaab063d0e97 in os_host_main_loop_wait util/main-loop.c:241
          #18 0xaaab063d0e97 in main_loop_wait util/main-loop.c:517
          #19 0xaaab05c8bfa7 in main_loop /root/rpmbuild/BUILD/qemu-4.1.0/vl.c:1791
          #20 0xaaab05713bc3 in main /root/rpmbuild/BUILD/qemu-4.1.0/vl.c:4473
          #21 0xfffda0a83ebf in __libc_start_main (/usr/lib64/libc.so.6+0x23ebf)
          #22 0xaaab0571ed5f  (aarch64-softmmu/qemu-system-aarch64+0x88ed5f)
       SUMMARY: AddressSanitizer: 32 byte(s) leaked in 2 allocation(s).
      
      Fixes: 4cf1b76b (hostmem: add properties for NUMA memory policy)
      Reported-by: default avatarEuler Robot <euler.robot@huawei.com>
      Signed-off-by: default avatarKeqian Zhu <zhukeqian1@huawei.com>
      Tested-by: default avatarChen Qun <kuhn.chenqun@huawei.com>
      Reviewed-by: default avatarIgor Mammedov <imammedo@redhat.com>
      Message-Id: <20201210075226.20196-1-zhukeqian1@huawei.com>
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      bdd5ce05
    • Eduardo Habkost's avatar
      qdev: Rename qdev_get_prop_ptr() to object_field_prop_ptr() · 1e198715
      Eduardo Habkost authored
      
      The function will be moved to common QOM code, as it is not
      specific to TYPE_DEVICE anymore.
      
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      Reviewed-by: default avatarStefan Berger <stefanb@linux.ibm.com>
      Reviewed-by: default avatarCornelia Huck <cohuck@redhat.com>
      Reviewed-by: default avatarIgor Mammedov <imammedo@redhat.com>
      Acked-by: default avatarPaul Durrant <paul@xen.org>
      Message-Id: <20201211220529.2290218-31-ehabkost@redhat.com>
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      1e198715
Loading