- May 12, 2022
-
-
Paolo Bonzini authored
As part of converting -boot to a property with a QAPI type, define the struct and use it throughout QEMU to access boot configuration. machine_boot_parse takes care of doing the QemuOpts->QAPI conversion by hand, for now. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20220414165300.555321-2-pbonzini@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Apr 06, 2022
-
-
Marc-André Lureau authored
Signed-off-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220323155743.1585078-33-marcandre.lureau@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Marc-André Lureau authored
Replace the global variables with inlined helper functions. getpagesize() is very likely annotated with a "const" function attribute (at least with glibc), and thus optimization should apply even better. This avoids the need for a constructor initialization too. Signed-off-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220323155743.1585078-12-marcandre.lureau@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Apr 05, 2022
-
-
Tong Ho authored
This adds required initialization of Error * variable. Signed-off-by:
Tong Ho <tong.ho@xilinx.com> Reviewed-by:
Francisco Iglesias <frasse.iglesias@gmail.com> Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-
- Mar 14, 2022
-
-
Patrick Venture authored
The at24 eeproms are 2 byte devices that return 0xff when they are read from with a partial (1-byte) address written. This distinction was found comparing model behavior to real hardware testing. Tested: `i2ctransfer -f -y 45 w1@85 0 r1` returns 0xff instead of next byte Signed-off-by:
Patrick Venture <venture@google.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20211220212137.1244511-1-venture@google.com> Signed-off-by:
Philippe Mathieu-Daudé <f4bug@amsat.org>
-
- Mar 04, 2022
-
-
Emanuele Giuseppe Esposito authored
Following the bdrv_activate renaming, change also the name of the respective callers. bdrv_invalidate_cache_all -> bdrv_activate_all blk_invalidate_cache -> blk_activate test_sync_op_invalidate_cache -> test_sync_op_activate No functional change intended. Signed-off-by:
Emanuele Giuseppe Esposito <eesposit@redhat.com> Reviewed-by:
Juan Quintela <quintela@redhat.com> Reviewed-by:
Hanna Reitz <hreitz@redhat.com> Message-Id: <20220209105452.1694545-5-eesposit@redhat.com> Signed-off-by:
Kevin Wolf <kwolf@redhat.com>
-
- Feb 21, 2022
-
-
Patrick Venture authored
Use the macro for going from I2CSlave to EEPROMState. Signed-off-by:
Patrick Venture <venture@google.com> Reviewed-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20220119214329.2557049-1-venture@google.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
- Jan 18, 2022
-
-
Philippe Mathieu-Daudé authored
fw_cfg QOM interface is required by system emulation and qemu-storage-daemon. User-mode emulation doesn't need it. Signed-off-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by:
David Hildenbrand <david@redhat.com> Message-Id: <20220111184309.28637-3-f4bug@amsat.org>
-
- Dec 31, 2021
-
-
Philippe Mathieu-Daudé authored
Let devices specify transaction attributes when calling st*_dma(). Keep the default MEMTXATTRS_UNSPECIFIED in the few callers. Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Cédric Le Goater <clg@kaod.org> Signed-off-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20211223115554.3155328-16-philmd@redhat.com>
-
- Dec 30, 2021
-
-
Philippe Mathieu-Daudé authored
Let devices specify transaction attributes when calling dma_memory_read() or dma_memory_write(). Patch created mechanically using spatch with this script: @@ expression E1, E2, E3, E4; @@ ( - dma_memory_read(E1, E2, E3, E4) + dma_memory_read(E1, E2, E3, E4, MEMTXATTRS_UNSPECIFIED) | - dma_memory_write(E1, E2, E3, E4) + dma_memory_write(E1, E2, E3, E4, MEMTXATTRS_UNSPECIFIED) ) Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Li Qiang <liq3ea@gmail.com> Reviewed-by:
Edgar E. Iglesias <edgar.iglesias@xilinx.com> Signed-off-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Acked-by:
Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20211223115554.3155328-6-philmd@redhat.com>
-
Philippe Mathieu-Daudé authored
Let devices specify transaction attributes when calling dma_memory_set(). Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Li Qiang <liq3ea@gmail.com> Reviewed-by:
Edgar E. Iglesias <edgar.iglesias@xilinx.com> Signed-off-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Acked-by:
Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20211223115554.3155328-3-philmd@redhat.com>
-
- Oct 23, 2021
-
-
Tong Ho authored
Signed-off-by:
Tong Ho <tong.ho@xilinx.com> Reviewed-by:
Edgar E. Iglesias <edgar.iglesias@xilinx.com> Reviewed-by:
Francisco Iglesias <frasse.iglesias@gmail.com> Reviewed-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20211015203532.2463705-4-tong.ho@xilinx.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Tong Ho authored
Signed-off-by:
Tong Ho <tong.ho@xilinx.com> Reviewed-by:
Edgar E. Iglesias <edgar.iglesias@xilinx.com> Reviewed-by:
Francisco Iglesias <frasse.iglesias@gmail.com> Reviewed-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20211015203532.2463705-3-tong.ho@xilinx.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Tong Ho authored
Signed-off-by:
Tong Ho <tong.ho@xilinx.com> Reviewed-by:
Edgar E. Iglesias <edgar.iglesias@xilinx.com> Reviewed-by:
Francisco Iglesias <frasse.iglesias@gmail.com> Reviewed-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20211015203532.2463705-2-tong.ho@xilinx.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
- Sep 30, 2021
-
-
Tong Ho authored
This device is present in Versal and ZynqMP product families to store a 256-bit encryption key. Co-authored-by:
Edgar E. Iglesias <edgar.iglesias@xilinx.com> Co-authored-by:
Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> Signed-off-by:
Edgar E. Iglesias <edgar.iglesias@xilinx.com> Signed-off-by:
Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> Signed-off-by:
Tong Ho <tong.ho@xilinx.com> Message-id: 20210917052400.1249094-5-tong.ho@xilinx.com Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-
Tong Ho authored
This implements the Xilinx ZynqMP eFuse, an one-time field-programmable non-volatile storage device. There is only one such device in the Xilinx ZynqMP product family. Co-authored-by:
Edgar E. Iglesias <edgar.iglesias@xilinx.com> Co-authored-by:
Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> Signed-off-by:
Edgar E. Iglesias <edgar.iglesias@xilinx.com> Signed-off-by:
Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> Signed-off-by:
Tong Ho <tong.ho@xilinx.com> Message-id: 20210917052400.1249094-4-tong.ho@xilinx.com Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-
Tong Ho authored
This implements the Xilinx Versal eFuse, an one-time field-programmable non-volatile storage device. There is only one such device in the Xilinx Versal product family. This device has two separate mmio interfaces, a controller and a flatten readback. The controller provides interfaces for field-programming, configuration, control, and status. The flatten readback is a cache to provide a byte-accessible read-only interface to efficiently read efuse array. Co-authored-by:
Edgar E. Iglesias <edgar.iglesias@xilinx.com> Co-authored-by:
Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> Signed-off-by:
Edgar E. Iglesias <edgar.iglesias@xilinx.com> Signed-off-by:
Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> Signed-off-by:
Tong Ho <tong.ho@xilinx.com> Message-id: 20210917052400.1249094-3-tong.ho@xilinx.com Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-
Tong Ho authored
This introduces the QOM for Xilinx eFuse, an one-time field-programmable storage bit array. The actual mmio interface to the array varies by device families and will be provided in different change-sets. Co-authored-by:
Edgar E. Iglesias <edgar.iglesias@xilinx.com> Co-authored-by:
Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> Signed-off-by:
Edgar E. Iglesias <edgar.iglesias@xilinx.com> Signed-off-by:
Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> Signed-off-by:
Tong Ho <tong.ho@xilinx.com> Message-id: 20210917052400.1249094-2-tong.ho@xilinx.com Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-
- Sep 13, 2021
-
-
Paolo Bonzini authored
The file already existed, but nobody had noticed the warning until now. Add it at the bottom, since that is where unknown files go in legacy mode. Fixes: 217f1b4a ("target-i386: Publish advised value of MSR_IA32_FEATURE_CONTROL via fw_cfg") Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Jun 02, 2021
-
-
Stefano Garzarella authored
Commit e50caf4a ("tracing: convert documentation to rST") converted docs/devel/tracing.txt to docs/devel/tracing.rst. We still have several references to the old file, so let's fix them with the following command: sed -i s/tracing.txt/tracing.rst/ $(git grep -l docs/devel/tracing.txt) Signed-off-by:
Stefano Garzarella <sgarzare@redhat.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210517151702.109066-2-sgarzare@redhat.com> Signed-off-by:
Thomas Huth <thuth@redhat.com>
-
- May 02, 2021
-
-
Thomas Huth authored
Stop including exec/address-spaces.h in files that don't need it. Signed-off-by:
Thomas Huth <thuth@redhat.com> Message-Id: <20210416171314.2074665-5-thuth@redhat.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Thomas Huth authored
Stop including cpu.h in files that don't need it. Signed-off-by:
Thomas Huth <thuth@redhat.com> Message-Id: <20210416171314.2074665-4-thuth@redhat.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Thomas Huth authored
Many files include hw/sysbus.h without needing it. Remove the superfluous include statements. Signed-off-by:
Thomas Huth <thuth@redhat.com> Reviewed-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20210327082804.2259480-1-thuth@redhat.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
- Mar 09, 2021
-
-
Philippe Mathieu-Daudé authored
The 'running' argument from VMChangeStateHandler does not require other value than 0 / 1. Make it a plain boolean. Signed-off-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by:
Alex Bennée <alex.bennee@linaro.org> Acked-by:
David Gibson <david@gibson.dropbear.id.au> Message-Id: <20210111152020.1422021-3-philmd@redhat.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
- Feb 08, 2021
-
-
Prasad J Pandit authored
Add nrf51_soc mmio read method to avoid NULL pointer dereference issue. Reported-by:
Lei Sun <slei.casper@gmail.com> Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> Signed-off-by:
Prasad J Pandit <pjp@fedoraproject.org> Reviewed-by:
Li Qiang <liq3ea@gmail.com> Message-Id: <20200811114133.672647-6-ppandit@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Jan 12, 2021
-
-
Hao Wu authored
A device shouldn't access its parent object which is QOM internal. Instead it should use type cast for this purporse. This patch fixes this issue for all NPCM7XX Devices. Signed-off-by:
Hao Wu <wuhaotsh@google.com> Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> Message-id: 20210108190945.949196-7-wuhaotsh@google.com Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-
- Dec 19, 2020
-
-
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:
Markus Armbruster <armbru@redhat.com> Message-Id: <20201211171152.146877-17-armbru@redhat.com> Reviewed-by:
Dr. David Alan Gilbert <dgilbert@redhat.com>
-
- Dec 18, 2020
-
-
Eduardo Habkost authored
Move the property types and property macros implemented in qdev-properties-system.c to a new qdev-properties-system.h header. Signed-off-by:
Eduardo Habkost <ehabkost@redhat.com> Reviewed-by:
Igor Mammedov <imammedo@redhat.com> Message-Id: <20201211220529.2290218-16-ehabkost@redhat.com> Signed-off-by:
Eduardo Habkost <ehabkost@redhat.com>
-
- Dec 10, 2020
-
-
Paolo Bonzini authored
Reviewed-by:
Igor Mammedov <imammedo@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Dec 08, 2020
-
-
Jiahui Cen authored
Extract extra pci roots addition from pc machine, which could be used by other machines. In order to make uefi get the extra roots, it is necessary to write extra roots into fw_cfg. And only if the uefi knows there are extra roots, the config spaces of devices behind the root could be obtained. Signed-off-by:
Jiahui Cen <cenjiahui@huawei.com> Signed-off-by:
Yubo Miao <miaoyubo@huawei.com> Message-Id: <20201119014841.7298-3-cenjiahui@huawei.com> Reviewed-by:
Michael S. Tsirkin <mst@redhat.com> Signed-off-by:
Michael S. Tsirkin <mst@redhat.com>
-
- Oct 12, 2020
-
-
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:
Kevin Wolf <kwolf@redhat.com> Fixes: 69699f30 ("crypto/tls-cipher-suites: Produce fw_cfg consumable blob") Signed-off-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by:
Laszlo Ersek <lersek@redhat.com> Reviewed-by:
Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20201006111909.2302081-2-philmd@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Sep 18, 2020
-
-
Eduardo Habkost authored
This converts existing DECLARE_INSTANCE_CHECKER usage to OBJECT_DECLARE_SIMPLE_TYPE when possible. $ ./scripts/codeconverter/converter.py -i \ --pattern=AddObjectDeclareSimpleType $(git grep -l '' -- '*.[ch]') Signed-off-by:
Eduardo Habkost <ehabkost@redhat.com> Acked-by:
Paul Durrant <paul@xen.org> Message-Id: <20200916182519.415636-6-ehabkost@redhat.com> Signed-off-by:
Eduardo Habkost <ehabkost@redhat.com>
-
Laszlo Ersek authored
The documentation on g_byte_array_free() <https://developer.gnome.org/glib/stable/glib-Byte-Arrays.html#g-byte-array-free > says: > Returns > > the element data if free_segment is FALSE, otherwise NULL. The element > data should be freed using g_free(). Because we currently call g_byte_array_free() with free_segment=TRUE, we end up passing data=NULL to fw_cfg_add_file(). On the plus side, fw_cfg_data_read() and fw_cfg_dma_transfer() both deal with NULL data gracefully: QEMU does not crash when the guest reads such an item, the guest just gets a properly sized, but zero-filled blob. However, the bug breaks UEFI HTTPS boot, as the IANA_TLS_CIPHER array, generated otherwise correctly by the "tls-cipher-suites" object, is in effect replaced with a zero blob. Fix the issue by passing free_segment=FALSE to g_byte_array_free(): - the caller (fw_cfg_add_from_generator()) temporarily assumes ownership of the generated byte array, - then ownership of the byte array is transfered to fw_cfg, as fw_cfg_add_file() links (not copies) "data" into fw_cfg. Cc: "Daniel P. Berrangé" <berrange@redhat.com> Cc: "Philippe Mathieu-Daudé" <philmd@redhat.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Fixes: 32031489 Signed-off-by:
Laszlo Ersek <lersek@redhat.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by:
Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20200916151510.22767-1-lersek@redhat.com> Signed-off-by:
Philippe Mathieu-Daudé <philmd@redhat.com>
-
- Sep 14, 2020
-
-
Havard Skinnemoen authored
This supports reading and writing OTP fuses and keys. Only fuse reading has been tested. Protection is not implemented. Reviewed-by:
Avi Fishman <avi.fishman@nuvoton.com> Reviewed-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> Tested-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> Tested-by:
Alexander Bulekov <alxndr@bu.edu> Signed-off-by:
Havard Skinnemoen <hskinnemoen@google.com> Message-id: 20200911052101.2602693-9-hskinnemoen@google.com Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-
- Sep 09, 2020
-
-
Eduardo Habkost authored
Generated using: $ ./scripts/codeconverter/converter.py -i \ --pattern=TypeCheckMacro $(git grep -l '' -- '*.[ch]') Reviewed-by:
Daniel P. Berrangé <berrange@redhat.com> Reviewed-by:
Juan Quintela <quintela@redhat.com> Message-Id: <20200831210740.126168-12-ehabkost@redhat.com> Reviewed-by:
Juan Quintela <quintela@redhat.com> Message-Id: <20200831210740.126168-13-ehabkost@redhat.com> Message-Id: <20200831210740.126168-14-ehabkost@redhat.com> Signed-off-by:
Eduardo Habkost <ehabkost@redhat.com>
-
Eduardo Habkost authored
Some typedefs and macros are defined after the type check macros. This makes it difficult to automatically replace their definitions with OBJECT_DECLARE_TYPE. Patch generated using: $ ./scripts/codeconverter/converter.py -i \ --pattern=QOMStructTypedefSplit $(git grep -l '' -- '*.[ch]') which will split "typdef struct { ... } TypedefName" declarations. Followed by: $ ./scripts/codeconverter/converter.py -i --pattern=MoveSymbols \ $(git grep -l '' -- '*.[ch]') which will: - move the typedefs and #defines above the type check macros - add missing #include "qom/object.h" lines if necessary Reviewed-by:
Daniel P. Berrangé <berrange@redhat.com> Reviewed-by:
Juan Quintela <quintela@redhat.com> Message-Id: <20200831210740.126168-9-ehabkost@redhat.com> Reviewed-by:
Juan Quintela <quintela@redhat.com> Message-Id: <20200831210740.126168-10-ehabkost@redhat.com> Message-Id: <20200831210740.126168-11-ehabkost@redhat.com> Signed-off-by:
Eduardo Habkost <ehabkost@redhat.com>
-
- Aug 21, 2020
-
-
Marc-André Lureau authored
Signed-off-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
Meson doesn't enjoy the same flexibility we have with Make in choosing the include path. In particular the tracing headers are using $(build_root)/$(<D). In order to keep the include directives unchanged, the simplest solution is to generate headers with patterns like "trace/trace-audio.h" and place forwarding headers in the source tree such that for example "audio/trace.h" includes "trace/trace-audio.h". This patch is too ugly to be applied to the Makefiles now. It's only a way to separate the changes to the tracing header files from the Meson rewrite of the tracing logic. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Aug 14, 2020
-
-
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:
John Snow <jsnow@redhat.com> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Signed-off-by:
Greg Kurz <groug@kaod.org> Message-Id: <159736033937.350502.12402444542194031035.stgit@bahia.lan> Signed-off-by:
David Gibson <david@gibson.dropbear.id.au>
-
- Jul 21, 2020
-
-
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:
Peter 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:
Laszlo Ersek <lersek@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200721131911.27380-3-philmd@redhat.com>
-