Skip to content
Snippets Groups Projects
  1. May 12, 2022
  2. Apr 06, 2022
  3. Apr 05, 2022
  4. Mar 14, 2022
  5. Mar 04, 2022
  6. Feb 21, 2022
  7. Jan 18, 2022
  8. Dec 31, 2021
  9. Dec 30, 2021
  10. Oct 23, 2021
  11. Sep 30, 2021
  12. Sep 13, 2021
  13. Jun 02, 2021
  14. May 02, 2021
  15. Mar 09, 2021
  16. Feb 08, 2021
  17. Jan 12, 2021
  18. Dec 19, 2020
    • Markus Armbruster's avatar
      migration: Replace migration's JSON writer by the general one · 3ddba9a9
      Markus Armbruster authored
      
      Commit 8118f095 "migration: Append JSON description of migration
      stream" needs a JSON writer.  The existing qobject_to_json() wasn't a
      good fit, because it requires building a QObject to convert.  Instead,
      migration got its very own JSON writer, in commit 190c882c "QJSON:
      Add JSON writer".  It tacitly limits numbers to int64_t, and strings
      contents to characters that don't need escaping, unlike
      qobject_to_json().
      
      The previous commit factored the JSON writer out of qobject_to_json().
      Replace migration's JSON writer by it.
      
      Cc: Juan Quintela <quintela@redhat.com>
      Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20201211171152.146877-17-armbru@redhat.com>
      Reviewed-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      3ddba9a9
  19. Dec 18, 2020
  20. Dec 10, 2020
  21. Dec 08, 2020
  22. Oct 12, 2020
    • Philippe Mathieu-Daudé's avatar
      hw/nvram: Always register FW_CFG_DATA_GENERATOR_INTERFACE · 8d0bceba
      Philippe Mathieu-Daudé authored
      
      While the FW_CFG_DATA_GENERATOR_INTERFACE is only consumed
      by a device only available using system-mode (fw_cfg), it is
      implemented by a crypto component (tls-cipher-suites) which
      is always available when crypto is used.
      
      Commit 69699f30 introduced the following error in the
      qemu-storage-daemon binary:
      
        $ echo -e \
          '{"execute": "qmp_capabilities"}\r\n{"execute": "qom-list-types"}\r\n{"execute": "quit"}\r\n' \
          | storage-daemon/qemu-storage-daemon --chardev stdio,id=qmp0  --monitor qmp0
        {"QMP": {"version": {"qemu": {"micro": 50, "minor": 1, "major": 5}, "package": ""}, "capabilities": ["oob"]}}
        {"return": {}}
        missing interface 'fw_cfg-data-generator' for object 'tls-creds'
        Aborted (core dumped)
      
      Since QOM dependencies are resolved at runtime, this issue
      could not be triggered at linktime, and we don't have test
      running the qemu-storage-daemon binary.
      
      Fix by always registering the QOM interface.
      
      Reported-by: default avatarKevin Wolf <kwolf@redhat.com>
      Fixes: 69699f30 ("crypto/tls-cipher-suites: Produce fw_cfg consumable blob")
      Signed-off-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Reviewed-by: default avatarLaszlo Ersek <lersek@redhat.com>
      Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Message-Id: <20201006111909.2302081-2-philmd@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      8d0bceba
  23. Sep 18, 2020
  24. Sep 14, 2020
  25. Sep 09, 2020
  26. Aug 21, 2020
  27. Aug 14, 2020
    • Greg Kurz's avatar
      nvram: Exit QEMU if NVRAM cannot contain all -prom-env data · 37035df5
      Greg Kurz authored
      Since commit 61f20b9d ("spapr_nvram: Pre-initialize the NVRAM to
      support the -prom-env parameter"), pseries machines can pre-initialize
      the "system" partition in the NVRAM with the data passed to all -prom-env
      parameters on the QEMU command line.
      
      In this case it is assumed that all the data fits in 64 KiB, but the user
      can easily pass more and crash QEMU:
      
      $ qemu-system-ppc64 -M pseries $(for ((x=0;x<128;x++)); do \
        echo -n " -prom-env " ; printf "%0.sx" {1..1024}; \
        done) # this requires ~128 Kib
      malloc(): corrupted top size
      Aborted (core dumped)
      
      This happens because we don't check if all the prom-env data fits in
      the NVRAM and chrp_nvram_set_var() happily memcpy() it passed the
      buffer.
      
      This crash affects basically all ppc/ppc64 machine types that use -prom-env:
      - pseries (all versions)
      - g3beige
      - mac99
      
      and also sparc/sparc64 machine types:
      - LX
      - SPARCClassic
      - SPARCbook
      - SS-10
      - SS-20
      - SS-4
      - SS-5
      - SS-600MP
      - Voyager
      - sun4u
      - sun4v
      
      Add a max_len argument to chrp_nvram_create_system_partition() so that
      it can check the available size before writing to memory.
      
      Since NVRAM is populated at machine init, it seems reasonable to consider
      this error as fatal. So, instead of reporting an error when we detect that
      the NVRAM is too small and adapt all machine types to handle it, we simply
      exit QEMU in all cases. This is still better than crashing. If someone
      wants another behavior, I guess this can be reworked later.
      
      Tested with:
      
      $ yes q | \
        (for arch in ppc ppc64 sparc sparc64; do \
             echo == $arch ==; \
             qemu=${arch}-softmmu/qemu-system-$arch; \
             for mach in $($qemu -M help | awk '! /^Supported/ { print $1 }'); do \
                 echo $mach; \
                 $qemu -M $mach -monitor stdio -nodefaults -nographic \
                 $(for ((x=0;x<128;x++)); do \
                       echo -n " -prom-env " ; printf "%0.sx" {1..1024}; \
                   done) >/dev/null; \
              done; echo; \
         done)
      
      Without the patch, affected machine types cause QEMU to report some
      memory corruption and crash:
      
      malloc(): corrupted top size
      
      free(): invalid size
      
      *** stack smashing detected ***: terminated
      
      With the patch, QEMU prints the following message and exits:
      
      NVRAM is too small. Try to pass less data to -prom-env
      
      It seems that the conditions for the crash have always existed, but it
      affects pseries, the machine type I care for, since commit 61f20b9d
      only.
      
      Fixes: 61f20b9d ("spapr_nvram: Pre-initialize the NVRAM to support the -prom-env parameter")
      RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1867739
      
      
      Reported-by: default avatarJohn Snow <jsnow@redhat.com>
      Reviewed-by: default avatarLaurent Vivier <laurent@vivier.eu>
      Signed-off-by: default avatarGreg Kurz <groug@kaod.org>
      Message-Id: <159736033937.350502.12402444542194031035.stgit@bahia.lan>
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      37035df5
  28. Jul 21, 2020
    • Philippe Mathieu-Daudé's avatar
      hw/nvram/fw_cfg: Let fw_cfg_add_from_generator() return boolean value · 07719518
      Philippe Mathieu-Daudé authored
      
      Commits b6d7e9b6..a43770df simplified the error propagation.
      Similarly to commit 6fd5bef1 "qom: Make functions taking Error**
      return bool, not void", let fw_cfg_add_from_generator() return a
      boolean value, not void.
      This allow to simplify parse_fw_cfg() and fixes the error handling
      issue reported by Coverity (CID 1430396):
      
        In parse_fw_cfg():
      
          Variable assigned once to a constant guards dead code.
      
          Local variable local_err is assigned only once, to a constant
          value, making it effectively constant throughout its scope.
          If this is not the intent, examine the logic to see if there
          is a missing assignment that would make local_err not remain
          constant.
      
      It's the call of fw_cfg_add_from_generator():
      
              Error *local_err = NULL;
      
              fw_cfg_add_from_generator(fw_cfg, name, gen_id, errp);
              if (local_err) {
                  error_propagate(errp, local_err);
                  return -1;
              }
              return 0;
      
      If it fails, parse_fw_cfg() sets an error and returns 0, which is
      wrong. Harmless, because the only caller passes &error_fatal.
      
      Reported-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Fixes: Coverity CID 1430396: 'Constant' variable guards dead code (DEADCODE)
      Fixes: 6552d87c ("softmmu/vl: Let -fw_cfg option take a 'gen_id' argument")
      Reviewed-by: default avatarLaszlo Ersek <lersek@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Message-Id: <20200721131911.27380-3-philmd@redhat.com>
      07719518
Loading