diff options
-rw-r--r-- | MAINTAINERS | 61 | ||||
-rw-r--r-- | hw/display/artist.c | 8 | ||||
-rw-r--r-- | hw/display/meson.build | 3 | ||||
-rw-r--r-- | hw/display/vga-isa.c | 10 | ||||
-rw-r--r-- | hw/display/virtio-gpu-udmabuf-stubs.c (renamed from stubs/virtio-gpu-udmabuf.c) | 0 | ||||
-rw-r--r-- | hw/display/virtio-gpu.c | 2 | ||||
-rw-r--r-- | hw/display/xlnx_dp.c | 6 | ||||
-rw-r--r-- | hw/usb/desc-msos.c | 10 | ||||
-rw-r--r-- | hw/usb/desc.h | 2 | ||||
-rw-r--r-- | hw/usb/dev-audio.c | 4 | ||||
-rw-r--r-- | hw/usb/dev-uas.c | 11 | ||||
-rw-r--r-- | hw/usb/host-libusb.c | 2 | ||||
-rw-r--r-- | hw/usb/quirks-ftdi-ids.h | 4 | ||||
-rw-r--r-- | hw/usb/u2f-emulated.c | 2 | ||||
-rw-r--r-- | include/ui/console.h | 2 | ||||
-rw-r--r-- | stubs/meson.build | 1 | ||||
-rw-r--r-- | tests/qtest/fuzz-xlnx-dp-test.c | 33 | ||||
-rw-r--r-- | tests/qtest/meson.build | 1 | ||||
-rw-r--r-- | ui/meson.build | 6 | ||||
-rw-r--r-- | ui/udmabuf.c | 11 |
20 files changed, 139 insertions, 40 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index f9d843ce0a..c8221650b8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1662,6 +1662,16 @@ F: hw/net/opencores_eth.c Devices ------- +Overall Audio frontends +M: Gerd Hoffmann <kraxel@redhat.com> +S: Odd Fixes +F: hw/audio/ +F: include/hw/audio/ +F: tests/qtest/ac97-test.c +F: tests/qtest/es1370-test.c +F: tests/qtest/intel-hda-test.c +F: tests/qtest/fuzz-sb16-test.c + Xilinx CAN M: Vikram Garhwal <fnu.vikram@xilinx.com> M: Francisco Iglesias <francisco.iglesias@xilinx.com> @@ -2263,17 +2273,54 @@ F: include/net/can_*.h Subsystems ---------- -Audio +Overall Audio backends M: Gerd Hoffmann <kraxel@redhat.com> S: Odd Fixes F: audio/ -F: hw/audio/ -F: include/hw/audio/ +X: audio/alsaaudio.c +X: audio/coreaudio.c +X: audio/dsound* +X: audio/jackaudio.c +X: audio/ossaudio.c +X: audio/paaudio.c +X: audio/sdlaudio.c +X: audio/spiceaudio.c F: qapi/audio.json -F: tests/qtest/ac97-test.c -F: tests/qtest/es1370-test.c -F: tests/qtest/intel-hda-test.c -F: tests/qtest/fuzz-sb16-test.c + +ALSA Audio backend +M: Gerd Hoffmann <kraxel@redhat.com> +S: Odd Fixes +F: audio/alsaaudio.c + +Core Audio framework backend +M: Gerd Hoffmann <kraxel@redhat.com> +S: Odd Fixes +F: audio/coreaudio.c + +DSound Audio backend +M: Gerd Hoffmann <kraxel@redhat.com> +S: Odd Fixes +F: audio/dsound* + +JACK Audio Connection Kit backend +M: Gerd Hoffmann <kraxel@redhat.com> +S: Odd Fixes +F: audio/jackaudio.c + +Open Sound System (OSS) Audio backend +M: Gerd Hoffmann <kraxel@redhat.com> +S: Odd Fixes +F: audio/ossaudio.c + +PulseAudio backend +M: Gerd Hoffmann <kraxel@redhat.com> +S: Odd Fixes +F: audio/paaudio.c + +SDL Audio backend +M: Gerd Hoffmann <kraxel@redhat.com> +S: Odd Fixes +F: audio/sdlaudio.c Block layer core M: Kevin Wolf <kwolf@redhat.com> diff --git a/hw/display/artist.c b/hw/display/artist.c index aa7bd594aa..21b7fd1b44 100644 --- a/hw/display/artist.c +++ b/hw/display/artist.c @@ -1170,8 +1170,8 @@ static void artist_vram_write(void *opaque, hwaddr addr, uint64_t val, } buf = vram_write_buffer(s); - posy = ADDR_TO_Y(addr); - posx = ADDR_TO_X(addr); + posy = ADDR_TO_Y(addr >> 2); + posx = ADDR_TO_X(addr >> 2); if (!buf->size) { return; @@ -1232,8 +1232,8 @@ static uint64_t artist_vram_read(void *opaque, hwaddr addr, unsigned size) return 0; } - posy = ADDR_TO_Y(addr); - posx = ADDR_TO_X(addr); + posy = ADDR_TO_Y(addr >> 2); + posx = ADDR_TO_X(addr >> 2); if (posy > buf->height || posx > buf->width) { return 0; diff --git a/hw/display/meson.build b/hw/display/meson.build index 1e6b707d3c..861c43ff98 100644 --- a/hw/display/meson.build +++ b/hw/display/meson.build @@ -56,7 +56,8 @@ if config_all_devices.has_key('CONFIG_VIRTIO_GPU') virtio_gpu_ss = ss.source_set() virtio_gpu_ss.add(when: 'CONFIG_VIRTIO_GPU', if_true: [files('virtio-gpu-base.c', 'virtio-gpu.c'), pixman]) - virtio_gpu_ss.add(when: 'CONFIG_LINUX', if_true: files('virtio-gpu-udmabuf.c')) + virtio_gpu_ss.add(when: 'CONFIG_LINUX', if_true: files('virtio-gpu-udmabuf.c'), + if_false: files('virtio-gpu-udmabuf-stubs.c')) virtio_gpu_ss.add(when: 'CONFIG_VHOST_USER_GPU', if_true: files('vhost-user-gpu.c')) hw_display_modules += {'virtio-gpu': virtio_gpu_ss} diff --git a/hw/display/vga-isa.c b/hw/display/vga-isa.c index 90851e730b..8cea84f2be 100644 --- a/hw/display/vga-isa.c +++ b/hw/display/vga-isa.c @@ -33,6 +33,7 @@ #include "hw/loader.h" #include "hw/qdev-properties.h" #include "qom/object.h" +#include "qapi/error.h" #define TYPE_ISA_VGA "isa-vga" OBJECT_DECLARE_SIMPLE_TYPE(ISAVGAState, ISA_VGA) @@ -61,6 +62,15 @@ static void vga_isa_realizefn(DeviceState *dev, Error **errp) MemoryRegion *vga_io_memory; const MemoryRegionPortio *vga_ports, *vbe_ports; + /* + * make sure this device is not being added twice, if so + * exit without crashing qemu + */ + if (object_resolve_path_type("", TYPE_ISA_VGA, NULL)) { + error_setg(errp, "at most one %s device is permitted", TYPE_ISA_VGA); + return; + } + s->global_vmstate = true; vga_common_init(s, OBJECT(dev)); s->legacy_address_space = isa_address_space(isadev); diff --git a/stubs/virtio-gpu-udmabuf.c b/hw/display/virtio-gpu-udmabuf-stubs.c index 81f661441a..81f661441a 100644 --- a/stubs/virtio-gpu-udmabuf.c +++ b/hw/display/virtio-gpu-udmabuf-stubs.c diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 990e71fd40..72da5bf500 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -362,7 +362,7 @@ static void virtio_gpu_resource_create_blob(VirtIOGPU *g, ret = virtio_gpu_create_mapping_iov(g, cblob.nr_entries, sizeof(cblob), cmd, &res->addrs, &res->iov, &res->iov_cnt); - if (ret != 0 || res->iov) { + if (ret != 0) { cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC; g_free(res); return; diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c index 2bb7a5441a..9bb781e312 100644 --- a/hw/display/xlnx_dp.c +++ b/hw/display/xlnx_dp.c @@ -714,7 +714,11 @@ static uint64_t xlnx_dp_read(void *opaque, hwaddr offset, unsigned size) break; default: assert(offset <= (0x3AC >> 2)); - ret = s->core_registers[offset]; + if (offset == (0x3A8 >> 2) || offset == (0x3AC >> 2)) { + ret = s->core_registers[DP_INT_MASK]; + } else { + ret = s->core_registers[offset]; + } break; } diff --git a/hw/usb/desc-msos.c b/hw/usb/desc-msos.c index 836e38c67e..c72c65b650 100644 --- a/hw/usb/desc-msos.c +++ b/hw/usb/desc-msos.c @@ -5,12 +5,12 @@ /* * Microsoft OS Descriptors * - * Windows tries to fetch some special descriptors with informations + * Windows tries to fetch some special descriptors with information * specifically for windows. Presence is indicated using a special * string @ index 0xee. There are two kinds of descriptors: * * compatid descriptor - * Used to bind drivers, if usb class isn't specific enougth. + * Used to bind drivers, if usb class isn't specific enough. * Used for PTP/MTP for example (both share the same usb class). * * properties descriptor @@ -23,7 +23,7 @@ * HLM\SYSTEM\CurrentControlSet\Control\usbflags * HLM\SYSTEM\CurrentControlSet\Enum\USB * Windows will complain it can't delete entries on the second one. - * It has deleted everything it had permissions too, which is enouth + * It has deleted everything it had permissions too, which is enough * as this includes "Device Parameters". * * http://msdn.microsoft.com/en-us/library/windows/hardware/ff537430.aspx @@ -192,8 +192,8 @@ static int usb_desc_msos_prop(const USBDesc *desc, uint8_t *dest) if (desc->msos->SelectiveSuspendEnabled) { /* * Signaling remote wakeup capability in the standard usb - * descriptors isn't enouth to make windows actually use it. - * This is the "Yes, we really mean it" registy entry to flip + * descriptors isn't enough to make windows actually use it. + * This is the "Yes, we really mean it" registry entry to flip * the switch in the windows drivers. */ length += usb_desc_msos_prop_dword(dest+length, diff --git a/hw/usb/desc.h b/hw/usb/desc.h index 4d81c68e0e..3ac604ecfa 100644 --- a/hw/usb/desc.h +++ b/hw/usb/desc.h @@ -133,7 +133,7 @@ struct USBDescConfig { const USBDescIface *ifs; }; -/* conceptually an Interface Association Descriptor, and releated interfaces */ +/* conceptually an Interface Association Descriptor, and related interfaces */ struct USBDescIfaceAssoc { uint8_t bFirstInterface; uint8_t bInterfaceCount; diff --git a/hw/usb/dev-audio.c b/hw/usb/dev-audio.c index f5cb246792..8748c1ba04 100644 --- a/hw/usb/dev-audio.c +++ b/hw/usb/dev-audio.c @@ -168,7 +168,7 @@ static const USBDescIface desc_iface[] = { STRING_FEATURE_UNIT, /* u8 iFeature */ } },{ - /* Headphone Ouptut Terminal ID3 Descriptor */ + /* Headphone Output Terminal ID3 Descriptor */ .data = (uint8_t[]) { 0x09, /* u8 bLength */ USB_DT_CS_INTERFACE, /* u8 bDescriptorType */ @@ -332,7 +332,7 @@ static const USBDescIface desc_iface_multi[] = { STRING_FEATURE_UNIT, /* u8 iFeature */ } },{ - /* Headphone Ouptut Terminal ID3 Descriptor */ + /* Headphone Output Terminal ID3 Descriptor */ .data = (uint8_t[]) { 0x09, /* u8 bLength */ USB_DT_CS_INTERFACE, /* u8 bDescriptorType */ diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c index 263056231c..f6309a5ebf 100644 --- a/hw/usb/dev-uas.c +++ b/hw/usb/dev-uas.c @@ -840,6 +840,9 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p) } break; case UAS_PIPE_ID_STATUS: + if (p->stream > UAS_MAX_STREAMS) { + goto err_stream; + } if (p->stream) { QTAILQ_FOREACH(st, &uas->results, next) { if (st->stream == p->stream) { @@ -867,6 +870,9 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p) break; case UAS_PIPE_ID_DATA_IN: case UAS_PIPE_ID_DATA_OUT: + if (p->stream > UAS_MAX_STREAMS) { + goto err_stream; + } if (p->stream) { req = usb_uas_find_request(uas, p->stream); } else { @@ -902,6 +908,11 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p) p->status = USB_RET_STALL; break; } + +err_stream: + error_report("%s: invalid stream %d", __func__, p->stream); + p->status = USB_RET_STALL; + return; } static void usb_uas_unrealize(USBDevice *dev) diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c index 00f6fbb29b..d0d46dd0a4 100644 --- a/hw/usb/host-libusb.c +++ b/hw/usb/host-libusb.c @@ -1706,7 +1706,7 @@ static void usb_host_free_streams(USBDevice *udev, USBEndpoint **eps, /* * This is *NOT* about restoring state. We have absolutely no idea * what state the host device is in at the moment and whenever it is - * still present in the first place. Attemping to contine where we + * still present in the first place. Attempting to continue where we * left off is impossible. * * What we are going to do here is emulate a surprise removal of diff --git a/hw/usb/quirks-ftdi-ids.h b/hw/usb/quirks-ftdi-ids.h index 01aca55ca7..f3cb157d6f 100644 --- a/hw/usb/quirks-ftdi-ids.h +++ b/hw/usb/quirks-ftdi-ids.h @@ -625,9 +625,9 @@ * Definitions for Icom Inc. devices */ #define ICOM_VID 0x0C26 /* Icom vendor ID */ -/* Note: ID-1 is a communications tranceiver for HAM-radio operators */ +/* Note: ID-1 is a communications transceiver for HAM-radio operators */ #define ICOM_ID_1_PID 0x0004 /* ID-1 USB to RS-232 */ -/* Note: OPC is an Optional cable to connect an Icom Tranceiver */ +/* Note: OPC is an Optional cable to connect an Icom Transceiver */ #define ICOM_OPC_U_UC_PID 0x0018 /* OPC-478UC, OPC-1122U cloning cable */ /* Note: ID-RP* devices are Icom Repeater Devices for HAM-radio */ #define ICOM_ID_RP2C1_PID 0x0009 /* ID-RP2C Asset 1 to RS-232 */ diff --git a/hw/usb/u2f-emulated.c b/hw/usb/u2f-emulated.c index 9151feb63d..63cceaa5fc 100644 --- a/hw/usb/u2f-emulated.c +++ b/hw/usb/u2f-emulated.c @@ -307,7 +307,7 @@ static void u2f_emulated_realize(U2FKeyState *base, Error **errp) rc = u2f_emulated_setup_vdev_manualy(key); } else { error_setg(errp, "%s: cert, priv, entropy and counter " - "parameters must be provided to manualy configure " + "parameters must be provided to manually configure " "the emulated device", TYPE_U2F_EMULATED); return; } diff --git a/include/ui/console.h b/include/ui/console.h index b30b63976a..3be21497a2 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -471,7 +471,9 @@ bool vnc_display_reload_certs(const char *id, Error **errp); /* input.c */ int index_from_key(const char *key, size_t key_length); +#ifdef CONFIG_LINUX /* udmabuf.c */ int udmabuf_fd(void); +#endif #endif diff --git a/stubs/meson.build b/stubs/meson.build index 717bfa9a99..275ac89c16 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -52,7 +52,6 @@ if have_system stub_ss.add(files('semihost.c')) stub_ss.add(files('usb-dev-stub.c')) stub_ss.add(files('xen-hw-stub.c')) - stub_ss.add(files('virtio-gpu-udmabuf.c')) else stub_ss.add(files('qdev.c')) endif diff --git a/tests/qtest/fuzz-xlnx-dp-test.c b/tests/qtest/fuzz-xlnx-dp-test.c new file mode 100644 index 0000000000..69eb6c0eb1 --- /dev/null +++ b/tests/qtest/fuzz-xlnx-dp-test.c @@ -0,0 +1,33 @@ +/* + * QTest fuzzer-generated testcase for xlnx-dp display device + * + * Copyright (c) 2021 Qiang Liu <cyruscyliu@gmail.com> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "libqos/libqtest.h" + +/* + * This used to trigger the out-of-bounds read in xlnx_dp_read + */ +static void test_fuzz_xlnx_dp_0x3ac(void) +{ + QTestState *s = qtest_init("-M xlnx-zcu102 -display none "); + qtest_readl(s, 0xfd4a03ac); + qtest_quit(s); +} + +int main(int argc, char **argv) +{ + const char *arch = qtest_get_arch(); + + g_test_init(&argc, &argv, NULL); + + if (strcmp(arch, "aarch64") == 0) { + qtest_add_func("fuzz/test_fuzz_xlnx_dp/3ac", test_fuzz_xlnx_dp_0x3ac); + } + + return g_test_run(); +} diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 2bc3efd49f..757bb8499a 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -187,6 +187,7 @@ qtests_aarch64 = \ 'numa-test', 'boot-serial-test', 'xlnx-can-test', + 'fuzz-xlnx-dp-test', 'migration-test'] qtests_s390x = \ diff --git a/ui/meson.build b/ui/meson.build index a3a187d633..7d25c1b95b 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -12,12 +12,14 @@ softmmu_ss.add(files( 'kbd-state.c', 'keymaps.c', 'qemu-pixman.c', - 'udmabuf.c', )) softmmu_ss.add([spice_headers, files('spice-module.c')]) softmmu_ss.add(when: spice_protocol, if_true: files('vdagent.c')) -softmmu_ss.add(when: 'CONFIG_LINUX', if_true: files('input-linux.c')) +softmmu_ss.add(when: 'CONFIG_LINUX', if_true: files( + 'input-linux.c', + 'udmabuf.c', +)) softmmu_ss.add(when: cocoa, if_true: files('cocoa.m')) vnc_ss = ss.source_set() diff --git a/ui/udmabuf.c b/ui/udmabuf.c index 23abe1e7eb..cebceb2610 100644 --- a/ui/udmabuf.c +++ b/ui/udmabuf.c @@ -8,8 +8,6 @@ #include "qapi/error.h" #include "ui/console.h" -#ifdef CONFIG_LINUX - #include <fcntl.h> #include <sys/ioctl.h> @@ -29,12 +27,3 @@ int udmabuf_fd(void) } return udmabuf; } - -#else - -int udmabuf_fd(void) -{ - return -1; -} - -#endif |