diff --git a/kvm-Fix-use-afte-free-in-ip_reass-CVE-2020-1983.patch b/kvm-Fix-use-afte-free-in-ip_reass-CVE-2020-1983.patch new file mode 100644 index 0000000000000000000000000000000000000000..86b584170ddec18fd9854134d928e63fe803a7b8 --- /dev/null +++ b/kvm-Fix-use-afte-free-in-ip_reass-CVE-2020-1983.patch @@ -0,0 +1,73 @@ +From 172ca2ea0735849d004be7ff27dd3e79f79ce00e Mon Sep 17 00:00:00 2001 +From: Jon Maloy +Date: Sat, 20 Jun 2020 13:30:54 -0400 +Subject: [PATCH 1/3] Fix use-afte-free in ip_reass() (CVE-2020-1983) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Jon Maloy +Message-id: <20200620133054.3334982-2-jmaloy@redhat.com> +Patchwork-id: 97673 +O-Subject: [RHEL-7.9 qemu-kvm PATCH 1/1] Fix use-afte-free in ip_reass() (CVE-2020-1983) +Bugzilla: 1837565 +RH-Acked-by: Thomas Huth +RH-Acked-by: Stefano Garzarella +RH-Acked-by: Stefan Hajnoczi + +From: Marc-André Lureau + +The q pointer is updated when the mbuf data is moved from m_dat to +m_ext. + +m_ext buffer may also be realloc()'ed and moved during m_cat(): +q should also be updated in this case. + +Reported-by: Aviv Sasson +Signed-off-by: Marc-André Lureau +Reviewed-by: Samuel Thibault + +(cherry picked from libslirp commit 9bd6c5913271eabcb7768a58197ed3301fe19f2d) +Conflicts: + - Fixed indentation issues +Signed-off-by: Jon Maloy +Signed-off-by: Jon Maloy +--- + slirp/ip_input.c | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +diff --git a/slirp/ip_input.c b/slirp/ip_input.c +index 9e95b40e97..011f01ed71 100644 +--- a/slirp/ip_input.c ++++ b/slirp/ip_input.c +@@ -329,10 +329,10 @@ insert: + /* + * Reassembly is complete; concatenate fragments. + */ +- q = fp->frag_link.next; ++ q = fp->frag_link.next; + m = dtom(slirp, q); + +- int was_ext = m->m_flags & M_EXT; ++ int delta = (char *)q - (m->m_flags & M_EXT ? m->m_ext : m->m_dat); + + q = (struct ipasfrag *) q->ipf_next; + while (q != (struct ipasfrag*)&fp->frag_link) { +@@ -356,12 +356,11 @@ insert: + * the old buffer (in the mbuf), so we must point ip + * into the new buffer. + */ +- if (!was_ext && m->m_flags & M_EXT) { +- int delta = (char *)q - m->m_dat; ++ if (m->m_flags & M_EXT) { + q = (struct ipasfrag *)(m->m_ext + delta); + } + +- ip = fragtoip(q); ++ ip = fragtoip(q); + ip->ip_len = next; + ip->ip_tos &= ~1; + ip->ip_src = fp->ipq_src; +-- +2.18.2 + diff --git a/kvm-Suppress-prototype-warning-for-nss-headers.patch b/kvm-Suppress-prototype-warning-for-nss-headers.patch new file mode 100644 index 0000000000000000000000000000000000000000..1215d243f2d36812b36dfdb4e85b4127bfbac224 --- /dev/null +++ b/kvm-Suppress-prototype-warning-for-nss-headers.patch @@ -0,0 +1,100 @@ +From 10f48326f30ae89bea01124bdbab4702a21f3655 Mon Sep 17 00:00:00 2001 +From: Miroslav Rezanina +Date: Thu, 3 Dec 2020 11:17:02 -0500 +Subject: [PATCH] Suppress prototype warning for nss headers +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Miroslav Rezanina +Message-id: <20201203111702.215084-1-mrezanin@redhat.com> +Patchwork-id: 100201 +O-Subject: [RHEL-7.9.z qemu-kvm PATCH] Suppress prototype warning for nss headers +Bugzilla: 1884997 +RH-Acked-by: Thomas Huth +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Jon Maloy + +From: Miroslav Rezanina + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1884997 +Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=33460150 +branch: rhel79/master +Upstream: n/a + +Rebase of nss introduced following warning when using it for building qemu-kvm: + +/usr/include/nss3/pk11pub.h:951:1: error: function declaration isn’t a prototype [-Werror=strict-prototypes] +int SECMOD_GetSystemFIPSEnabled(); + +This issue is tracked by https://bugzilla.redhat.com/show_bug.cgi?id=1885321. However, +this issue is not important enough to fix (as discussed in the bugzilla). + +We have to hack qemu-kvm to live with this warning. To do it we add following hacks: + +1) We disable using -Werror for nss test in configure. This allows configure to pass. + +2) We disable -Werror=scrict-prototypes when including nss headers. This allows build to pass. + +Signed-off-by: Miroslav Rezanina +Signed-off-by: Jon Maloy +--- + configure | 13 ++++++------- + libcacard/vcard_emul_nss.c | 8 ++++++++ + 2 files changed, 14 insertions(+), 7 deletions(-) + +diff --git a/configure b/configure +index 34e3accfdd..77c2f0a438 100755 +--- a/configure ++++ b/configure +@@ -3246,13 +3246,11 @@ EOF + libcacard_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs" + libcacard_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags" + test_cflags="$libcacard_cflags" +- # The header files in nss < 3.13.3 have a bug which causes them to +- # emit a warning. If we're going to compile QEMU with -Werror, then +- # test that the headers don't have this bug. Otherwise we would pass +- # the configure test but fail to compile QEMU later. +- if test "$werror" = "yes"; then +- test_cflags="-Werror $test_cflags" +- fi ++ # nss > 3.53 generates warning when including it's headers. This breaks the ++ # build so we have to disable -Werror for build test. ++ # See https://bugzilla.redhat.com/show_bug.cgi?id=1885321 ++ old_werror=$werror ++ werror=no + if test -n "$libtool" && + $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 && \ + compile_prog "$test_cflags" "$libcacard_libs"; then +@@ -3266,6 +3264,7 @@ EOF + fi + smartcard_nss="no" + fi ++ werror=$old_werror + fi + + # check for libusb +diff --git a/libcacard/vcard_emul_nss.c b/libcacard/vcard_emul_nss.c +index 1a3e5683bc..f1aa51943b 100644 +--- a/libcacard/vcard_emul_nss.c ++++ b/libcacard/vcard_emul_nss.c +@@ -17,8 +17,16 @@ + /* avoid including prototypes.h that redefines uint32 */ + #define NO_NSPR_10_SUPPORT + ++/* ++ * nss > 3.53 genererates prototype warning when including headers so we can't ++ * treat this warning ass error to allow build. ++ * See https://bugzilla.redhat.com/show_bug.cgi?id=1885321 ++ */ ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Wstrict-prototypes" + #include + #include ++#pragma GCC diagnostic pop + #include + #include + #include +-- +2.18.2 + diff --git a/kvm-hw-core-loader-Fix-possible-crash-in-rom_copy.patch b/kvm-hw-core-loader-Fix-possible-crash-in-rom_copy.patch new file mode 100644 index 0000000000000000000000000000000000000000..b944555067af04e66421db9cba4201cb33d6b58b --- /dev/null +++ b/kvm-hw-core-loader-Fix-possible-crash-in-rom_copy.patch @@ -0,0 +1,59 @@ +From af9348b27b8bc0c7033527220e7840f4b3209832 Mon Sep 17 00:00:00 2001 +From: Jon Maloy +Date: Tue, 6 Oct 2020 18:00:53 -0400 +Subject: [PATCH 2/2] hw/core/loader: Fix possible crash in rom_copy() + +RH-Author: Jon Maloy +Message-id: <20201006180053.484822-2-jmaloy@redhat.com> +Patchwork-id: 98552 +O-Subject: [RHEL-7.9.z qemu-kvm PATCH 1/1] hw/core/loader: Fix possible crash in rom_copy() +Bugzilla: 1842923 +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Markus Armbruster +RH-Acked-by: Thomas Huth + +From: Thomas Huth + +Both, "rom->addr" and "addr" are derived from the binary image +that can be loaded with the "-kernel" paramer. The code in +rom_copy() then calculates: + + d = dest + (rom->addr - addr); + +and uses "d" as destination in a memcpy() some lines later. Now with +bad kernel images, it is possible that rom->addr is smaller than addr, +thus "rom->addr - addr" gets negative and the memcpy() then tries to +copy contents from the image to a bad memory location. This could +maybe be used to inject code from a kernel image into the QEMU binary, +so we better fix it with an additional sanity check here. + +Cc: qemu-stable@nongnu.org +Reported-by: Guangming Liu +Buglink: https://bugs.launchpad.net/qemu/+bug/1844635 +Message-Id: <20190925130331.27825-1-thuth@redhat.com> +Reviewed-by: Michael S. Tsirkin +Signed-off-by: Thomas Huth + +(cherry picked from commit e423455c4f23a1a828901c78fe6d03b7dde79319) +Signed-off-by: Jon Maloy +Signed-off-by: Jon Maloy +--- + hw/core/loader.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/hw/core/loader.c b/hw/core/loader.c +index 5a15449407..939d0855cb 100644 +--- a/hw/core/loader.c ++++ b/hw/core/loader.c +@@ -841,7 +841,7 @@ int rom_copy(uint8_t *dest, hwaddr addr, size_t size) + if (rom->addr + rom->romsize < addr) { + continue; + } +- if (rom->addr > end) { ++ if (rom->addr > end || rom->addr < addr) { + break; + } + +-- +2.18.2 + diff --git a/kvm-hw-net-vmxnet_tx_pkt-fix-assertion-failure-in-vmxnet.patch b/kvm-hw-net-vmxnet_tx_pkt-fix-assertion-failure-in-vmxnet.patch new file mode 100644 index 0000000000000000000000000000000000000000..441dcd6d4b5d17d8314d558decfcbf82d0a019f9 --- /dev/null +++ b/kvm-hw-net-vmxnet_tx_pkt-fix-assertion-failure-in-vmxnet.patch @@ -0,0 +1,55 @@ +From 1b5e283b804f9d650e1c96a3a97bd690876ac0aa Mon Sep 17 00:00:00 2001 +From: Jon Maloy +Date: Mon, 28 Sep 2020 20:05:20 -0400 +Subject: [PATCH 1/2] hw/net/vmxnet_tx_pkt: fix assertion failure in + vmxnet_tx_pkt_add_raw_fragment() + +RH-Author: Jon Maloy +Message-id: <20200928200520.1045037-2-jmaloy@redhat.com> +Patchwork-id: 98500 +O-Subject: [RHEL-7.9.z qemu-kvm PATCH 1/1] hw/net/vmxnet_tx_pkt: fix assertion failure in vmxnet_tx_pkt_add_raw_fragment() +Bugzilla: 1860960 +RH-Acked-by: Laszlo Ersek +RH-Acked-by: Stefan Hajnoczi +RH-Acked-by: Michael S. Tsirkin + +An assertion failure issue was found in the code that processes network packets +while adding data fragments into the packet context. It could be abused by a +malicious guest to abort the QEMU process on the host. This patch replaces the +affected assert() with a conditional statement, returning false if the current +data fragment exceeds max_raw_frags. + +Reported-by: Alexander Bulekov +Reported-by: Ziming Zhang +Reviewed-by: Dmitry Fleytman +Signed-off-by: Mauro Matteo Cascella +Signed-off-by: Jason Wang + +(cherry picked from commit 035e69b063835a5fd23cacabd63690a3d84532a8) +Manually adapted since the affected function is located in a different +file and has a different name. +Signed-off-by: Jon Maloy +Signed-off-by: Jon Maloy +--- + hw/net/vmxnet_tx_pkt.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/hw/net/vmxnet_tx_pkt.c b/hw/net/vmxnet_tx_pkt.c +index 03f34cf86f..cbb309e8a9 100644 +--- a/hw/net/vmxnet_tx_pkt.c ++++ b/hw/net/vmxnet_tx_pkt.c +@@ -330,7 +330,10 @@ bool vmxnet_tx_pkt_add_raw_fragment(struct VmxnetTxPkt *pkt, hwaddr pa, + hwaddr mapped_len = 0; + struct iovec *ventry; + assert(pkt); +- assert(pkt->max_raw_frags > pkt->raw_frags); ++ ++ if (pkt->raw_frags >= pkt->max_raw_frags) { ++ return false; ++ } + + if (!len) { + return true; +-- +2.18.2 + diff --git a/kvm-ide-atapi-check-logical-block-address-and-read-size-.patch b/kvm-ide-atapi-check-logical-block-address-and-read-size-.patch new file mode 100644 index 0000000000000000000000000000000000000000..5309cfa866895ea0a664ed7b064ec91b5af4f025 --- /dev/null +++ b/kvm-ide-atapi-check-logical-block-address-and-read-size-.patch @@ -0,0 +1,122 @@ +From dc4ff14029538f4f2787271b98d6e8e403cbfcc5 Mon Sep 17 00:00:00 2001 +From: Jon Maloy +Date: Fri, 26 Feb 2021 01:06:42 -0500 +Subject: [PATCH] ide: atapi: check logical block address and read size + (CVE-2020-29443) + +RH-Author: Jon Maloy +Message-id: <20210226010642.3200257-2-jmaloy@redhat.com> +Patchwork-id: 101270 +O-Subject: [RHEL-7.9.z qemu-kvm PATCH v2 1/1] ide: atapi: check logical block address and read size (CVE-2020-29443) +Bugzilla: 1917449 +RH-Acked-by: Kevin Wolf +RH-Acked-by: Danilo de Paula +RH-Acked-by: Paolo Bonzini + +From: Prasad J Pandit + +While processing ATAPI cmd_read/cmd_read_cd commands, +Logical Block Address (LBA) maybe invalid OR closer to the last block, +leading to an OOB access issues. Add range check to avoid it. + +Fixes: CVE-2020-29443 +Reported-by: Wenxiang Qian +Suggested-by: Paolo Bonzini +Reviewed-by: Paolo Bonzini +Signed-off-by: Prasad J Pandit +Message-Id: <20210118115130.457044-1-ppandit@redhat.com> +Signed-off-by: Paolo Bonzini + +(cherry picked from commit b8d7f1bc59276fec85e4d09f1567613a3e14d31e) +Conflict: There is a conflict in cmd_read_cd(), because +commit e7bd708ec85e ("atapi: classify read_cd as conditionally +returning data") is missing in this code version. That seems to be an +unrelated fix that drags in further changes, so instead of applying it +we choose to adapt the commit directly to the current code version. +Signed-off-by: Jon Maloy +Signed-off-by: Jon Maloy +--- + hw/ide/atapi.c | 29 ++++++++++++++++++++++++----- + 1 file changed, 24 insertions(+), 5 deletions(-) + +diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c +index 490070a1b4..bef74914d1 100644 +--- a/hw/ide/atapi.c ++++ b/hw/ide/atapi.c +@@ -267,6 +267,8 @@ static void ide_atapi_cmd_reply(IDEState *s, int size, int max_size) + static void ide_atapi_cmd_read_pio(IDEState *s, int lba, int nb_sectors, + int sector_size) + { ++ assert(0 <= lba && lba < (s->nb_sectors >> 2)); ++ + s->lba = lba; + s->packet_transfer_size = nb_sectors * sector_size; + s->elementary_transfer_size = 0; +@@ -365,6 +367,8 @@ eot: + static void ide_atapi_cmd_read_dma(IDEState *s, int lba, int nb_sectors, + int sector_size) + { ++ assert(0 <= lba && lba < (s->nb_sectors >> 2)); ++ + s->lba = lba; + s->packet_transfer_size = nb_sectors * sector_size; + s->io_buffer_index = 0; +@@ -823,7 +827,10 @@ static void cmd_prevent_allow_medium_removal(IDEState *s, uint8_t* buf) + + static void cmd_read(IDEState *s, uint8_t* buf) + { +- int nb_sectors, lba; ++ unsigned int nb_sectors, lba; ++ ++ /* Total logical sectors of ATAPI_SECTOR_SIZE(=2048) bytes */ ++ uint64_t total_sectors = s->nb_sectors >> 2; + + if (buf[0] == GPCMD_READ_10) { + nb_sectors = ube16_to_cpu(buf + 7); +@@ -831,27 +838,39 @@ static void cmd_read(IDEState *s, uint8_t* buf) + nb_sectors = ube32_to_cpu(buf + 6); + } + +- lba = ube32_to_cpu(buf + 2); + if (nb_sectors == 0) { + ide_atapi_cmd_ok(s); + return; + } + ++ lba = ldl_be_p(buf + 2); ++ if (lba >= total_sectors || lba + nb_sectors - 1 >= total_sectors) { ++ ide_atapi_cmd_error(s, ILLEGAL_REQUEST, ASC_LOGICAL_BLOCK_OOR); ++ return; ++ } ++ + ide_atapi_cmd_read(s, lba, nb_sectors, 2048); + } + + static void cmd_read_cd(IDEState *s, uint8_t* buf) + { +- int nb_sectors, lba, transfer_request; ++ unsigned int nb_sectors, lba, transfer_request; + +- nb_sectors = (buf[6] << 16) | (buf[7] << 8) | buf[8]; +- lba = ube32_to_cpu(buf + 2); ++ /* Total logical sectors of ATAPI_SECTOR_SIZE(=2048) bytes */ ++ uint64_t total_sectors = s->nb_sectors >> 2; + ++ nb_sectors = (buf[6] << 16) | (buf[7] << 8) | buf[8]; + if (nb_sectors == 0) { + ide_atapi_cmd_ok(s); + return; + } + ++ lba = ldl_be_p(buf + 2); ++ if (lba >= total_sectors || lba + nb_sectors - 1 >= total_sectors) { ++ ide_atapi_cmd_error(s, ILLEGAL_REQUEST, ASC_LOGICAL_BLOCK_OOR); ++ return; ++ } ++ + transfer_request = buf[9]; + switch(transfer_request & 0xf8) { + case 0x00: +-- +2.18.2 + diff --git a/kvm-usb-check-RNDIS-message-length.patch b/kvm-usb-check-RNDIS-message-length.patch new file mode 100644 index 0000000000000000000000000000000000000000..fdeb8d3931f4dfe4888fcd50aa4ab131175bf4d4 --- /dev/null +++ b/kvm-usb-check-RNDIS-message-length.patch @@ -0,0 +1,78 @@ +From d43b55595f9f5a29ad45b6bf1c899646ef623bf9 Mon Sep 17 00:00:00 2001 +From: Jon Maloy +Date: Fri, 4 Sep 2020 16:09:12 -0400 +Subject: [PATCH 2/3] usb: check RNDIS message length + +RH-Author: Jon Maloy +Message-id: <20200904160913.87759-2-jmaloy@redhat.com> +Patchwork-id: 98289 +O-Subject: [RHEL-7.9 qemu-kvm PATCH 1/2] usb: check RNDIS message length +Bugzilla: 1869693 +RH-Acked-by: Dr. David Alan Gilbert +RH-Acked-by: Gerd Hoffmann +RH-Acked-by: Thomas Huth + +From: Prasad J Pandit + +When processing remote NDIS control message packets, the USB Net +device emulator uses a fixed length(4096) data buffer. The incoming +packet length could exceed this limit. Add a check to avoid it. + +Signed-off-by: Prasad J Pandit +Message-id: 1455648821-17340-2-git-send-email-ppandit@redhat.com +Signed-off-by: Gerd Hoffmann +(cherry picked from commit 64c9bc181fc78275596649f591302d72df2d3071) +Signed-off-by: Jon Maloy +Signed-off-by: Jon Maloy +--- + hw/usb/core.c | 18 +++++++++--------- + 1 file changed, 9 insertions(+), 9 deletions(-) + +diff --git a/hw/usb/core.c b/hw/usb/core.c +index cf34755bba..f0201e30b4 100644 +--- a/hw/usb/core.c ++++ b/hw/usb/core.c +@@ -128,9 +128,16 @@ static void do_token_setup(USBDevice *s, USBPacket *p) + } + + usb_packet_copy(p, s->setup_buf, p->iov.size); ++ s->setup_index = 0; + p->actual_length = 0; + s->setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6]; +- s->setup_index = 0; ++ if (s->setup_len > sizeof(s->data_buf)) { ++ fprintf(stderr, ++ "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n", ++ s->setup_len, sizeof(s->data_buf)); ++ p->status = USB_RET_STALL; ++ return; ++ } + + request = (s->setup_buf[0] << 8) | s->setup_buf[1]; + value = (s->setup_buf[3] << 8) | s->setup_buf[2]; +@@ -151,13 +158,6 @@ static void do_token_setup(USBDevice *s, USBPacket *p) + } + s->setup_state = SETUP_STATE_DATA; + } else { +- if (s->setup_len > sizeof(s->data_buf)) { +- fprintf(stderr, +- "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n", +- s->setup_len, sizeof(s->data_buf)); +- p->status = USB_RET_STALL; +- return; +- } + if (s->setup_len == 0) + s->setup_state = SETUP_STATE_ACK; + else +@@ -176,7 +176,7 @@ static void do_token_in(USBDevice *s, USBPacket *p) + request = (s->setup_buf[0] << 8) | s->setup_buf[1]; + value = (s->setup_buf[3] << 8) | s->setup_buf[2]; + index = (s->setup_buf[5] << 8) | s->setup_buf[4]; +- ++ + switch(s->setup_state) { + case SETUP_STATE_ACK: + if (!(s->setup_buf[0] & USB_DIR_IN)) { +-- +2.18.2 + diff --git a/kvm-usb-fix-setup_len-init-CVE-2020-14364.patch b/kvm-usb-fix-setup_len-init-CVE-2020-14364.patch new file mode 100644 index 0000000000000000000000000000000000000000..ac2625cd41c5ebb0f525f6a065711b20a71da8b6 --- /dev/null +++ b/kvm-usb-fix-setup_len-init-CVE-2020-14364.patch @@ -0,0 +1,102 @@ +From 9330e486e884f1757d6920a25c6cc491eedad0d0 Mon Sep 17 00:00:00 2001 +From: Jon Maloy +Date: Fri, 4 Sep 2020 16:09:13 -0400 +Subject: [PATCH 3/3] usb: fix setup_len init (CVE-2020-14364) + +RH-Author: Jon Maloy +Message-id: <20200904160913.87759-3-jmaloy@redhat.com> +Patchwork-id: 98291 +O-Subject: [RHEL-7.9 qemu-kvm PATCH 2/2] usb: fix setup_len init (CVE-2020-14364) +Bugzilla: 1869693 +RH-Acked-by: Dr. David Alan Gilbert +RH-Acked-by: Gerd Hoffmann +RH-Acked-by: Thomas Huth + +From: Gerd Hoffmann + +Store calculated setup_len in a local variable, verify it, and only +write it to the struct (USBDevice->setup_len) in case it passed the +sanity checks. + +This prevents other code (do_token_{in,out} functions specifically) +from working with invalid USBDevice->setup_len values and overrunning +the USBDevice->setup_buf[] buffer. + +Fixes: CVE-2020-14364 +Signed-off-by: Gerd Hoffmann +Tested-by: Gonglei +Reviewed-by: Li Qiang +Message-id: 20200825053636.29648-1-kraxel@redhat.com +(cherry picked from commit b946434f2659a182afc17e155be6791ebfb302eb) +Signed-off-by: Jon Maloy +Signed-off-by: Jon Maloy +--- + hw/usb/core.c | 16 ++++++++++------ + 1 file changed, 10 insertions(+), 6 deletions(-) + +diff --git a/hw/usb/core.c b/hw/usb/core.c +index f0201e30b4..f0038e44ae 100644 +--- a/hw/usb/core.c ++++ b/hw/usb/core.c +@@ -121,6 +121,7 @@ void usb_wakeup(USBEndpoint *ep, unsigned int stream) + static void do_token_setup(USBDevice *s, USBPacket *p) + { + int request, value, index; ++ unsigned int setup_len; + + if (p->iov.size != 8) { + p->status = USB_RET_STALL; +@@ -130,14 +131,15 @@ static void do_token_setup(USBDevice *s, USBPacket *p) + usb_packet_copy(p, s->setup_buf, p->iov.size); + s->setup_index = 0; + p->actual_length = 0; +- s->setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6]; +- if (s->setup_len > sizeof(s->data_buf)) { ++ setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6]; ++ if (setup_len > sizeof(s->data_buf)) { + fprintf(stderr, + "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n", +- s->setup_len, sizeof(s->data_buf)); ++ setup_len, sizeof(s->data_buf)); + p->status = USB_RET_STALL; + return; + } ++ s->setup_len = setup_len; + + request = (s->setup_buf[0] << 8) | s->setup_buf[1]; + value = (s->setup_buf[3] << 8) | s->setup_buf[2]; +@@ -251,26 +253,28 @@ static void do_token_out(USBDevice *s, USBPacket *p) + static void do_parameter(USBDevice *s, USBPacket *p) + { + int i, request, value, index; ++ unsigned int setup_len; + + for (i = 0; i < 8; i++) { + s->setup_buf[i] = p->parameter >> (i*8); + } + + s->setup_state = SETUP_STATE_PARAM; +- s->setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6]; + s->setup_index = 0; + + request = (s->setup_buf[0] << 8) | s->setup_buf[1]; + value = (s->setup_buf[3] << 8) | s->setup_buf[2]; + index = (s->setup_buf[5] << 8) | s->setup_buf[4]; + +- if (s->setup_len > sizeof(s->data_buf)) { ++ setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6]; ++ if (setup_len > sizeof(s->data_buf)) { + fprintf(stderr, + "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n", +- s->setup_len, sizeof(s->data_buf)); ++ setup_len, sizeof(s->data_buf)); + p->status = USB_RET_STALL; + return; + } ++ s->setup_len = setup_len; + + if (p->pid == USB_TOKEN_OUT) { + usb_packet_copy(p, s->data_buf, s->setup_len); +-- +2.18.2 + diff --git a/qemu-kvm.spec b/qemu-kvm.spec index 4746dbf64366d13fb82cfa0c9b92c942ebf5aaaa..76ebcd664ce3e8a59189fddd189fc84647fef89d 100644 --- a/qemu-kvm.spec +++ b/qemu-kvm.spec @@ -79,7 +79,7 @@ Obsoletes: %1 < %{obsoletes_version} \ Summary: QEMU is a machine emulator and virtualizer Name: %{pkgname}%{?pkgsuffix} Version: 1.5.3 -Release: 175%{?dist} +Release: 175%{?dist}.4 # Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped Epoch: 10 License: GPLv2 and GPLv2+ and CC-BY @@ -4042,6 +4042,20 @@ Patch1990: kvm-gluster-the-glfs_io_cbk-callback-function-pointer-ad.patch Patch1991: kvm-seccomp-set-the-seccomp-filter-to-all-threads.patch # For bz#1810408 - CVE-2019-20382 qemu-kvm: QEMU: vnc: memory leakage upon disconnect [rhel-7] Patch1992: kvm-vnc-fix-memory-leak-when-vnc-disconnect.patch +# For bz#1837565 - CVE-2020-1983 qemu-kvm: QEMU: slirp: use-after-free in ip_reass() function in ip_input.c [rhel-7] +Patch1993: kvm-Fix-use-afte-free-in-ip_reass-CVE-2020-1983.patch +# For bz#1869693 - CVE-2020-14364 qemu-kvm: QEMU: usb: out-of-bounds r/w access issue while processing usb packets [rhel-7.9.z] +Patch1994: kvm-usb-check-RNDIS-message-length.patch +# For bz#1869693 - CVE-2020-14364 qemu-kvm: QEMU: usb: out-of-bounds r/w access issue while processing usb packets [rhel-7.9.z] +Patch1995: kvm-usb-fix-setup_len-init-CVE-2020-14364.patch +# For bz#1860960 - CVE-2020-16092 qemu-kvm: QEMU: reachable assertion failure in net_tx_pkt_add_raw_fragment() in hw/net/net_tx_pkt.c [rhel-7.9.z] +Patch1996: kvm-hw-net-vmxnet_tx_pkt-fix-assertion-failure-in-vmxnet.patch +# For bz#1842923 - CVE-2020-13765 qemu-kvm: QEMU: loader: OOB access while loading registered ROM may lead to code execution [rhel-7.9.z] +Patch1997: kvm-hw-core-loader-Fix-possible-crash-in-rom_copy.patch +# For bz#1884997 - qemu-kvm FTBFS on rhel7.9 +Patch1998: kvm-Suppress-prototype-warning-for-nss-headers.patch +# For bz#1917449 - CVE-2020-29443 qemu-kvm: QEMU: ide: atapi: OOB access while processing read commands [rhel-7.9.z] +Patch1999: kvm-ide-atapi-check-logical-block-address-and-read-size-.patch BuildRequires: zlib-devel @@ -6212,6 +6226,13 @@ tar -xf %{SOURCE21} %patch1990 -p1 %patch1991 -p1 %patch1992 -p1 +%patch1993 -p1 +%patch1994 -p1 +%patch1995 -p1 +%patch1996 -p1 +%patch1997 -p1 +%patch1998 -p1 +%patch1999 -p1 %build buildarch="%{kvm_target}-softmmu" @@ -6657,6 +6678,36 @@ sh %{_sysconfdir}/sysconfig/modules/kvm.modules &> /dev/null || : %{_mandir}/man8/qemu-nbd.8* %changelog +* Fri May 07 2021 Jon Maloy - 1.5.3-175.el7_9.4 +- kvm-ide-atapi-check-logical-block-address-and-read-size-.patch [bz#1917449] +- Resolves: bz#1917449 + (CVE-2020-29443 qemu-kvm: QEMU: ide: atapi: OOB access while processing read commands [rhel-7.9.z]) + +* Tue Jan 05 2021 Jon Maloy - 1.5.3-175.el7_9.3 +- kvm-Suppress-prototype-warning-for-nss-headers.patch [bz#1884997] +- Resolves: bz#1884997 + (qemu-kvm FTBFS on rhel7.9) + +* Tue Nov 17 2020 Jon Maloy - 1.5.3-175.el7_9.2 +- kvm-hw-net-vmxnet_tx_pkt-fix-assertion-failure-in-vmxnet.patch [bz#1860960] +- kvm-hw-core-loader-Fix-possible-crash-in-rom_copy.patch [bz#1842923] +- Resolves: bz#1842923 + (CVE-2020-13765 qemu-kvm: QEMU: loader: OOB access while loading registered ROM may lead to code execution [rhel-7.9.z]) +- Resolves: bz#1860960 + (CVE-2020-16092 qemu-kvm: QEMU: reachable assertion failure in net_tx_pkt_add_raw_fragment() in hw/net/net_tx_pkt.c [rhel-7.9.z]) + +* Tue Sep 08 2020 Jon Maloy - 1.5.3-175.el7_9.1 +- Fixing release number for z-stream + +* Tue Sep 08 2020 Jon Maloy - 1.5.3-175.el7 +- kvm-Fix-use-afte-free-in-ip_reass-CVE-2020-1983.patch [bz#1837565] +- kvm-usb-check-RNDIS-message-length.patch [bz#1869693] +- kvm-usb-fix-setup_len-init-CVE-2020-14364.patch [bz#1869693] +- Resolves: bz#1837565 + (CVE-2020-1983 qemu-kvm: QEMU: slirp: use-after-free in ip_reass() function in ip_input.c [rhel-7]) +- Resolves: bz#1869693 + (CVE-2020-14364 qemu-kvm: QEMU: usb: out-of-bounds r/w access issue while processing usb packets [rhel-7.9.z]) + * Mon Jun 01 2020 Jon Maloy - 1.5.3-175.el7 - kvm-vnc-fix-memory-leak-when-vnc-disconnect.patch [bz#1810408] - Resolves: bz#1810408