Skip to content

Commit 21dda46

Browse files
andreafioraldistweillegoaterstsquadpm215
authored
Fast mem and devices snapshots (AFLplusplus#16)
* Run docker probe only if docker or podman are available The docker probe uses "sudo -n" which can cause an e-mail with a security warning each time when configure is run. Therefore run docker probe only if either docker or podman are available. That avoids the problematic "sudo -n" on build environments which have neither docker nor podman installed. Fixes: c4575b5 ("configure: store container engine in config-host.mak") Signed-off-by: Stefan Weil <[email protected]> Message-Id: <[email protected]> Signed-off-by: Alex Bennée <[email protected]> Reviewed-by: Thomas Huth <[email protected]> Message-Id: <[email protected]> * tests/avocado/machine_aspeed.py: Reduce noise on the console for SDK tests The Aspeed SDK images are based on OpenBMC which starts a lot of services. The output noise on the console can break from time to time the test waiting for the logging prompt. Change the U-Boot bootargs variable to add "quiet" to the kernel command line and reduce the output volume. This also drops the test on the CPU id which was nice to have but not essential. Signed-off-by: Cédric Le Goater <[email protected]> Message-Id: <[email protected]> Signed-off-by: Alex Bennée <[email protected]> Message-Id: <[email protected]> * tests/docker: allow user to override check target This is useful when trying to bisect a particular failing test behind a docker run. For example: make docker-test-clang@fedora \ TARGET_LIST=arm-softmmu \ TEST_COMMAND="meson test qtest-arm/qos-test" \ J=9 V=1 Signed-off-by: Alex Bennée <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Message-Id: <[email protected]> * docs/devel: add a maintainers section to development process We don't currently have a clear place in the documentation to describe the roles and responsibilities of a maintainer. Lets create one so we can. I've moved a few small bits out of other files to try and keep everything in one place. Signed-off-by: Alex Bennée <[email protected]> Reviewed-by: Stefan Hajnoczi <[email protected]> Reviewed-by: Paolo Bonzini <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Message-Id: <[email protected]> * docs/devel: make language a little less code centric We welcome all sorts of patches. Signed-off-by: Alex Bennée <[email protected]> Reviewed-by: Stefan Hajnoczi <[email protected]> Reviewed-by: Paolo Bonzini <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Message-Id: <[email protected]> * docs/devel: simplify the minimal checklist The bullet points are quite long and contain process tips. Move those bits of the bullet to the relevant sections and link to them. Use a table for nicer formatting of the checklist. Signed-off-by: Alex Bennée <[email protected]> Reviewed-by: Stefan Hajnoczi <[email protected]> Reviewed-by: Paolo Bonzini <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Message-Id: <[email protected]> * docs/devel: try and improve the language around patch review It is important that contributors take the review process seriously and we collaborate in a respectful way while avoiding personal attacks. Try and make this clear in the language. Signed-off-by: Alex Bennée <[email protected]> Reviewed-by: Markus Armbruster <[email protected]> Reviewed-by: Stefan Hajnoczi <[email protected]> Reviewed-by: Paolo Bonzini <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Message-Id: <[email protected]> * tests/avocado: Raise timeout for boot_linux.py:BootLinuxPPC64.test_pseries_tcg On my machine, a debug build of QEMU takes about 260 seconds to complete this test, so with the current timeout value of 180 seconds it always times out. Double the timeout value to 360 so the test definitely has enough time to complete. Signed-off-by: Peter Maydell <[email protected]> Signed-off-by: Alex Bennée <[email protected]> Message-Id: <[email protected]> Message-Id: <[email protected]> * tests/avocado: introduce alpine virt test for CI The boot_linux tests download and run a full cloud image boot and start a full distro. While the ability to test the full boot chain is worthwhile it is perhaps a little too heavy weight and causes issues in CI. Fix this by introducing a new alpine linux ISO boot in machine_aarch64_virt. This boots a fully loaded -cpu max with all the bells and whistles in 31s on my machine. A full debug build takes around 180s on my machine so we set a more generous timeout to cover that. We don't add a test for lesser GIC versions although there is some coverage for that already in the boot_xen.py tests. If we want to introduce more comprehensive testing we can do it with a custom kernel and initrd rather than a full distro boot. Signed-off-by: Alex Bennée <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Message-Id: <[email protected]> * tests/avocado: skip aarch64 cloud TCG tests in CI We now have a much lighter weight test in machine_aarch64_virt which tests the full boot chain in less time. Rename the tests while we are at it to make it clear it is a Fedora cloud image. Signed-off-by: Alex Bennée <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Message-Id: <[email protected]> * gitlab: integrate coverage report This should hopefully give is nice coverage information about what our tests (or at least the subset we are running) have hit. Ideally we would want a way to trigger coverage on tests likely to be affected by the current commit. Signed-off-by: Alex Bennée <[email protected]> Acked-by: Stefan Hajnoczi <[email protected]> Message-Id: <[email protected]> * vhost: mask VIRTIO_F_RING_RESET for vhost and vhost-user devices Commit 69e1c14 ("virtio: core: vq reset feature negotation support") enabled VIRTIO_F_RING_RESET by default for all virtio devices. This feature is not currently emulated by QEMU, so for vhost and vhost-user devices we need to make sure it is supported by the offloaded device emulation (in-kernel or in another process). To do this we need to add VIRTIO_F_RING_RESET to the features bitmap passed to vhost_get_features(). This way it will be masked if the device does not support it. This issue was initially discovered with vhost-vsock and vhost-user-vsock, and then also tested with vhost-user-rng which confirmed the same issue. They fail when sending features through VHOST_SET_FEATURES ioctl or VHOST_USER_SET_FEATURES message, since VIRTIO_F_RING_RESET is negotiated by the guest (Linux >= v6.0), but not supported by the device. Fixes: 69e1c14 ("virtio: core: vq reset feature negotation support") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1318 Signed-off-by: Stefano Garzarella <[email protected]> Message-Id: <[email protected]> Reviewed-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Reviewed-by: Stefan Hajnoczi <[email protected]> Acked-by: Raphael Norwitz <[email protected]> Acked-by: Jason Wang <[email protected]> * tests: acpi: whitelist DSDT before moving PRQx to _SB scope Signed-off-by: Igor Mammedov <[email protected]> Message-Id: <[email protected]> Reviewed-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> * acpi: x86: move RPQx field back to _SB scope Commit 47a373f (acpi: pc/q35: drop ad-hoc PCI-ISA bridge AML routines and let bus ennumeration generate AML) moved ISA bridge AML generation to respective devices and was using aml_alias() to provide PRQx fields in _SB. scope. However, it turned out that SeaBIOS was not able to process Alias opcode when parsing DSDT, resulting in lack of keyboard during boot (SeaBIOS console, grub, FreeDOS). While fix for SeaBIOS is posted https://mail.coreboot.org/hyperkitty/list/[email protected]/thread/RGPL7HESH5U5JRLEO6FP77CZVHZK5J65/ fixed SeaBIOS might not make into QEMU-7.2 in time. Hence this workaround that puts PRQx back into _SB scope and gets rid of aliases in ISA bridge description, so DSDT will be parsable by broken SeaBIOS. That brings back hardcoded references to ISA bridge PCI0.S08.P40C/PCI0.SF8.PIRQ where middle part now is auto generated based on slot it's plugged in, but it should be fine as bridge initialization also hardcodes PCI address of the bridge so it can't ever move. Once QEMU tree has fixed SeaBIOS blob, we should be able to drop this part and revert back to alias based approach Reported-by: Volker Rümelin <[email protected]> Signed-off-by: Igor Mammedov <[email protected]> Message-Id: <[email protected]> Reviewed-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> * tests: acpi: x86: update expected DSDT after moving PRQx fields in _SB scope Expected DSDT changes, pc: - Field (P40C, ByteAcc, NoLock, Preserve) + Scope (\_SB) { - PRQ0, 8, - PRQ1, 8, - PRQ2, 8, - PRQ3, 8 + Field (PCI0.S08.P40C, ByteAcc, NoLock, Preserve) + { + PRQ0, 8, + PRQ1, 8, + PRQ2, 8, + PRQ3, 8 + } } - Alias (PRQ0, \_SB.PRQ0) - Alias (PRQ1, \_SB.PRQ1) - Alias (PRQ2, \_SB.PRQ2) - Alias (PRQ3, \_SB.PRQ3) q35: - Field (PIRQ, ByteAcc, NoLock, Preserve) - { - PRQA, 8, - PRQB, 8, - PRQC, 8, - PRQD, 8, - Offset (0x08), - PRQE, 8, - PRQF, 8, - PRQG, 8, - PRQH, 8 + Scope (\_SB) + { + Field (PCI0.SF8.PIRQ, ByteAcc, NoLock, Preserve) + { + PRQA, 8, + PRQB, 8, + PRQC, 8, + PRQD, 8, + Offset (0x08), + PRQE, 8, + PRQF, 8, + PRQG, 8, + PRQH, 8 + } } - Alias (PRQA, \_SB.PRQA) - Alias (PRQB, \_SB.PRQB) - Alias (PRQC, \_SB.PRQC) - Alias (PRQD, \_SB.PRQD) - Alias (PRQE, \_SB.PRQE) - Alias (PRQF, \_SB.PRQF) - Alias (PRQG, \_SB.PRQG) - Alias (PRQH, \_SB.PRQH) Signed-off-by: Igor Mammedov <[email protected]> Message-Id: <[email protected]> Reviewed-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> * MAINTAINERS: add mst to list of biosbits maintainers Adding Michael's name to the list of bios bits maintainers so that all changes and fixes into biosbits framework can go through his tree and he is notified. Suggested-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Ani Sinha <[email protected]> Message-Id: <[email protected]> Reviewed-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> * tests/avocado: configure acpi-bits to use avocado timeout Instead of using a hardcoded timeout, just rely on Avocado's built-in test case timeout. This helps avoid timeout issues on machines where 60 seconds is not sufficient. Signed-off-by: John Snow <[email protected]> Message-Id: <[email protected]> Reviewed-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Reviewed-by: Ani Sinha <[email protected]> * acpi/tests/avocado/bits: keep the work directory when BITS_DEBUG is set in env Debugging bits issue often involves running the QEMU command line manually outside of the avocado environment with the generated ISO. Hence, its inconvenient if the iso gets cleaned up after the test has finished. This change makes sure that the work directory is kept after the test finishes if the test is run with BITS_DEBUG=1 in the environment so that the iso is available for use with the QEMU command line. CC: Daniel P. Berrangé <[email protected]> Signed-off-by: Ani Sinha <[email protected]> Message-Id: <[email protected]> Reviewed-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> * virtio: disable error for out of spec queue-enable Virtio 1.0 is pretty clear that features have to be negotiated before enabling VQs. Unfortunately Seabios ignored this ever since gaining 1.0 support (UEFI is ok). Comment the error out for now, and add a TODO. Fixes: 3c37f8b ("virtio: introduce virtio_queue_enable()") Cc: "Kangjie Xu" <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Message-Id: <[email protected]> * hw/loongarch: Add default stdout uart in fdt Add "chosen" subnode into LoongArch fdt, and set it's "stdout-path" prop to uart node. Signed-off-by: Xiaojuan Yang <[email protected]> Reviewed-by: Song Gao <[email protected]> Message-Id: <[email protected]> Signed-off-by: Song Gao <[email protected]> * hw/loongarch: Fix setprop_sized method in fdt rtc node. Fix setprop_sized method in fdt rtc node. Signed-off-by: Xiaojuan Yang <[email protected]> Reviewed-by: Richard Henderson <[email protected]> Reviewed-by: Song Gao <[email protected]> Message-Id: <[email protected]> Signed-off-by: Song Gao <[email protected]> * hw/loongarch: Replace the value of uart info with macro Using macro to replace the value of uart info such as addr, size in acpi_build method. Signed-off-by: Xiaojuan Yang <[email protected]> Reviewed-by: Song Gao <[email protected]> Message-Id: <[email protected]> Signed-off-by: Song Gao <[email protected]> * target/arm: Don't do two-stage lookup if stage 2 is disabled In get_phys_addr_with_struct(), we call get_phys_addr_twostage() if the CPU supports EL2. However, we don't check here that stage 2 is actually enabled. Instead we only check that inside get_phys_addr_twostage() to skip stage 2 translation. This means that even if stage 2 is disabled we still tell the stage 1 lookup to do its page table walks via stage 2. This works by luck for normal CPU accesses, but it breaks for debug accesses, which are used by the disassembler and also by semihosting file reads and writes, because the debug case takes a different code path inside S1_ptw_translate(). This means that setups that use semihosting for file loads are broken (a regression since 7.1, introduced in recent ptw refactoring), and that sometimes disassembly in debug logs reports "unable to read memory" rather than showing the guest insns. Fix the bug by hoisting the "is stage 2 enabled?" check up to get_phys_addr_with_struct(), so that we handle S2 disabled the same way we do the "no EL2" case, with a simple single stage lookup. Reported-by: Jens Wiklander <[email protected]> Reviewed-by: Richard Henderson <[email protected]> Signed-off-by: Peter Maydell <[email protected]> Message-id: [email protected] * target/arm: Use signed quantity to represent VMSAv8-64 translation level The LPA2 extension implements 52-bit virtual addressing for 4k and 16k translation granules, and for the former, this means an additional level of translation is needed. This means we start counting at -1 instead of 0 when doing a walk, and so 'level' is now a signed quantity, and should be typed as such. So turn it from uint32_t into int32_t. This avoids a level of -1 getting misinterpreted as being >= 3, and terminating a page table walk prematurely with a bogus output address. Cc: Peter Maydell <[email protected]> Cc: Philippe Mathieu-Daudé <[email protected]> Cc: Richard Henderson <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]> Reviewed-by: Peter Maydell <[email protected]> Signed-off-by: Peter Maydell <[email protected]> * Update VERSION for v7.2.0-rc2 Signed-off-by: Stefan Hajnoczi <[email protected]> * tests/avocado: Update the URLs of the advent calendar images The qemu-advent-calendar.org server will be decommissioned soon. I've mirrored the images that we use for the QEMU CI to gitlab, so update their URLs to point to the new location. Message-Id: <[email protected]> Tested-by: Philippe Mathieu-Daudé <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Signed-off-by: Thomas Huth <[email protected]> * tests/qtest: Decrease the amount of output from the qom-test The logs in the gitlab-CI have a size constraint, and sometimes we already hit this limit. The biggest part of the log then seems to be filled by the qom-test, so we should decrease the size of the output - which can be done easily by not printing the path for each property, since the path has already been logged at the beginning of each node that we handle here. However, if we omit the path, we should make sure to not recurse into child nodes in between, so that it is clear to which node each property belongs. Thus store the children and links in a temporary list and recurse only at the end of each node, when all properties have already been printed. Message-Id: <[email protected]> Reviewed-by: Stefan Hajnoczi <[email protected]> Signed-off-by: Thomas Huth <[email protected]> * tests/avocado: use new rootfs for orangepi test The old URL wasn't stable. I suspect the current URL will only be stable for a few months so maybe we need another strategy for hosting rootfs snapshots? Signed-off-by: Alex Bennée <[email protected]> Message-Id: <[email protected]> Signed-off-by: Thomas Huth <[email protected]> * Revert "usbredir: avoid queuing hello packet on snapshot restore" Run state is also in RUN_STATE_PRELAUNCH while "-S" is used. This reverts commit 0631d4b Signed-off-by: Joelle van Dyne <[email protected]> Reviewed-by: Ján Tomko <[email protected]> The original commit broke the usage of usbredir with libvirt, which starts every domain with "-S". This workaround is no longer needed because the usbredir behavior has been fixed in the meantime: https://gitlab.freedesktop.org/spice/usbredir/-/merge_requests/61 Signed-off-by: Ján Tomko <[email protected]> Message-Id: <1689cec3eadcea87255e390cb236033aca72e168.1669193161.git.jtomko@redhat.com> Signed-off-by: Gerd Hoffmann <[email protected]> * gtk: disable GTK Clipboard with a new meson option The GTK Clipboard implementation may cause guest hangs. Therefore implement new configure switch: --enable-gtk-clipboard, as a meson option disabled by default, which warns in the help text about the experimental nature of the feature. Regenerate the meson build options to include it. The initialization of the clipboard is gtk.c, as well as the compilation of gtk-clipboard.c are now conditional on this new option to be set. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1150 Signed-off-by: Claudio Fontana <[email protected]> Acked-by: Gerd Hoffmann <[email protected]> Reviewed-by: Jim Fehlig <[email protected]> Message-Id: <[email protected]> Signed-off-by: Gerd Hoffmann <[email protected]> * hw/usb/hcd-xhci.c: spelling: tranfer Fixes: effaf5a Signed-off-by: Michael Tokarev <[email protected]> Reviewed-by: Thomas Huth <[email protected]> Reviewed-by: Stefan Weil <[email protected]> Message-Id: <[email protected]> Signed-off-by: Gerd Hoffmann <[email protected]> * ui/gtk: prevent ui lock up when dpy_gl_update called again before current draw event occurs A warning, "qemu: warning: console: no gl-unblock within" followed by guest scanout lockup can happen if dpy_gl_update is called in a row and the second call is made before gd_draw_event scheduled by the first call is taking place. This is because draw call returns without decrementing gl_block ref count if the dmabuf was already submitted as shown below. (gd_gl_area_draw/gd_egl_draw) if (dmabuf) { if (!dmabuf->draw_submitted) { return; } else { dmabuf->draw_submitted = false; } } So it should not schedule any redundant draw event in case draw_submitted is already set in gd_egl_fluch/gd_gl_area_scanout_flush. Cc: Gerd Hoffmann <[email protected]> Cc: Vivek Kasireddy <[email protected]> Signed-off-by: Dongwon Kim <[email protected]> Reviewed-by: Marc-André Lureau <[email protected]> Message-Id: <[email protected]> Signed-off-by: Gerd Hoffmann <[email protected]> * hw/usb/hcd-xhci: Reset the XHCIState with device_cold_reset() Currently the hcd-xhci-pci and hcd-xhci-sysbus devices, which are mostly wrappers around the TYPE_XHCI device, which is a direct subclass of TYPE_DEVICE. Since TYPE_DEVICE devices are not on any qbus and do not get automatically reset, the wrapper devices both reset the TYPE_XHCI device in their own reset functions. However, they do this using device_legacy_reset(), which will reset the device itself but not any bus it has. Switch to device_cold_reset(), which avoids using a deprecated function and also propagates reset along any child buses. Signed-off-by: Peter Maydell <[email protected]> Message-Id: <[email protected]> Signed-off-by: Gerd Hoffmann <[email protected]> * hw/audio/intel-hda: don't reset codecs twice Currently the intel-hda device has a reset method which manually resets all the codecs by calling device_legacy_reset() on them. This means they get reset twice, once because child devices on a qbus get reset before the parent device's reset method is called, and then again because we're manually resetting them. Drop the manual reset call, and ensure that codecs are still reset when the guest does a reset via ICH6_GCTL_RESET by using device_cold_reset() (which resets all the devices on the qbus as well as the device itself) instead of a direct call to the reset function. This is a slight ordering change because the (only) codec reset now happens before the controller registers etc are reset, rather than once before and then once after, but the codec reset function hda_audio_reset() doesn't care. This lets us drop a use of device_legacy_reset(), which is deprecated. Signed-off-by: Peter Maydell <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Message-Id: <[email protected]> Signed-off-by: Gerd Hoffmann <[email protected]> * hw/audio/intel-hda: Drop unnecessary prototype The only use of intel_hda_reset() is after its definition, so we don't need to separately declare its prototype at the top of the file; drop the unnecessary line. Signed-off-by: Peter Maydell <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Message-Id: <[email protected]> Signed-off-by: Gerd Hoffmann <[email protected]> * add syx snapshot extras * it compiles! * virtiofsd: Add `sigreturn` to the seccomp whitelist The virtiofsd currently crashes on s390x. This is because of a `sigreturn` system call. See audit log below: type=SECCOMP msg=audit(1669382477.611:459): auid=4294967295 uid=0 gid=0 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 pid=6649 comm="virtiofsd" exe="/usr/libexec/virtiofsd" sig=31 arch=80000016 syscall=119 compat=0 ip=0x3fff15f748a code=0x80000000AUID="unset" UID="root" GID="root" ARCH=s390x SYSCALL=sigreturn Signed-off-by: Marc Hartmayer <[email protected]> Reviewed-by: German Maglione <[email protected]> Signed-off-by: Stefan Hajnoczi <[email protected]> Message-Id: <[email protected]> * libvhost-user: Fix wrong type of argument to formatting function (reported by LGTM) Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Signed-off-by: Stefan Weil <[email protected]> Message-Id: <[email protected]> Signed-off-by: Laurent Vivier <[email protected]> Signed-off-by: Stefan Hajnoczi <[email protected]> Message-Id: <[email protected]> * libvhost-user: Fix format strings Signed-off-by: Stefan Weil <[email protected]> Reviewed-by: Marc-André Lureau <[email protected]> Message-Id: <[email protected]> Signed-off-by: Laurent Vivier <[email protected]> Signed-off-by: Stefan Hajnoczi <[email protected]> Message-Id: <[email protected]> * libvhost-user: Fix two more format strings This fix is required for 32 bit hosts. The bug was detected by CI for arm-linux, but is also relevant for i386-linux. Reported-by: Stefan Hajnoczi <[email protected]> Signed-off-by: Stefan Weil <[email protected]> Reviewed-by: Stefan Hajnoczi <[email protected]> Signed-off-by: Stefan Hajnoczi <[email protected]> Message-Id: <[email protected]> * libvhost-user: Add format attribute to local function vu_panic Signed-off-by: Stefan Weil <[email protected]> Reviewed-by: Marc-André Lureau <[email protected]> Message-Id: <[email protected]> Signed-off-by: Laurent Vivier <[email protected]> Signed-off-by: Stefan Hajnoczi <[email protected]> Message-Id: <[email protected]> * MAINTAINERS: Add subprojects/libvhost-user to section "vhost" Signed-off-by: Stefan Weil <[email protected]> [Michael agreed to act as maintainer for libvhost-user via email in https://lore.kernel.org/qemu-devel/[email protected]/. --Stefan] Signed-off-by: Stefan Hajnoczi <[email protected]> Message-Id: <[email protected]> * Add G_GNUC_PRINTF to function qemu_set_info_str and fix related issues With the G_GNUC_PRINTF function attribute the compiler detects two potential insecure format strings: ../../../net/stream.c:248:31: warning: format string is not a string literal (potentially insecure) [-Wformat-security] qemu_set_info_str(&s->nc, uri); ^~~ ../../../net/stream.c:322:31: warning: format string is not a string literal (potentially insecure) [-Wformat-security] qemu_set_info_str(&s->nc, uri); ^~~ There are also two other warnings: ../../../net/socket.c:182:35: warning: zero-length gnu_printf format string [-Wformat-zero-length] 182 | qemu_set_info_str(&s->nc, ""); | ^~ ../../../net/stream.c:170:35: warning: zero-length gnu_printf format string [-Wformat-zero-length] 170 | qemu_set_info_str(&s->nc, ""); Reviewed-by: Peter Maydell <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Signed-off-by: Stefan Weil <[email protected]> Signed-off-by: Stefan Hajnoczi <[email protected]> Message-Id: <[email protected]> * del ramfile * update seabios source from 1.16.0 to 1.16.1 git shortlog rel-1.16.0..rel-1.16.1 =================================== Gerd Hoffmann (3): malloc: use variable for ZoneHigh size malloc: use large ZoneHigh when there is enough memory virtio-blk: use larger default request size Igor Mammedov (1): acpi: parse Alias object Volker Rümelin (2): pci: refactor the pci_config_*() functions reset: force standard PCI configuration access Xiaofei Lee (1): virtio-blk: Fix incorrect type conversion in virtio_blk_op() Xuan Zhuo (2): virtio-mmio: read/write the hi 32 features for mmio virtio: finalize features before using device Signed-off-by: Gerd Hoffmann <[email protected]> * update seabios binaries to 1.16.1 Signed-off-by: Gerd Hoffmann <[email protected]> * fix for non i386 archs * replay: Fix declaration of replay_read_next_clock Fixes the build with gcc 13: replay/replay-time.c:34:6: error: conflicting types for \ 'replay_read_next_clock' due to enum/integer mismatch; \ have 'void(ReplayClockKind)' [-Werror=enum-int-mismatch] 34 | void replay_read_next_clock(ReplayClockKind kind) | ^~~~~~~~~~~~~~~~~~~~~~ In file included from ../qemu/replay/replay-time.c:14: replay/replay-internal.h:139:6: note: previous declaration of \ 'replay_read_next_clock' with type 'void(unsigned int)' 139 | void replay_read_next_clock(unsigned int kind); | ^~~~~~~~~~~~~~~~~~~~~~ Fixes: 8eda206 ("replay: recording and replaying clock ticks") Signed-off-by: Richard Henderson <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Reviewed-by: Wilfred Mallawa <[email protected]> Reviewed-by: Pavel Dovgalyuk <[email protected]> Signed-off-by: Stefan Hajnoczi <[email protected]> Message-Id: <[email protected]> * hw/display/qxl: Have qxl_log_command Return early if no log_cmd handler Only 3 command types are logged: no need to call qxl_phys2virt() for the other types. Using different cases will help to pass different structure sizes to qxl_phys2virt() in a pair of commits. Reviewed-by: Marc-André Lureau <[email protected]> Signed-off-by: Philippe Mathieu-Daudé <[email protected]> Signed-off-by: Stefan Hajnoczi <[email protected]> Message-Id: <[email protected]> * hw/display/qxl: Document qxl_phys2virt() Reviewed-by: Marc-André Lureau <[email protected]> Signed-off-by: Philippe Mathieu-Daudé <[email protected]> Signed-off-by: Stefan Hajnoczi <[email protected]> Message-Id: <[email protected]> * hw/display/qxl: Pass requested buffer size to qxl_phys2virt() Currently qxl_phys2virt() doesn't check for buffer overrun. In order to do so in the next commit, pass the buffer size as argument. For QXLCursor in qxl_render_cursor() -> qxl_cursor() we verify the size of the chunked data ahead, checking we can access 'sizeof(QXLCursor) + chunk->data_size' bytes. Since in the SPICE_CURSOR_TYPE_MONO case the cursor is assumed to fit in one chunk, no change are required. In SPICE_CURSOR_TYPE_ALPHA the ahead read is handled in qxl_unpack_chunks(). Signed-off-by: Philippe Mathieu-Daudé <[email protected]> Acked-by: Gerd Hoffmann <[email protected]> Signed-off-by: Stefan Hajnoczi <[email protected]> Message-Id: <[email protected]> * hw/display/qxl: Avoid buffer overrun in qxl_phys2virt (CVE-2022-4144) Have qxl_get_check_slot_offset() return false if the requested buffer size does not fit within the slot memory region. Similarly qxl_phys2virt() now returns NULL in such case, and qxl_dirty_one_surface() aborts. This avoids buffer overrun in the host pointer returned by memory_region_get_ram_ptr(). Fixes: CVE-2022-4144 (out-of-bounds read) Reported-by: Wenxu Yin (@awxylitol) Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1336 Signed-off-by: Philippe Mathieu-Daudé <[email protected]> Signed-off-by: Stefan Hajnoczi <[email protected]> Message-Id: <[email protected]> * hw/display/qxl: Assert memory slot fits in preallocated MemoryRegion Signed-off-by: Philippe Mathieu-Daudé <[email protected]> Signed-off-by: Stefan Hajnoczi <[email protected]> Message-Id: <[email protected]> * block-backend: avoid bdrv_unregister_buf() NULL pointer deref bdrv_*() APIs expect a valid BlockDriverState. Calling them with bs=NULL leads to undefined behavior. Jonathan Cameron reported this following NULL pointer dereference when a VM with a virtio-blk device and a memory-backend-file object is terminated: 1. qemu_cleanup() closes all drives, setting blk->root to NULL 2. qemu_cleanup() calls user_creatable_cleanup(), which results in a RAM block notifier callback because the memory-backend-file is destroyed. 3. blk_unregister_buf() is called by virtio-blk's BlockRamRegistrar notifier callback and undefined behavior occurs. Fixes: baf4226 ("virtio-blk: use BDRV_REQ_REGISTERED_BUF optimization hint") Co-authored-by: Jonathan Cameron <[email protected]> Reviewed-by: Kevin Wolf <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Signed-off-by: Stefan Hajnoczi <[email protected]> Message-Id: <[email protected]> * target/arm: Set TCGCPUOps.restore_state_to_opc for v7m This setting got missed, breaking v7m. Fixes: 56c6c98 ("target/arm: Convert to tcg_ops restore_state_to_opc") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1347 Signed-off-by: Richard Henderson <[email protected]> Signed-off-by: Evgeny Ermakov <[email protected]> Signed-off-by: Stefan Hajnoczi <[email protected]> Message-Id: <[email protected]> * Update VERSION for v7.2.0-rc3 Signed-off-by: Stefan Hajnoczi <[email protected]> * hooks are now post mem access * tests/qtests: override "force-legacy" for gpio virtio-mmio tests The GPIO device is a VIRTIO_F_VERSION_1 devices but running with a legacy MMIO interface we miss out that feature bit causing confusion. For the GPIO test force the mmio bus to support non-legacy so we can properly test it. Signed-off-by: Alex Bennée <[email protected]> Reviewed-by: Michael S. Tsirkin <[email protected]> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1333 Message-Id: <[email protected]> Acked-by: Thomas Huth <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> * vhost: enable vrings in vhost_dev_start() for vhost-user devices Commit 02b61f3 ("hw/virtio: incorporate backend features in features") properly negotiates VHOST_USER_F_PROTOCOL_FEATURES with the vhost-user backend, but we forgot to enable vrings as specified in docs/interop/vhost-user.rst: If ``VHOST_USER_F_PROTOCOL_FEATURES`` has not been negotiated, the ring starts directly in the enabled state. If ``VHOST_USER_F_PROTOCOL_FEATURES`` has been negotiated, the ring is initialized in a disabled state and is enabled by ``VHOST_USER_SET_VRING_ENABLE`` with parameter 1. Some vhost-user front-ends already did this by calling vhost_ops.vhost_set_vring_enable() directly: - backends/cryptodev-vhost.c - hw/net/virtio-net.c - hw/virtio/vhost-user-gpio.c But most didn't do that, so we would leave the vrings disabled and some backends would not work. We observed this issue with the rust version of virtiofsd [1], which uses the event loop [2] provided by the vhost-user-backend crate where requests are not processed if vring is not enabled. Let's fix this issue by enabling the vrings in vhost_dev_start() for vhost-user front-ends that don't already do this directly. Same thing also in vhost_dev_stop() where we disable vrings. [1] https://gitlab.com/virtio-fs/virtiofsd [2] https://github.com/rust-vmm/vhost/blob/240fc2966/crates/vhost-user-backend/src/event_loop.rs#L217 Fixes: 02b61f3 ("hw/virtio: incorporate backend features in features") Reported-by: German Maglione <[email protected]> Tested-by: German Maglione <[email protected]> Signed-off-by: Stefano Garzarella <[email protected]> Acked-by: Raphael Norwitz <[email protected]> Message-Id: <[email protected]> Signed-off-by: Alex Bennée <[email protected]> Reviewed-by: Michael S. Tsirkin <[email protected]> Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> * hw/virtio: add started_vu status field to vhost-user-gpio As per the fix to vhost-user-blk in f5b22d0 (vhost: recheck dev state in the vhost_migration_log routine) we really should track the connection and starting separately. Signed-off-by: Alex Bennée <[email protected]> Reviewed-by: Michael S. Tsirkin <[email protected]> Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> * hw/virtio: generalise CHR_EVENT_CLOSED handling ..and use for both virtio-user-blk and virtio-user-gpio. This avoids the circular close by deferring shutdown due to disconnection until a later point. virtio-user-blk already had this mechanism in place so generalise it as a vhost-user helper function and use for both blk and gpio devices. While we are at it we also fix up vhost-user-gpio to re-establish the event handler after close down so we can reconnect later. Signed-off-by: Alex Bennée <[email protected]> Reviewed-by: Michael S. Tsirkin <[email protected]> Reviewed-by: Raphael Norwitz <[email protected]> Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> * include/hw: VM state takes precedence in virtio_device_should_start The VM status should always preempt the device status for these checks. This ensures the device is in the correct state when we suspend the VM prior to migrations. This restores the checks to the order they where in before the refactoring moved things around. While we are at it lets improve our documentation of the various fields involved and document the two functions. Fixes: 9f6bcfd (hw/virtio: move vm_running check to virtio_device_started) Fixes: 259d69c (hw/virtio: introduce virtio_device_should_start) Signed-off-by: Alex Bennée <[email protected]> Tested-by: Christian Borntraeger <[email protected]> Reviewed-by: Michael S. Tsirkin <[email protected]> Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> * hw/nvme: fix aio cancel in format There are several bugs in the async cancel code for the Format command. Firstly, cancelling a format operation neglects to set iocb->ret as well as clearing the iocb->aiocb after cancelling the underlying aiocb which causes the aio callback to ignore the cancellation. Trivial fix. Secondly, and worse, because the request is queued up for posting to the CQ in a bottom half, if the cancellation is due to the submission queue being deleted (which calls blk_aio_cancel), the req structure is deallocated in nvme_del_sq prior to the bottom half being schedulued. Fix this by simply removing the bottom half, there is no reason to defer it anyway. Fixes: 3bcf26d ("hw/nvme: reimplement format nvm to allow cancellation") Reported-by: Jonathan Derrick <[email protected]> Reviewed-by: Keith Busch <[email protected]> Signed-off-by: Klaus Jensen <[email protected]> * hw/nvme: fix aio cancel in flush Make sure that iocb->aiocb is NULL'ed when cancelling. Fix a potential use-after-free by removing the bottom half and enqueuing the completion directly. Fixes: 38f4ac6 ("hw/nvme: reimplement flush to allow cancellation") Reviewed-by: Keith Busch <[email protected]> Signed-off-by: Klaus Jensen <[email protected]> * hw/nvme: fix aio cancel in zone reset If the zone reset operation is cancelled but the block unmap operation completes normally, the callback will continue resetting the next zone since it neglects to check iocb->ret which will have been set to -ECANCELED. Make sure that this is checked and bail out if an error is present. Secondly, fix a potential use-after-free by removing the bottom half and enqueuing the completion directly. Fixes: 63d96e4 ("hw/nvme: reimplement zone reset to allow cancellation") Reviewed-by: Keith Busch <[email protected]> Signed-off-by: Klaus Jensen <[email protected]> * hw/nvme: fix aio cancel in dsm When the DSM operation is cancelled asynchronously, we set iocb->ret to -ECANCELED. However, the callback function only checks the return value of the completed aio, which may have completed succesfully prior to the cancellation and thus the callback ends up continuing the dsm operation instead of bailing out. Fix this. Secondly, fix a potential use-after-free by removing the bottom half and enqueuing the completion directly. Fixes: d7d1474 ("hw/nvme: reimplement dsm to allow cancellation") Reviewed-by: Keith Busch <[email protected]> Signed-off-by: Klaus Jensen <[email protected]> * hw/nvme: remove copy bh scheduling Fix a potential use-after-free by removing the bottom half and enqueuing the completion directly. Fixes: 796d206 ("hw/nvme: reimplement the copy command to allow aio cancellation") Reviewed-by: Keith Busch <[email protected]> Signed-off-by: Klaus Jensen <[email protected]> * target/i386: allow MMX instructions with CR4.OSFXSR=0 MMX state is saved/restored by FSAVE/FRSTOR so the instructions are not illegal opcodes even if CR4.OSFXSR=0. Make sure that validate_vex takes into account the prefix and only checks HF_OSFXSR_MASK in the presence of an SSE instruction. Fixes: 20581aa ("target/i386: validate VEX prefixes via the instructions' exception classes", 2022-10-18) Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1350 Reported-by: Helge Konetzka (@hejko on gitlab.com) Reviewed-by: Richard Henderson <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]> * target/i386: Always completely initialize TranslateFault In get_physical_address, the canonical address check failed to set TranslateFault.stage2, which resulted in an uninitialized read from the struct when reporting the fault in x86_cpu_tlb_fill. Adjust all error paths to use structure assignment so that the entire struct is always initialized. Reported-by: Daniel Hoffman <[email protected]> Fixes: 9bbcf37 ("target/i386: Reorg GET_HPHYS") Signed-off-by: Richard Henderson <[email protected]> Message-Id: <[email protected]> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1324 Signed-off-by: Paolo Bonzini <[email protected]> * hw/loongarch/virt: Add cfi01 pflash device Add cfi01 pflash device for LoongArch virt machine Signed-off-by: Xiaojuan Yang <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Message-Id: <[email protected]> Signed-off-by: Song Gao <[email protected]> * Sync pc on breakpoints * tests/qtest/migration-test: Fix unlink error and memory leaks When running the migration test compiled with Clang from Fedora 37 and sanitizers enabled, there is an error complaining about unlink(): ../tests/qtest/migration-test.c:1072:12: runtime error: null pointer passed as argument 1, which is declared to never be null /usr/include/unistd.h:858:48: note: nonnull attribute specified here SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../tests/qtest/migration-test.c:1072:12 in (test program exited with status code 1) TAP parsing error: Too few tests run (expected 33, got 20) The data->clientcert and data->clientkey pointers can indeed be unset in some tests, so we have to check them before calling unlink() with those. While we're at it, I also noticed that the code is only freeing some but not all of the allocated strings in this function, and indeed, valgrind is also complaining about memory leaks here. So let's call g_free() on all allocated strings to avoid leaking memory here. Message-Id: <[email protected]> Tested-by: Bin Meng <[email protected]> Reviewed-by: Daniel P. Berrangé <[email protected]> Reviewed-by: Juan Quintela <[email protected]> Signed-off-by: Thomas Huth <[email protected]> * target/s390x/tcg: Fix and improve the SACF instruction The SET ADDRESS SPACE CONTROL FAST instruction is not privileged, it can be used from problem space, too. Just the switching to the home address space is privileged and should still generate a privilege exception. This bug is e.g. causing programs like Java that use the "getcpu" vdso kernel function to crash (see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=990417#26 ). While we're at it, also check if DAT is not enabled. In that case the instruction is supposed to generate a special operation exception. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/655 Message-Id: <[email protected]> Reviewed-by: Ilya Leoshkevich <[email protected]> Reviewed-by: David Hildenbrand <[email protected]> Reviewed-by: Richard Henderson <[email protected]> Signed-off-by: Thomas Huth <[email protected]> * hw/display/next-fb: Fix comment typo Signed-off-by: Evgeny Ermakov <[email protected]> Message-Id: <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Reviewed-by: Peter Maydell <[email protected]> Signed-off-by: Thomas Huth <[email protected]> * fix dev snapshots * working syx snaps * Revert "hw/loongarch/virt: Add cfi01 pflash device" This reverts commit 14dccc8. Signed-off-by: Song Gao <[email protected]> Signed-off-by: Stefan Hajnoczi <[email protected]> Message-Id: <[email protected]> * Update VERSION for v7.2.0-rc4 Signed-off-by: Stefan Hajnoczi <[email protected]> Signed-off-by: Stefan Weil <[email protected]> Signed-off-by: Alex Bennée <[email protected]> Signed-off-by: Cédric Le Goater <[email protected]> Signed-off-by: Peter Maydell <[email protected]> Signed-off-by: Stefano Garzarella <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Igor Mammedov <[email protected]> Signed-off-by: Ani Sinha <[email protected]> Signed-off-by: John Snow <[email protected]> Signed-off-by: Xiaojuan Yang <[email protected]> Signed-off-by: Song Gao <[email protected]> Signed-off-by: Stefan Hajnoczi <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]> Signed-off-by: Thomas Huth <[email protected]> Signed-off-by: Ján Tomko <[email protected]> Signed-off-by: Gerd Hoffmann <[email protected]> Signed-off-by: Claudio Fontana <[email protected]> Signed-off-by: Michael Tokarev <[email protected]> Signed-off-by: Dongwon Kim <[email protected]> Signed-off-by: Marc Hartmayer <[email protected]> Signed-off-by: Laurent Vivier <[email protected]> Signed-off-by: Richard Henderson <[email protected]> Signed-off-by: Philippe Mathieu-Daudé <[email protected]> Signed-off-by: Evgeny Ermakov <[email protected]> Signed-off-by: Klaus Jensen <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]> Co-authored-by: Stefan Weil <[email protected]> Co-authored-by: Cédric Le Goater <[email protected]> Co-authored-by: Alex Bennée <[email protected]> Co-authored-by: Peter Maydell <[email protected]> Co-authored-by: Stefano Garzarella <[email protected]> Co-authored-by: Igor Mammedov <[email protected]> Co-authored-by: Ani Sinha <[email protected]> Co-authored-by: John Snow <[email protected]> Co-authored-by: Michael S. Tsirkin <[email protected]> Co-authored-by: Xiaojuan Yang <[email protected]> Co-authored-by: Stefan Hajnoczi <[email protected]> Co-authored-by: Ard Biesheuvel <[email protected]> Co-authored-by: Thomas Huth <[email protected]> Co-authored-by: Joelle van Dyne <[email protected]> Co-authored-by: Claudio Fontana <[email protected]> Co-authored-by: Michael Tokarev <[email protected]> Co-authored-by: Dongwon Kim <[email protected]> Co-authored-by: Marc Hartmayer <[email protected]> Co-authored-by: Stefan Weil via <[email protected]> Co-authored-by: Gerd Hoffmann <[email protected]> Co-authored-by: Richard Henderson <[email protected]> Co-authored-by: Philippe Mathieu-Daudé <[email protected]> Co-authored-by: Jonathan Cameron <[email protected]> Co-authored-by: Evgeny Ermakov <[email protected]> Co-authored-by: Klaus Jensen <[email protected]> Co-authored-by: Paolo Bonzini <[email protected]> Co-authored-by: Song Gao <[email protected]>
1 parent 54e2c6f commit 21dda46

File tree

146 files changed

+1725
-448
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+1725
-448
lines changed

.gitlab-ci.d/buildtest.yml

+11-1
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,17 @@ check-gprof-gcov:
494494
IMAGE: ubuntu2004
495495
MAKE_CHECK_ARGS: check
496496
after_script:
497-
- ${CI_PROJECT_DIR}/scripts/ci/coverage-summary.sh
497+
- cd build
498+
- gcovr --xml-pretty --exclude-unreachable-branches --print-summary
499+
-o coverage.xml --root ${CI_PROJECT_DIR} . *.p
500+
coverage: /^\s*lines:\s*\d+.\d+\%/
501+
artifacts:
502+
name: ${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}
503+
expire_in: 2 days
504+
reports:
505+
coverage_report:
506+
coverage_format: cobertura
507+
path: build/coverage.xml
498508

499509
build-oss-fuzz:
500510
extends: .native_build_job_template

MAINTAINERS

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Descriptions of section entries:
2323
W: Web-page with status/info
2424
Q: Patchwork web based patch tracking system site
2525
T: SCM tree type and location. Type is one of: git, hg, quilt, stgit.
26-
S: Status, one of the following:
26+
S: Status, one of the following (keep in sync with docs/devel/maintainers.rst):
2727
Supported: Someone is actually paid to look after this.
2828
Maintained: Someone actually looks after it.
2929
Odd Fixes: It has a maintainer but they don't have time to do
@@ -1865,6 +1865,7 @@ F: hw/acpi/viot.h
18651865

18661866
ACPI/AVOCADO/BIOSBITS
18671867
M: Ani Sinha <[email protected]>
1868+
M: Michael S. Tsirkin <[email protected]>
18681869
S: Supported
18691870
F: tests/avocado/acpi-bits/*
18701871
F: tests/avocado/acpi-bits.py
@@ -2004,6 +2005,7 @@ F: docs/interop/vhost-user.rst
20042005
F: contrib/vhost-user-*/
20052006
F: backends/vhost-user.c
20062007
F: include/sysemu/vhost-user-backend.h
2008+
F: subprojects/libvhost-user/
20072009

20082010
virtio
20092011
M: Michael S. Tsirkin <[email protected]>

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.1.91
1+
7.1.94

accel/tcg/cpu-exec.c

+8
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,12 @@ static inline void cpu_handle_debug_exception(CPUState *cpu)
661661
}
662662
}
663663

664+
//// --- Begin LibAFL code ---
665+
666+
void libafl_sync_breakpoint_cpu(void);
667+
668+
//// --- End LibAFL code ---
669+
664670
static inline bool cpu_handle_exception(CPUState *cpu, int *ret)
665671
{
666672
//// --- Begin LibAFL code ---
@@ -670,6 +676,8 @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret)
670676
if (cpu->exception_index == EXCP_LIBAFL_BP) {
671677
*ret = cpu->exception_index;
672678
cpu->exception_index = -1;
679+
680+
libafl_sync_breakpoint_cpu();
673681
return true;
674682
}
675683

accel/tcg/cputlb.c

+19
Original file line numberDiff line numberDiff line change
@@ -2312,6 +2312,12 @@ store_helper_unaligned(CPUArchState *env, target_ulong addr, uint64_t val,
23122312
}
23132313
}
23142314

2315+
//// --- Begin LibAFL code ---
2316+
2317+
void syx_snapshot_dirty_list_add_hostaddr(void* host_addr);
2318+
2319+
//// --- End LibAFL code ---
2320+
23152321
static inline void QEMU_ALWAYS_INLINE
23162322
store_helper(CPUArchState *env, target_ulong addr, uint64_t val,
23172323
MemOpIdx oi, uintptr_t retaddr, MemOp op)
@@ -2389,6 +2395,12 @@ store_helper(CPUArchState *env, target_ulong addr, uint64_t val,
23892395

23902396
haddr = (void *)((uintptr_t)addr + entry->addend);
23912397

2398+
//// --- Begin LibAFL code ---
2399+
2400+
syx_snapshot_dirty_list_add_hostaddr(haddr);
2401+
2402+
//// --- End LibAFL code ---
2403+
23922404
/*
23932405
* Keep these two store_memop separate to ensure that the compiler
23942406
* is able to fold the entire function to a single instruction.
@@ -2413,6 +2425,13 @@ store_helper(CPUArchState *env, target_ulong addr, uint64_t val,
24132425
}
24142426

24152427
haddr = (void *)((uintptr_t)addr + entry->addend);
2428+
2429+
//// --- Begin LibAFL code ---
2430+
2431+
syx_snapshot_dirty_list_add_hostaddr(haddr);
2432+
2433+
//// --- End LibAFL code ---
2434+
24162435
store_memop(haddr, val, op);
24172436
}
24182437

accel/tcg/tcg-runtime.c

+27-6
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
#include "qapi/error.h"
4141
#include "qemu/error-report.h"
4242
#include "qemu/main-loop.h"
43+
#include "hw/core/cpu.h"
44+
#include "sysemu/hw_accel.h"
4345
#include <stdlib.h>
4446
#include <string.h>
4547

@@ -129,28 +131,47 @@ void libafl_load_qemu_snapshot(char *name, bool sync)
129131
int libafl_qemu_break_asap = 0;
130132

131133
CPUState* libafl_breakpoint_cpu;
134+
vaddr libafl_breakpoint_pc;
135+
136+
#ifdef TARGET_ARM
137+
#define THUMB_MASK(value) (value | libafl_breakpoint_cpu->env_ptr->thumb)
138+
#else
139+
#define THUMB_MASK(value) value
140+
#endif
132141

133142
void libafl_qemu_trigger_breakpoint(CPUState* cpu);
134143

144+
void libafl_sync_breakpoint_cpu(void);
145+
146+
void libafl_sync_breakpoint_cpu(void)
147+
{
148+
if (libafl_breakpoint_pc) {
149+
CPUClass* cc = CPU_GET_CLASS(libafl_breakpoint_cpu);
150+
cc->set_pc(libafl_breakpoint_cpu, THUMB_MASK(libafl_breakpoint_pc));
151+
}
152+
libafl_breakpoint_pc = 0;
153+
}
154+
135155
void libafl_qemu_trigger_breakpoint(CPUState* cpu)
136156
{
157+
libafl_breakpoint_cpu = cpu;
137158
#ifndef CONFIG_USER_ONLY
138-
libafl_breakpoint_cpu = cpu;
139-
cpu->stopped = true;
140159
qemu_system_debug_request();
141-
#else
160+
cpu->stopped = true;
161+
#endif
142162
if (cpu->running) {
143163
cpu->exception_index = EXCP_LIBAFL_BP;
144164
cpu_loop_exit(cpu);
145165
} else {
146166
libafl_qemu_break_asap = 1;
147167
}
148-
#endif
149168
}
150169

151-
void HELPER(libafl_qemu_handle_breakpoint)(CPUArchState *env)
170+
void HELPER(libafl_qemu_handle_breakpoint)(CPUArchState *env, target_ulong pc)
152171
{
153-
libafl_qemu_trigger_breakpoint(env_cpu(env));
172+
CPUState* cpu = env_cpu(env);
173+
libafl_breakpoint_pc = pc;
174+
libafl_qemu_trigger_breakpoint(cpu);
154175
}
155176

156177
//// --- End LibAFL code ---

accel/tcg/tcg-runtime.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ DEF_HELPER_FLAGS_5(gvec_bitsel, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)
288288

289289
//// --- Begin LibAFL code ---
290290

291-
DEF_HELPER_FLAGS_1(libafl_qemu_handle_breakpoint, TCG_CALL_NO_RWG, void, env)
291+
DEF_HELPER_FLAGS_2(libafl_qemu_handle_breakpoint, TCG_CALL_NO_RWG,
292+
void, env, tl)
292293

293294
//// --- End LibAFL code ---

accel/tcg/translator.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,13 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int max_insns,
145145
struct libafl_breakpoint* bp = libafl_qemu_breakpoints;
146146
while (bp) {
147147
if (bp->addr == db->pc_next) {
148-
gen_helper_libafl_qemu_handle_breakpoint(cpu_env);
148+
TCGv tmp0 = tcg_const_tl(db->pc_next);
149+
gen_helper_libafl_qemu_handle_breakpoint(cpu_env, tmp0);
150+
#if TARGET_LONG_BITS == 32
151+
tcg_temp_free_i32(tmp0);
152+
#else
153+
tcg_temp_free_i64(tmp0);
154+
#endif
149155
}
150156
bp = bp->next;
151157
}

backends/cryptodev-vhost.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ cryptodev_vhost_start_one(CryptoDevBackendVhost *crypto,
9494
goto fail_notifiers;
9595
}
9696

97-
r = vhost_dev_start(&crypto->dev, dev);
97+
r = vhost_dev_start(&crypto->dev, dev, false);
9898
if (r < 0) {
9999
goto fail_start;
100100
}
@@ -111,7 +111,7 @@ static void
111111
cryptodev_vhost_stop_one(CryptoDevBackendVhost *crypto,
112112
VirtIODevice *dev)
113113
{
114-
vhost_dev_stop(&crypto->dev, dev);
114+
vhost_dev_stop(&crypto->dev, dev, false);
115115
vhost_dev_disable_notifiers(&crypto->dev, dev);
116116
}
117117

backends/vhost-user.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ vhost_user_backend_start(VhostUserBackend *b)
8585
}
8686

8787
b->dev.acked_features = b->vdev->guest_features;
88-
ret = vhost_dev_start(&b->dev, b->vdev);
88+
ret = vhost_dev_start(&b->dev, b->vdev, true);
8989
if (ret < 0) {
9090
error_report("Error start vhost dev");
9191
goto err_guest_notifiers;
@@ -120,7 +120,7 @@ vhost_user_backend_stop(VhostUserBackend *b)
120120
return;
121121
}
122122

123-
vhost_dev_stop(&b->dev, b->vdev);
123+
vhost_dev_stop(&b->dev, b->vdev, true);
124124

125125
if (k->set_guest_notifiers) {
126126
ret = k->set_guest_notifiers(qbus->parent,

block/block-backend.c

+13-2
Original file line numberDiff line numberDiff line change
@@ -2576,14 +2576,25 @@ static void blk_root_drained_end(BdrvChild *child, int *drained_end_counter)
25762576

25772577
bool blk_register_buf(BlockBackend *blk, void *host, size_t size, Error **errp)
25782578
{
2579+
BlockDriverState *bs = blk_bs(blk);
2580+
25792581
GLOBAL_STATE_CODE();
2580-
return bdrv_register_buf(blk_bs(blk), host, size, errp);
2582+
2583+
if (bs) {
2584+
return bdrv_register_buf(bs, host, size, errp);
2585+
}
2586+
return true;
25812587
}
25822588

25832589
void blk_unregister_buf(BlockBackend *blk, void *host, size_t size)
25842590
{
2591+
BlockDriverState *bs = blk_bs(blk);
2592+
25852593
GLOBAL_STATE_CODE();
2586-
bdrv_unregister_buf(blk_bs(blk), host, size);
2594+
2595+
if (bs) {
2596+
bdrv_unregister_buf(bs, host, size);
2597+
}
25872598
}
25882599

25892600
int coroutine_fn blk_co_copy_range(BlockBackend *blk_in, int64_t off_in,

configure

+1-1
Original file line numberDiff line numberDiff line change
@@ -1807,7 +1807,7 @@ fi
18071807
# functions to probe cross compilers
18081808

18091809
container="no"
1810-
if test $use_containers = "yes"; then
1810+
if test $use_containers = "yes" && (has "docker" || has "podman"); then
18111811
case $($python "$source_path"/tests/docker/docker.py probe) in
18121812
*docker) container=docker ;;
18131813
podman) container=podman ;;

cpu.c

+12-1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ void libafl_flush_jit(void);
9898

9999
extern CPUState* libafl_breakpoint_cpu;
100100

101+
extern int libafl_restoring_devices;
102+
101103
/*
102104
void* libafl_qemu_g2h(CPUState *cpu, target_ulong x);
103105
target_ulong libafl_qemu_h2g(CPUState *cpu, void* x);
@@ -348,7 +350,15 @@ static int cpu_common_post_load(void *opaque, int version_id)
348350
* memory we've translated code from. So we must flush all TBs,
349351
* which will now be stale.
350352
*/
351-
tb_flush(cpu);
353+
//tb_flush(cpu);
354+
355+
//// --- Begin LibAFL code ---
356+
357+
// flushing the TBs every restore makes it really slow
358+
// TODO handle writes to X code with specific calls to tb_invalidate_phys_addr
359+
if (!libafl_restoring_devices) tb_flush(cpu);
360+
361+
//// --- End LibAFL code ---
352362

353363
return 0;
354364
}
@@ -610,6 +620,7 @@ void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs)
610620

611621
void libafl_breakpoint_invalidate(CPUState *cpu, target_ulong pc)
612622
{
623+
// TODO invalidate only the virtual pages related to the TB
613624
tb_flush(cpu);
614625
}
615626

docs/devel/code-of-conduct.rst

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _code_of_conduct:
2+
13
Code of Conduct
24
===============
35

docs/devel/index-process.rst

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Notes about how to interact with the community and how and where to submit patch
88

99
code-of-conduct
1010
conflict-resolution
11+
maintainers
1112
style
1213
submitting-a-patch
1314
trivial-patches

0 commit comments

Comments
 (0)