diff options
author | Lee Chee Yang <chee.yang.lee@intel.com> | 2020-09-08 21:07:43 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-09-17 12:51:24 +0100 |
commit | a063c1c630f56792716ecdebf4f8bd9e6cb2a4ef (patch) | |
tree | e659f2f147e4c43a5c29df3d97ecd2dd5914abef /meta | |
parent | cf2f611fcbe1ca340cc449cf6c63390716487e2b (diff) | |
download | poky-a063c1c630f56792716ecdebf4f8bd9e6cb2a4ef.tar.gz |
qemu: fix CVE-2020-14364 CVE-2020-14415
(From OE-Core rev: 1a150f0df36892283686e3e1afb30a7742c8e252)
Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/recipes-devtools/qemu/qemu.inc | 2 | ||||
-rw-r--r-- | meta/recipes-devtools/qemu/qemu/CVE-2020-14364.patch | 93 | ||||
-rw-r--r-- | meta/recipes-devtools/qemu/qemu/CVE-2020-14415.patch | 37 |
3 files changed, 132 insertions, 0 deletions
diff --git a/meta/recipes-devtools/qemu/qemu.inc b/meta/recipes-devtools/qemu/qemu.inc index 49dbb1c13d..e0ea5ad477 100644 --- a/meta/recipes-devtools/qemu/qemu.inc +++ b/meta/recipes-devtools/qemu/qemu.inc | |||
@@ -45,6 +45,8 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \ | |||
45 | file://CVE-2020-13800.patch \ | 45 | file://CVE-2020-13800.patch \ |
46 | file://CVE-2020-13362.patch \ | 46 | file://CVE-2020-13362.patch \ |
47 | file://CVE-2020-15863.patch \ | 47 | file://CVE-2020-15863.patch \ |
48 | file://CVE-2020-14364.patch \ | ||
49 | file://CVE-2020-14415.patch \ | ||
48 | " | 50 | " |
49 | UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar" | 51 | UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar" |
50 | 52 | ||
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2020-14364.patch b/meta/recipes-devtools/qemu/qemu/CVE-2020-14364.patch new file mode 100644 index 0000000000..8333025a32 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/CVE-2020-14364.patch | |||
@@ -0,0 +1,93 @@ | |||
1 | From b946434f2659a182afc17e155be6791ebfb302eb Mon Sep 17 00:00:00 2001 | ||
2 | From: Gerd Hoffmann <kraxel@redhat.com> | ||
3 | Date: Tue, 25 Aug 2020 07:36:36 +0200 | ||
4 | Subject: [PATCH] usb: fix setup_len init (CVE-2020-14364) | ||
5 | |||
6 | Store calculated setup_len in a local variable, verify it, and only | ||
7 | write it to the struct (USBDevice->setup_len) in case it passed the | ||
8 | sanity checks. | ||
9 | |||
10 | This prevents other code (do_token_{in,out} functions specifically) | ||
11 | from working with invalid USBDevice->setup_len values and overrunning | ||
12 | the USBDevice->setup_buf[] buffer. | ||
13 | |||
14 | Fixes: CVE-2020-14364 | ||
15 | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> | ||
16 | Tested-by: Gonglei <arei.gonglei@huawei.com> | ||
17 | Reviewed-by: Li Qiang <liq3ea@gmail.com> | ||
18 | Message-id: 20200825053636.29648-1-kraxel@redhat.com | ||
19 | |||
20 | Upstream-Status: Backport | ||
21 | [https://git.qemu.org/?p=qemu.git;a=patch;h=b946434f2659a182afc17e155be6791ebfb302eb] | ||
22 | CVE: CVE-2020-14364 | ||
23 | Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com> | ||
24 | --- | ||
25 | hw/usb/core.c | 16 ++++++++++------ | ||
26 | 1 file changed, 10 insertions(+), 6 deletions(-) | ||
27 | |||
28 | diff --git a/hw/usb/core.c b/hw/usb/core.c | ||
29 | index 5abd128..5234dcc 100644 | ||
30 | --- a/hw/usb/core.c | ||
31 | +++ b/hw/usb/core.c | ||
32 | @@ -129,6 +129,7 @@ void usb_wakeup(USBEndpoint *ep, unsigned int stream) | ||
33 | static void do_token_setup(USBDevice *s, USBPacket *p) | ||
34 | { | ||
35 | int request, value, index; | ||
36 | + unsigned int setup_len; | ||
37 | |||
38 | if (p->iov.size != 8) { | ||
39 | p->status = USB_RET_STALL; | ||
40 | @@ -138,14 +139,15 @@ static void do_token_setup(USBDevice *s, USBPacket *p) | ||
41 | usb_packet_copy(p, s->setup_buf, p->iov.size); | ||
42 | s->setup_index = 0; | ||
43 | p->actual_length = 0; | ||
44 | - s->setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6]; | ||
45 | - if (s->setup_len > sizeof(s->data_buf)) { | ||
46 | + setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6]; | ||
47 | + if (setup_len > sizeof(s->data_buf)) { | ||
48 | fprintf(stderr, | ||
49 | "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n", | ||
50 | - s->setup_len, sizeof(s->data_buf)); | ||
51 | + setup_len, sizeof(s->data_buf)); | ||
52 | p->status = USB_RET_STALL; | ||
53 | return; | ||
54 | } | ||
55 | + s->setup_len = setup_len; | ||
56 | |||
57 | request = (s->setup_buf[0] << 8) | s->setup_buf[1]; | ||
58 | value = (s->setup_buf[3] << 8) | s->setup_buf[2]; | ||
59 | @@ -259,26 +261,28 @@ static void do_token_out(USBDevice *s, USBPacket *p) | ||
60 | static void do_parameter(USBDevice *s, USBPacket *p) | ||
61 | { | ||
62 | int i, request, value, index; | ||
63 | + unsigned int setup_len; | ||
64 | |||
65 | for (i = 0; i < 8; i++) { | ||
66 | s->setup_buf[i] = p->parameter >> (i*8); | ||
67 | } | ||
68 | |||
69 | s->setup_state = SETUP_STATE_PARAM; | ||
70 | - s->setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6]; | ||
71 | s->setup_index = 0; | ||
72 | |||
73 | request = (s->setup_buf[0] << 8) | s->setup_buf[1]; | ||
74 | value = (s->setup_buf[3] << 8) | s->setup_buf[2]; | ||
75 | index = (s->setup_buf[5] << 8) | s->setup_buf[4]; | ||
76 | |||
77 | - if (s->setup_len > sizeof(s->data_buf)) { | ||
78 | + setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6]; | ||
79 | + if (setup_len > sizeof(s->data_buf)) { | ||
80 | fprintf(stderr, | ||
81 | "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n", | ||
82 | - s->setup_len, sizeof(s->data_buf)); | ||
83 | + setup_len, sizeof(s->data_buf)); | ||
84 | p->status = USB_RET_STALL; | ||
85 | return; | ||
86 | } | ||
87 | + s->setup_len = setup_len; | ||
88 | |||
89 | if (p->pid == USB_TOKEN_OUT) { | ||
90 | usb_packet_copy(p, s->data_buf, s->setup_len); | ||
91 | -- | ||
92 | 1.8.3.1 | ||
93 | |||
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2020-14415.patch b/meta/recipes-devtools/qemu/qemu/CVE-2020-14415.patch new file mode 100644 index 0000000000..dca2f90a49 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/CVE-2020-14415.patch | |||
@@ -0,0 +1,37 @@ | |||
1 | From 7a4ede0047a8613b0e3b72c9d351038f013dd357 Mon Sep 17 00:00:00 2001 | ||
2 | From: Gerd Hoffmann <kraxel@redhat.com> | ||
3 | Date: Mon, 20 Jan 2020 11:18:04 +0100 | ||
4 | Subject: [PATCH] audio/oss: fix buffer pos calculation | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=utf8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | Fixes: 3ba4066d085f ("ossaudio: port to the new audio backend api") | ||
10 | Reported-by: ziming zhang <ezrakiez@gmail.com> | ||
11 | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> | ||
12 | Message-Id: <20200120101804.29578-1-kraxel@redhat.com> | ||
13 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
14 | |||
15 | Upstream-Status: Backport [https://git.qemu.org/?p=qemu.git;a=commit;h=7a4ede0047a8613b0e3b72c9d351038f013dd357] | ||
16 | CVE: CVE-2020-14415 | ||
17 | Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com> | ||
18 | --- | ||
19 | audio/ossaudio.c | 2 +- | ||
20 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
21 | |||
22 | diff --git a/audio/ossaudio.c b/audio/ossaudio.c | ||
23 | index c43faee..9456491 100644 | ||
24 | --- a/audio/ossaudio.c | ||
25 | +++ b/audio/ossaudio.c | ||
26 | @@ -420,7 +420,7 @@ static size_t oss_write(HWVoiceOut *hw, void *buf, size_t len) | ||
27 | size_t to_copy = MIN(len, hw->size_emul - hw->pos_emul); | ||
28 | memcpy(hw->buf_emul + hw->pos_emul, buf, to_copy); | ||
29 | |||
30 | - hw->pos_emul = (hw->pos_emul + to_copy) % hw->pos_emul; | ||
31 | + hw->pos_emul = (hw->pos_emul + to_copy) % hw->size_emul; | ||
32 | buf += to_copy; | ||
33 | len -= to_copy; | ||
34 | } | ||
35 | -- | ||
36 | 1.8.3.1 | ||
37 | |||