diff options
Diffstat (limited to 'meta/recipes-devtools/qemu')
-rw-r--r-- | meta/recipes-devtools/qemu/qemu.inc | 8 | ||||
-rw-r--r-- | meta/recipes-devtools/qemu/qemu/CVE-2020-24352.patch | 52 | ||||
-rw-r--r-- | meta/recipes-devtools/qemu/qemu/CVE-2020-25624.patch | 101 | ||||
-rw-r--r-- | meta/recipes-devtools/qemu/qemu/CVE-2020-25723.patch | 51 | ||||
-rw-r--r-- | meta/recipes-devtools/qemu/qemu/CVE-2020-28916.patch | 49 | ||||
-rw-r--r-- | meta/recipes-devtools/qemu/qemu/CVE-2020-29129-CVE-2020-29130.patch | 64 | ||||
-rw-r--r-- | meta/recipes-devtools/qemu/qemu/CVE-2020-29443.patch | 46 | ||||
-rw-r--r-- | meta/recipes-devtools/qemu/qemu/CVE-2020-35517.patch | 126 | ||||
-rw-r--r-- | meta/recipes-devtools/qemu/qemu/CVE-2021-20203.patch | 74 |
9 files changed, 571 insertions, 0 deletions
diff --git a/meta/recipes-devtools/qemu/qemu.inc b/meta/recipes-devtools/qemu/qemu.inc index 84f600cec0..482ca3d6e5 100644 --- a/meta/recipes-devtools/qemu/qemu.inc +++ b/meta/recipes-devtools/qemu/qemu.inc | |||
@@ -32,6 +32,14 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \ | |||
32 | file://find_datadir.patch \ | 32 | file://find_datadir.patch \ |
33 | file://usb-fix-setup_len-init.patch \ | 33 | file://usb-fix-setup_len-init.patch \ |
34 | file://0001-target-mips-Increase-number-of-TLB-entries-on-the-34.patch \ | 34 | file://0001-target-mips-Increase-number-of-TLB-entries-on-the-34.patch \ |
35 | file://CVE-2020-24352.patch \ | ||
36 | file://CVE-2020-29129-CVE-2020-29130.patch \ | ||
37 | file://CVE-2020-25624.patch \ | ||
38 | file://CVE-2020-25723.patch \ | ||
39 | file://CVE-2020-28916.patch \ | ||
40 | file://CVE-2020-35517.patch \ | ||
41 | file://CVE-2020-29443.patch \ | ||
42 | file://CVE-2021-20203.patch \ | ||
35 | " | 43 | " |
36 | UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar" | 44 | UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar" |
37 | 45 | ||
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2020-24352.patch b/meta/recipes-devtools/qemu/qemu/CVE-2020-24352.patch new file mode 100644 index 0000000000..861ff6c3b0 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/CVE-2020-24352.patch | |||
@@ -0,0 +1,52 @@ | |||
1 | From ca1f9cbfdce4d63b10d57de80fef89a89d92a540 Mon Sep 17 00:00:00 2001 | ||
2 | From: Prasad J Pandit <pjp@fedoraproject.org> | ||
3 | Date: Wed, 21 Oct 2020 16:08:18 +0530 | ||
4 | Subject: [PATCH 1/1] ati: check x y display parameter values | ||
5 | |||
6 | The source and destination x,y display parameters in ati_2d_blt() | ||
7 | may run off the vga limits if either of s->regs.[src|dst]_[xy] is | ||
8 | zero. Check the parameter values to avoid potential crash. | ||
9 | |||
10 | Reported-by: Gaoning Pan <pgn@zju.edu.cn> | ||
11 | Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> | ||
12 | Message-id: 20201021103818.1704030-1-ppandit@redhat.com | ||
13 | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> | ||
14 | |||
15 | Upstream-Status: Backport [ https://git.qemu.org/?p=qemu.git;a=commitdiff;h=ca1f9cbfdce4d63b10d57de80fef89a89d92a540;hp=2ddafce7f797082ad216657c830afd4546f16e37 ] | ||
16 | CVE: CVE-2020-24352 | ||
17 | Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com> | ||
18 | --- | ||
19 | hw/display/ati_2d.c | 10 ++++++---- | ||
20 | 1 file changed, 6 insertions(+), 4 deletions(-) | ||
21 | |||
22 | diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c | ||
23 | index 23a8ae0..4dc10ea 100644 | ||
24 | --- a/hw/display/ati_2d.c | ||
25 | +++ b/hw/display/ati_2d.c | ||
26 | @@ -75,8 +75,9 @@ void ati_2d_blt(ATIVGAState *s) | ||
27 | dst_stride *= bpp; | ||
28 | } | ||
29 | uint8_t *end = s->vga.vram_ptr + s->vga.vram_size; | ||
30 | - if (dst_bits >= end || dst_bits + dst_x + (dst_y + s->regs.dst_height) * | ||
31 | - dst_stride >= end) { | ||
32 | + if (dst_x > 0x3fff || dst_y > 0x3fff || dst_bits >= end | ||
33 | + || dst_bits + dst_x | ||
34 | + + (dst_y + s->regs.dst_height) * dst_stride >= end) { | ||
35 | qemu_log_mask(LOG_UNIMP, "blt outside vram not implemented\n"); | ||
36 | return; | ||
37 | } | ||
38 | @@ -107,8 +108,9 @@ void ati_2d_blt(ATIVGAState *s) | ||
39 | src_bits += s->regs.crtc_offset & 0x07ffffff; | ||
40 | src_stride *= bpp; | ||
41 | } | ||
42 | - if (src_bits >= end || src_bits + src_x + | ||
43 | - (src_y + s->regs.dst_height) * src_stride >= end) { | ||
44 | + if (src_x > 0x3fff || src_y > 0x3fff || src_bits >= end | ||
45 | + || src_bits + src_x | ||
46 | + + (src_y + s->regs.dst_height) * src_stride >= end) { | ||
47 | qemu_log_mask(LOG_UNIMP, "blt outside vram not implemented\n"); | ||
48 | return; | ||
49 | } | ||
50 | -- | ||
51 | 1.8.3.1 | ||
52 | |||
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2020-25624.patch b/meta/recipes-devtools/qemu/qemu/CVE-2020-25624.patch new file mode 100644 index 0000000000..7631bab39f --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/CVE-2020-25624.patch | |||
@@ -0,0 +1,101 @@ | |||
1 | From 1328fe0c32d5474604105b8105310e944976b058 Mon Sep 17 00:00:00 2001 | ||
2 | From: Prasad J Pandit <pjp@fedoraproject.org> | ||
3 | Date: Tue, 15 Sep 2020 23:52:58 +0530 | ||
4 | Subject: [PATCH] hw: usb: hcd-ohci: check len and frame_number variables | ||
5 | |||
6 | While servicing the OHCI transfer descriptors(TD), OHCI host | ||
7 | controller derives variables 'start_addr', 'end_addr', 'len' | ||
8 | etc. from values supplied by the host controller driver. | ||
9 | Host controller driver may supply values such that using | ||
10 | above variables leads to out-of-bounds access issues. | ||
11 | Add checks to avoid them. | ||
12 | |||
13 | AddressSanitizer: stack-buffer-overflow on address 0x7ffd53af76a0 | ||
14 | READ of size 2 at 0x7ffd53af76a0 thread T0 | ||
15 | #0 ohci_service_iso_td ../hw/usb/hcd-ohci.c:734 | ||
16 | #1 ohci_service_ed_list ../hw/usb/hcd-ohci.c:1180 | ||
17 | #2 ohci_process_lists ../hw/usb/hcd-ohci.c:1214 | ||
18 | #3 ohci_frame_boundary ../hw/usb/hcd-ohci.c:1257 | ||
19 | #4 timerlist_run_timers ../util/qemu-timer.c:572 | ||
20 | #5 qemu_clock_run_timers ../util/qemu-timer.c:586 | ||
21 | #6 qemu_clock_run_all_timers ../util/qemu-timer.c:672 | ||
22 | #7 main_loop_wait ../util/main-loop.c:527 | ||
23 | #8 qemu_main_loop ../softmmu/vl.c:1676 | ||
24 | #9 main ../softmmu/main.c:50 | ||
25 | |||
26 | Reported-by: Gaoning Pan <pgn@zju.edu.cn> | ||
27 | Reported-by: Yongkang Jia <j_kangel@163.com> | ||
28 | Reported-by: Yi Ren <yunye.ry@alibaba-inc.com> | ||
29 | Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> | ||
30 | Message-id: 20200915182259.68522-2-ppandit@redhat.com | ||
31 | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> | ||
32 | |||
33 | Upstream-Status: Backport | ||
34 | CVE: CVE-2020-25624 | ||
35 | [https://git.qemu.org/?p=qemu.git;a=commit;h=1328fe0c32d5474604105b8105310e944976b058] | ||
36 | Signed-off-by: Li Wang <li.wang@windriver.com> | ||
37 | --- | ||
38 | hw/usb/hcd-ohci.c | 24 ++++++++++++++++++++++-- | ||
39 | 1 file changed, 22 insertions(+), 2 deletions(-) | ||
40 | |||
41 | diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c | ||
42 | index 1e6e85e..9dc5910 100644 | ||
43 | --- a/hw/usb/hcd-ohci.c | ||
44 | +++ b/hw/usb/hcd-ohci.c | ||
45 | @@ -731,7 +731,11 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed, | ||
46 | } | ||
47 | |||
48 | start_offset = iso_td.offset[relative_frame_number]; | ||
49 | - next_offset = iso_td.offset[relative_frame_number + 1]; | ||
50 | + if (relative_frame_number < frame_count) { | ||
51 | + next_offset = iso_td.offset[relative_frame_number + 1]; | ||
52 | + } else { | ||
53 | + next_offset = iso_td.be; | ||
54 | + } | ||
55 | |||
56 | if (!(OHCI_BM(start_offset, TD_PSW_CC) & 0xe) || | ||
57 | ((relative_frame_number < frame_count) && | ||
58 | @@ -764,7 +768,12 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed, | ||
59 | } | ||
60 | } else { | ||
61 | /* Last packet in the ISO TD */ | ||
62 | - end_addr = iso_td.be; | ||
63 | + end_addr = next_offset; | ||
64 | + } | ||
65 | + | ||
66 | + if (start_addr > end_addr) { | ||
67 | + trace_usb_ohci_iso_td_bad_cc_overrun(start_addr, end_addr); | ||
68 | + return 1; | ||
69 | } | ||
70 | |||
71 | if ((start_addr & OHCI_PAGE_MASK) != (end_addr & OHCI_PAGE_MASK)) { | ||
72 | @@ -773,6 +782,9 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed, | ||
73 | } else { | ||
74 | len = end_addr - start_addr + 1; | ||
75 | } | ||
76 | + if (len > sizeof(ohci->usb_buf)) { | ||
77 | + len = sizeof(ohci->usb_buf); | ||
78 | + } | ||
79 | |||
80 | if (len && dir != OHCI_TD_DIR_IN) { | ||
81 | if (ohci_copy_iso_td(ohci, start_addr, end_addr, ohci->usb_buf, len, | ||
82 | @@ -975,8 +987,16 @@ static int ohci_service_td(OHCIState *ohci, struct ohci_ed *ed) | ||
83 | if ((td.cbp & 0xfffff000) != (td.be & 0xfffff000)) { | ||
84 | len = (td.be & 0xfff) + 0x1001 - (td.cbp & 0xfff); | ||
85 | } else { | ||
86 | + if (td.cbp > td.be) { | ||
87 | + trace_usb_ohci_iso_td_bad_cc_overrun(td.cbp, td.be); | ||
88 | + ohci_die(ohci); | ||
89 | + return 1; | ||
90 | + } | ||
91 | len = (td.be - td.cbp) + 1; | ||
92 | } | ||
93 | + if (len > sizeof(ohci->usb_buf)) { | ||
94 | + len = sizeof(ohci->usb_buf); | ||
95 | + } | ||
96 | |||
97 | pktlen = len; | ||
98 | if (len && dir != OHCI_TD_DIR_IN) { | ||
99 | -- | ||
100 | 2.17.1 | ||
101 | |||
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2020-25723.patch b/meta/recipes-devtools/qemu/qemu/CVE-2020-25723.patch new file mode 100644 index 0000000000..90b3a2f41c --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/CVE-2020-25723.patch | |||
@@ -0,0 +1,51 @@ | |||
1 | From 2fdb42d840400d58f2e706ecca82c142b97bcbd6 Mon Sep 17 00:00:00 2001 | ||
2 | From: Li Qiang <liq3ea@163.com> | ||
3 | Date: Wed, 12 Aug 2020 09:17:27 -0700 | ||
4 | Subject: [PATCH] hw: ehci: check return value of 'usb_packet_map' | ||
5 | |||
6 | If 'usb_packet_map' fails, we should stop to process the usb | ||
7 | request. | ||
8 | |||
9 | Signed-off-by: Li Qiang <liq3ea@163.com> | ||
10 | Message-Id: <20200812161727.29412-1-liq3ea@163.com> | ||
11 | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> | ||
12 | |||
13 | Upstream-Status: Backport | ||
14 | CVE: CVE-2020-25723 | ||
15 | [https://git.qemu.org/?p=qemu.git;a=commit;h=2fdb42d840400d58f2e706ecca82c142b97bcbd6] | ||
16 | Signed-off-by: Li Wang <li.wang@windriver.com> | ||
17 | --- | ||
18 | hw/usb/hcd-ehci.c | 10 ++++++++-- | ||
19 | 1 file changed, 8 insertions(+), 2 deletions(-) | ||
20 | |||
21 | diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c | ||
22 | index 1495e8f..1fbb02a 100644 | ||
23 | --- a/hw/usb/hcd-ehci.c | ||
24 | +++ b/hw/usb/hcd-ehci.c | ||
25 | @@ -1373,7 +1373,10 @@ static int ehci_execute(EHCIPacket *p, const char *action) | ||
26 | spd = (p->pid == USB_TOKEN_IN && NLPTR_TBIT(p->qtd.altnext) == 0); | ||
27 | usb_packet_setup(&p->packet, p->pid, ep, 0, p->qtdaddr, spd, | ||
28 | (p->qtd.token & QTD_TOKEN_IOC) != 0); | ||
29 | - usb_packet_map(&p->packet, &p->sgl); | ||
30 | + if (usb_packet_map(&p->packet, &p->sgl)) { | ||
31 | + qemu_sglist_destroy(&p->sgl); | ||
32 | + return -1; | ||
33 | + } | ||
34 | p->async = EHCI_ASYNC_INITIALIZED; | ||
35 | } | ||
36 | |||
37 | @@ -1452,7 +1455,10 @@ static int ehci_process_itd(EHCIState *ehci, | ||
38 | if (ep && ep->type == USB_ENDPOINT_XFER_ISOC) { | ||
39 | usb_packet_setup(&ehci->ipacket, pid, ep, 0, addr, false, | ||
40 | (itd->transact[i] & ITD_XACT_IOC) != 0); | ||
41 | - usb_packet_map(&ehci->ipacket, &ehci->isgl); | ||
42 | + if (usb_packet_map(&ehci->ipacket, &ehci->isgl)) { | ||
43 | + qemu_sglist_destroy(&ehci->isgl); | ||
44 | + return -1; | ||
45 | + } | ||
46 | usb_handle_packet(dev, &ehci->ipacket); | ||
47 | usb_packet_unmap(&ehci->ipacket, &ehci->isgl); | ||
48 | } else { | ||
49 | -- | ||
50 | 2.17.1 | ||
51 | |||
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2020-28916.patch b/meta/recipes-devtools/qemu/qemu/CVE-2020-28916.patch new file mode 100644 index 0000000000..5212196837 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/CVE-2020-28916.patch | |||
@@ -0,0 +1,49 @@ | |||
1 | From c2cb511634012344e3d0fe49a037a33b12d8a98a Mon Sep 17 00:00:00 2001 | ||
2 | From: Prasad J Pandit <pjp@fedoraproject.org> | ||
3 | Date: Wed, 11 Nov 2020 18:36:36 +0530 | ||
4 | Subject: [PATCH] hw/net/e1000e: advance desc_offset in case of null | ||
5 | descriptor | ||
6 | |||
7 | While receiving packets via e1000e_write_packet_to_guest() routine, | ||
8 | 'desc_offset' is advanced only when RX descriptor is processed. And | ||
9 | RX descriptor is not processed if it has NULL buffer address. | ||
10 | This may lead to an infinite loop condition. Increament 'desc_offset' | ||
11 | to process next descriptor in the ring to avoid infinite loop. | ||
12 | |||
13 | Reported-by: Cheol-woo Myung <330cjfdn@gmail.com> | ||
14 | Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> | ||
15 | Signed-off-by: Jason Wang <jasowang@redhat.com> | ||
16 | |||
17 | Upstream-Status: Backport | ||
18 | CVE: CVE-2020-28916 | ||
19 | [https://git.qemu.org/?p=qemu.git;a=commit;h=c2cb511634012344e3d0fe49a037a33b12d8a98a] | ||
20 | Signed-off-by: Li Wang <li.wang@windriver.com> | ||
21 | --- | ||
22 | hw/net/e1000e_core.c | 8 ++++---- | ||
23 | 1 file changed, 4 insertions(+), 4 deletions(-) | ||
24 | |||
25 | diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c | ||
26 | index bcd186c..d3e3cdc 100644 | ||
27 | --- a/hw/net/e1000e_core.c | ||
28 | +++ b/hw/net/e1000e_core.c | ||
29 | @@ -1596,13 +1596,13 @@ e1000e_write_packet_to_guest(E1000ECore *core, struct NetRxPkt *pkt, | ||
30 | (const char *) &fcs_pad, e1000x_fcs_len(core->mac)); | ||
31 | } | ||
32 | } | ||
33 | - desc_offset += desc_size; | ||
34 | - if (desc_offset >= total_size) { | ||
35 | - is_last = true; | ||
36 | - } | ||
37 | } else { /* as per intel docs; skip descriptors with null buf addr */ | ||
38 | trace_e1000e_rx_null_descriptor(); | ||
39 | } | ||
40 | + desc_offset += desc_size; | ||
41 | + if (desc_offset >= total_size) { | ||
42 | + is_last = true; | ||
43 | + } | ||
44 | |||
45 | e1000e_write_rx_descr(core, desc, is_last ? core->rx_pkt : NULL, | ||
46 | rss_info, do_ps ? ps_hdr_len : 0, &bastate.written); | ||
47 | -- | ||
48 | 2.17.1 | ||
49 | |||
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2020-29129-CVE-2020-29130.patch b/meta/recipes-devtools/qemu/qemu/CVE-2020-29129-CVE-2020-29130.patch new file mode 100644 index 0000000000..e5829f6dad --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/CVE-2020-29129-CVE-2020-29130.patch | |||
@@ -0,0 +1,64 @@ | |||
1 | From 2e1dcbc0c2af64fcb17009eaf2ceedd81be2b27f Mon Sep 17 00:00:00 2001 | ||
2 | From: Prasad J Pandit <pjp@fedoraproject.org> | ||
3 | Date: Thu, 26 Nov 2020 19:27:06 +0530 | ||
4 | Subject: [PATCH] slirp: check pkt_len before reading protocol header | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=utf8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | While processing ARP/NCSI packets in 'arp_input' or 'ncsi_input' | ||
10 | routines, ensure that pkt_len is large enough to accommodate the | ||
11 | respective protocol headers, lest it should do an OOB access. | ||
12 | Add check to avoid it. | ||
13 | |||
14 | CVE-2020-29129 CVE-2020-29130 | ||
15 | QEMU: slirp: out-of-bounds access while processing ARP/NCSI packets | ||
16 | -> https://www.openwall.com/lists/oss-security/2020/11/27/1 | ||
17 | |||
18 | Reported-by: Qiuhao Li <Qiuhao.Li@outlook.com> | ||
19 | Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> | ||
20 | Message-Id: <20201126135706.273950-1-ppandit@redhat.com> | ||
21 | Reviewed-by: Marc-Andrà Lureau <marcandre.lureau@redhat.com> | ||
22 | |||
23 | Upstream-Status: Backport | ||
24 | CVE: CVE-2020-29129 CVE-2020-29130 | ||
25 | [https://git.qemu.org/?p=libslirp.git;a=commit;h=2e1dcbc0c2af64fcb17009eaf2ceedd81be2b27f] | ||
26 | Signed-off-by: Li Wang <li.wang@windriver.com> | ||
27 | --- | ||
28 | slirp/src/ncsi.c | 4 ++++ | ||
29 | slirp/src/slirp.c | 4 ++++ | ||
30 | 2 files changed, 8 insertions(+) | ||
31 | |||
32 | diff --git a/slirp/src/ncsi.c b/slirp/src/ncsi.c | ||
33 | index 3c1dfef..75dcc08 100644 | ||
34 | --- a/slirp/src/ncsi.c | ||
35 | +++ b/slirp/src/ncsi.c | ||
36 | @@ -148,6 +148,10 @@ void ncsi_input(Slirp *slirp, const uint8_t *pkt, int pkt_len) | ||
37 | uint32_t checksum; | ||
38 | uint32_t *pchecksum; | ||
39 | |||
40 | + if (pkt_len < ETH_HLEN + sizeof(struct ncsi_pkt_hdr)) { | ||
41 | + return; /* packet too short */ | ||
42 | + } | ||
43 | + | ||
44 | memset(ncsi_reply, 0, sizeof(ncsi_reply)); | ||
45 | |||
46 | memset(reh->h_dest, 0xff, ETH_ALEN); | ||
47 | diff --git a/slirp/src/slirp.c b/slirp/src/slirp.c | ||
48 | index dba7c98..9be58e2 100644 | ||
49 | --- a/slirp/src/slirp.c | ||
50 | +++ b/slirp/src/slirp.c | ||
51 | @@ -756,6 +756,10 @@ static void arp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len) | ||
52 | return; | ||
53 | } | ||
54 | |||
55 | + if (pkt_len < ETH_HLEN + sizeof(struct slirp_arphdr)) { | ||
56 | + return; /* packet too short */ | ||
57 | + } | ||
58 | + | ||
59 | ar_op = ntohs(ah->ar_op); | ||
60 | switch (ar_op) { | ||
61 | case ARPOP_REQUEST: | ||
62 | -- | ||
63 | 2.17.1 | ||
64 | |||
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2020-29443.patch b/meta/recipes-devtools/qemu/qemu/CVE-2020-29443.patch new file mode 100644 index 0000000000..5a3b99bb23 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/CVE-2020-29443.patch | |||
@@ -0,0 +1,46 @@ | |||
1 | |||
2 | m 813212288970c39b1800f63e83ac6e96588095c6 Mon Sep 17 00:00:00 2001 | ||
3 | From: Paolo Bonzini <pbonzini@redhat.com> | ||
4 | Date: Tue, 1 Dec 2020 13:09:26 +0100 | ||
5 | Subject: [PATCH] ide: atapi: assert that the buffer pointer is in range | ||
6 | |||
7 | A case was reported where s->io_buffer_index can be out of range. | ||
8 | The report skimped on the details but it seems to be triggered | ||
9 | by s->lba == -1 on the READ/READ CD paths (e.g. by sending an | ||
10 | ATAPI command with LBA = 0xFFFFFFFF). For now paper over it | ||
11 | with assertions. The first one ensures that there is no overflow | ||
12 | when incrementing s->io_buffer_index, the second checks for the | ||
13 | buffer overrun. | ||
14 | |||
15 | Note that the buffer overrun is only a read, so I am not sure | ||
16 | if the assertion failure is actually less harmful than the overrun. | ||
17 | |||
18 | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> | ||
19 | Message-id: 20201201120926.56559-1-pbonzini@redhat.com | ||
20 | Reviewed-by: Kevin Wolf <kwolf@redhat.com> | ||
21 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
22 | |||
23 | Upstream-Status: Backport [https://git.qemu.org/?p=qemu.git;a=patch;h=813212288970c39b1800f63e83ac6e96588095c6] | ||
24 | CVE: CVE-2020-29443 | ||
25 | Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com> | ||
26 | |||
27 | --- | ||
28 | hw/ide/atapi.c | 2 ++ | ||
29 | 1 file changed, 2 insertions(+) | ||
30 | |||
31 | diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c | ||
32 | index 14a2b0b..e791578 100644 | ||
33 | --- a/hw/ide/atapi.c | ||
34 | +++ b/hw/ide/atapi.c | ||
35 | @@ -276,6 +276,8 @@ void ide_atapi_cmd_reply_end(IDEState *s) | ||
36 | s->packet_transfer_size -= size; | ||
37 | s->elementary_transfer_size -= size; | ||
38 | s->io_buffer_index += size; | ||
39 | + assert(size <= s->io_buffer_total_len); | ||
40 | + assert(s->io_buffer_index <= s->io_buffer_total_len); | ||
41 | |||
42 | /* Some adapters process PIO data right away. In that case, we need | ||
43 | * to avoid mutual recursion between ide_transfer_start | ||
44 | -- | ||
45 | 1.8.3.1 | ||
46 | |||
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2020-35517.patch b/meta/recipes-devtools/qemu/qemu/CVE-2020-35517.patch new file mode 100644 index 0000000000..f818eb3bf5 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/CVE-2020-35517.patch | |||
@@ -0,0 +1,126 @@ | |||
1 | From ebf101955ce8f8d72fba103b5151115a4335de2c Mon Sep 17 00:00:00 2001 | ||
2 | From: Stefan Hajnoczi <stefanha@redhat.com> | ||
3 | Date: Tue, 6 Oct 2020 10:58:26 +0100 | ||
4 | Subject: [PATCH] virtiofsd: avoid /proc/self/fd tempdir | ||
5 | |||
6 | In order to prevent /proc/self/fd escapes a temporary directory is | ||
7 | created where /proc/self/fd is bind-mounted. This doesn't work on | ||
8 | read-only file systems. | ||
9 | |||
10 | Avoid the temporary directory by bind-mounting /proc/self/fd over /proc. | ||
11 | This does not affect other processes since we remounted / with MS_REC | | ||
12 | MS_SLAVE. /proc must exist and virtiofsd does not use it so it's safe to | ||
13 | do this. | ||
14 | |||
15 | Path traversal can be tested with the following function: | ||
16 | |||
17 | static void test_proc_fd_escape(struct lo_data *lo) | ||
18 | { | ||
19 | int fd; | ||
20 | int level = 0; | ||
21 | ino_t last_ino = 0; | ||
22 | |||
23 | fd = lo->proc_self_fd; | ||
24 | for (;;) { | ||
25 | struct stat st; | ||
26 | |||
27 | if (fstat(fd, &st) != 0) { | ||
28 | perror("fstat"); | ||
29 | return; | ||
30 | } | ||
31 | if (last_ino && st.st_ino == last_ino) { | ||
32 | fprintf(stderr, "inode number unchanged, stopping\n"); | ||
33 | return; | ||
34 | } | ||
35 | last_ino = st.st_ino; | ||
36 | |||
37 | fprintf(stderr, "Level %d dev %lu ino %lu\n", level, | ||
38 | (unsigned long)st.st_dev, | ||
39 | (unsigned long)last_ino); | ||
40 | fd = openat(fd, "..", O_PATH | O_DIRECTORY | O_NOFOLLOW); | ||
41 | level++; | ||
42 | } | ||
43 | } | ||
44 | |||
45 | Before and after this patch only Level 0 is displayed. Without | ||
46 | /proc/self/fd bind-mount protection it is possible to traverse parent | ||
47 | directories. | ||
48 | |||
49 | Fixes: 397ae982f4df4 ("virtiofsd: jail lo->proc_self_fd") | ||
50 | Cc: Miklos Szeredi <mszeredi@redhat.com> | ||
51 | Cc: Jens Freimann <jfreimann@redhat.com> | ||
52 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
53 | Message-Id: <20201006095826.59813-1-stefanha@redhat.com> | ||
54 | Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> | ||
55 | Tested-by: Jens Freimann <jfreimann@redhat.com> | ||
56 | Reviewed-by: Jens Freimann <jfreimann@redhat.com> | ||
57 | Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> | ||
58 | |||
59 | |||
60 | Upstream-Status: Backport | ||
61 | [https://github.com/qemu/qemu/commit/ebf101955ce8f8d72fba103b5151115a4335de2c] | ||
62 | CVE: CVE-2020-35517 | ||
63 | Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com> | ||
64 | |||
65 | --- | ||
66 | tools/virtiofsd/passthrough_ll.c | 34 +++++++++++--------------------- | ||
67 | 1 file changed, 11 insertions(+), 23 deletions(-) | ||
68 | |||
69 | diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c | ||
70 | index 477e6ee0b53..ff53df44510 100644 | ||
71 | --- a/tools/virtiofsd/passthrough_ll.c | ||
72 | +++ b/tools/virtiofsd/passthrough_ll.c | ||
73 | @@ -2393,8 +2393,6 @@ static void setup_wait_parent_capabilities(void) | ||
74 | static void setup_namespaces(struct lo_data *lo, struct fuse_session *se) | ||
75 | { | ||
76 | pid_t child; | ||
77 | - char template[] = "virtiofsd-XXXXXX"; | ||
78 | - char *tmpdir; | ||
79 | |||
80 | /* | ||
81 | * Create a new pid namespace for *child* processes. We'll have to | ||
82 | @@ -2458,33 +2456,23 @@ static void setup_namespaces(struct lo_data *lo, struct fuse_session *se) | ||
83 | exit(1); | ||
84 | } | ||
85 | |||
86 | - tmpdir = mkdtemp(template); | ||
87 | - if (!tmpdir) { | ||
88 | - fuse_log(FUSE_LOG_ERR, "tmpdir(%s): %m\n", template); | ||
89 | - exit(1); | ||
90 | - } | ||
91 | - | ||
92 | - if (mount("/proc/self/fd", tmpdir, NULL, MS_BIND, NULL) < 0) { | ||
93 | - fuse_log(FUSE_LOG_ERR, "mount(/proc/self/fd, %s, MS_BIND): %m\n", | ||
94 | - tmpdir); | ||
95 | + /* | ||
96 | + * We only need /proc/self/fd. Prevent ".." from accessing parent | ||
97 | + * directories of /proc/self/fd by bind-mounting it over /proc. Since / was | ||
98 | + * previously remounted with MS_REC | MS_SLAVE this mount change only | ||
99 | + * affects our process. | ||
100 | + */ | ||
101 | + if (mount("/proc/self/fd", "/proc", NULL, MS_BIND, NULL) < 0) { | ||
102 | + fuse_log(FUSE_LOG_ERR, "mount(/proc/self/fd, MS_BIND): %m\n"); | ||
103 | exit(1); | ||
104 | } | ||
105 | |||
106 | - /* Now we can get our /proc/self/fd directory file descriptor */ | ||
107 | - lo->proc_self_fd = open(tmpdir, O_PATH); | ||
108 | + /* Get the /proc (actually /proc/self/fd, see above) file descriptor */ | ||
109 | + lo->proc_self_fd = open("/proc", O_PATH); | ||
110 | if (lo->proc_self_fd == -1) { | ||
111 | - fuse_log(FUSE_LOG_ERR, "open(%s, O_PATH): %m\n", tmpdir); | ||
112 | + fuse_log(FUSE_LOG_ERR, "open(/proc, O_PATH): %m\n"); | ||
113 | exit(1); | ||
114 | } | ||
115 | - | ||
116 | - if (umount2(tmpdir, MNT_DETACH) < 0) { | ||
117 | - fuse_log(FUSE_LOG_ERR, "umount2(%s, MNT_DETACH): %m\n", tmpdir); | ||
118 | - exit(1); | ||
119 | - } | ||
120 | - | ||
121 | - if (rmdir(tmpdir) < 0) { | ||
122 | - fuse_log(FUSE_LOG_ERR, "rmdir(%s): %m\n", tmpdir); | ||
123 | - } | ||
124 | } | ||
125 | |||
126 | /* | ||
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2021-20203.patch b/meta/recipes-devtools/qemu/qemu/CVE-2021-20203.patch new file mode 100644 index 0000000000..31440af0bd --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/CVE-2021-20203.patch | |||
@@ -0,0 +1,74 @@ | |||
1 | From: Prasad J Pandit <pjp@fedoraproject.org> | ||
2 | |||
3 | While activating device in vmxnet3_acticate_device(), it does not | ||
4 | validate guest supplied configuration values against predefined | ||
5 | minimum - maximum limits. This may lead to integer overflow or | ||
6 | OOB access issues. Add checks to avoid it. | ||
7 | |||
8 | Fixes: CVE-2021-20203 | ||
9 | Buglink: https://bugs.launchpad.net/qemu/+bug/1913873 | ||
10 | Reported-by: Gaoning Pan <pgn@zju.edu.cn> | ||
11 | Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> | ||
12 | |||
13 | Upstream-Status: Acepted [https://lists.gnu.org/archive/html/qemu-devel/2021-01/msg07935.html] | ||
14 | CVE: CVE-2021-20203 | ||
15 | Signed-off-by: Minjae Kim <flowergom@gmail.com> | ||
16 | --- | ||
17 | hw/net/vmxnet3.c | 13 +++++++++++++ | ||
18 | 1 file changed, 13 insertions(+) | ||
19 | |||
20 | diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c | ||
21 | index eff299f629..4a910ca971 100644 | ||
22 | --- a/hw/net/vmxnet3.c | ||
23 | +++ b/hw/net/vmxnet3.c | ||
24 | @@ -1420,6 +1420,7 @@ static void vmxnet3_activate_device(VMXNET3State *s) | ||
25 | vmxnet3_setup_rx_filtering(s); | ||
26 | /* Cache fields from shared memory */ | ||
27 | s->mtu = VMXNET3_READ_DRV_SHARED32(d, s->drv_shmem, devRead.misc.mtu); | ||
28 | + assert(VMXNET3_MIN_MTU <= s->mtu && s->mtu < VMXNET3_MAX_MTU); | ||
29 | VMW_CFPRN("MTU is %u", s->mtu); | ||
30 | |||
31 | s->max_rx_frags = | ||
32 | @@ -1473,6 +1474,9 @@ static void vmxnet3_activate_device(VMXNET3State *s) | ||
33 | /* Read rings memory locations for TX queues */ | ||
34 | pa = VMXNET3_READ_TX_QUEUE_DESCR64(d, qdescr_pa, conf.txRingBasePA); | ||
35 | size = VMXNET3_READ_TX_QUEUE_DESCR32(d, qdescr_pa, conf.txRingSize); | ||
36 | + if (size > VMXNET3_TX_RING_MAX_SIZE) { | ||
37 | + size = VMXNET3_TX_RING_MAX_SIZE; | ||
38 | + } | ||
39 | |||
40 | vmxnet3_ring_init(d, &s->txq_descr[i].tx_ring, pa, size, | ||
41 | sizeof(struct Vmxnet3_TxDesc), false); | ||
42 | @@ -1483,6 +1487,9 @@ static void vmxnet3_activate_device(VMXNET3State *s) | ||
43 | /* TXC ring */ | ||
44 | pa = VMXNET3_READ_TX_QUEUE_DESCR64(d, qdescr_pa, conf.compRingBasePA); | ||
45 | size = VMXNET3_READ_TX_QUEUE_DESCR32(d, qdescr_pa, conf.compRingSize); | ||
46 | + if (size > VMXNET3_TC_RING_MAX_SIZE) { | ||
47 | + size = VMXNET3_TC_RING_MAX_SIZE; | ||
48 | + } | ||
49 | vmxnet3_ring_init(d, &s->txq_descr[i].comp_ring, pa, size, | ||
50 | sizeof(struct Vmxnet3_TxCompDesc), true); | ||
51 | VMXNET3_RING_DUMP(VMW_CFPRN, "TXC", i, &s->txq_descr[i].comp_ring); | ||
52 | @@ -1524,6 +1531,9 @@ static void vmxnet3_activate_device(VMXNET3State *s) | ||
53 | /* RX rings */ | ||
54 | pa = VMXNET3_READ_RX_QUEUE_DESCR64(d, qd_pa, conf.rxRingBasePA[j]); | ||
55 | size = VMXNET3_READ_RX_QUEUE_DESCR32(d, qd_pa, conf.rxRingSize[j]); | ||
56 | + if (size > VMXNET3_RX_RING_MAX_SIZE) { | ||
57 | + size = VMXNET3_RX_RING_MAX_SIZE; | ||
58 | + } | ||
59 | vmxnet3_ring_init(d, &s->rxq_descr[i].rx_ring[j], pa, size, | ||
60 | sizeof(struct Vmxnet3_RxDesc), false); | ||
61 | VMW_CFPRN("RX queue %d:%d: Base: %" PRIx64 ", Size: %d", | ||
62 | @@ -1533,6 +1543,9 @@ static void vmxnet3_activate_device(VMXNET3State *s) | ||
63 | /* RXC ring */ | ||
64 | pa = VMXNET3_READ_RX_QUEUE_DESCR64(d, qd_pa, conf.compRingBasePA); | ||
65 | size = VMXNET3_READ_RX_QUEUE_DESCR32(d, qd_pa, conf.compRingSize); | ||
66 | + if (size > VMXNET3_RC_RING_MAX_SIZE) { | ||
67 | + size = VMXNET3_RC_RING_MAX_SIZE; | ||
68 | + } | ||
69 | vmxnet3_ring_init(d, &s->rxq_descr[i].comp_ring, pa, size, | ||
70 | sizeof(struct Vmxnet3_RxCompDesc), true); | ||
71 | VMW_CFPRN("RXC queue %d: Base: %" PRIx64 ", Size: %d", i, pa, size); | ||
72 | -- | ||
73 | 2.29.2 | ||
74 | |||