aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel NĂ©ri <dne+alpine@mayonnaise.net>2020-09-07 23:59:23 +0200
committerLeo <thinkabit.ukim@gmail.com>2020-09-11 02:32:34 +0000
commit245ac703f93a253e3b42199aa12ceb152dd27706 (patch)
tree7137387861d089105675ef9474e7c564193f8cd6
parent8ffc0fe905f21e472724f58b101d61271a6571ff (diff)
downloadaports-245ac703f93a253e3b42199aa12ceb152dd27706.tar.gz
aports-245ac703f93a253e3b42199aa12ceb152dd27706.tar.bz2
aports-245ac703f93a253e3b42199aa12ceb152dd27706.tar.xz
main/xen: security fix for CVE-2020-14364/XSA-335
-rw-r--r--main/xen/APKBUILD6
-rw-r--r--main/xen/xsa335-qemu.patch84
2 files changed, 89 insertions, 1 deletions
diff --git a/main/xen/APKBUILD b/main/xen/APKBUILD
index a9ab75ca52..9d4ea5fcd1 100644
--- a/main/xen/APKBUILD
+++ b/main/xen/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=xen
pkgver=4.13.1
-pkgrel=4
+pkgrel=5
pkgdesc="Xen hypervisor"
url="https://www.xenproject.org/"
arch="x86_64 armhf aarch64" # enable armv7 when builds with gcc8
@@ -176,6 +176,8 @@ options="!strip"
# - CVE-2020-15565 XSA-321
# - CVE-2020-15564 XSA-327
# - CVE-2020-15567 XSA-328
+# 4.13.1-r5:
+# - CVE-2020-14364 XSA-335
case "$CARCH" in
x86*)
@@ -254,6 +256,7 @@ source="https://downloads.xenproject.org/release/xen/$pkgver/xen-$pkgver.tar.gz
xsa321-4.13-6.patch
xsa321-4.13-7.patch
xsa327.patch
+ xsa335-qemu.patch
qemu-xen-time64.patch
@@ -516,6 +519,7 @@ a9551daa73a7deb332fcfd647d0df6ebab84699a91eaca43697e182612304910610f80c1edc3c5e3
d7edad538e74d27d877e6393b6a98cd7df44d405d9b99534c16a3e7eee60193b53a1fa983cd90700ea8ffaf74e444327bf92ffb432591ceb963e028ae57c1e8f xsa321-4.13-6.patch
061a6ad3c01de21bb980fd11df38c4f9d4e48288f1a2f28bcbd82c2b01ce85e65c2b3103a84f2f95c87af50ee6344a1c0850f533528f6a32aa0961780f2b0a5a xsa321-4.13-7.patch
83823056dbd0142585d8b0fb9b3179ac8cc099a21ee489008a4cfb1f310daae72dff1fb6c7cd3a1c8ca5cec43a6b964587d8121a2423226baad0bcd302e73263 xsa327.patch
+a18f552845ca105ce846ff8281b6c5b10f45301571f3163a33a6c212b87b742bb039f15c2d346bd34a9fdedd8a007fd9e51f319900cb8ee05febf178ed6ef8b0 xsa335-qemu.patch
61d27f5ec967e59b416cf2b29e7e3dc9774897a7d75d2744b9327a1a6d66522d11de7a61434fd1ffa87518dee327db4a680bfeabce38ab71663429709a1e9dc7 qemu-xen-time64.patch
52c43beb2596d645934d0f909f2d21f7587b6898ed5e5e7046799a8ed6d58f7a09c5809e1634fa26152f3fd4f3e7cfa07da7076f01b4a20cc8f5df8b9cb77e50 xenstored.initd
093f7fbd43faf0a16a226486a0776bade5dc1681d281c5946a3191c32d74f9699c6bf5d0ab8de9d1195a2461165d1660788e92a3156c9b3c7054d7b2d52d7ff0 xenstored.confd
diff --git a/main/xen/xsa335-qemu.patch b/main/xen/xsa335-qemu.patch
new file mode 100644
index 0000000000..320b419782
--- /dev/null
+++ b/main/xen/xsa335-qemu.patch
@@ -0,0 +1,84 @@
+From c5bd2924c6d6a5bcbffb8b5e7798a88970131c07 Mon Sep 17 00:00:00 2001
+From: Gerd Hoffmann <kraxel@redhat.com>
+Date: Mon, 17 Aug 2020 08:34:22 +0200
+Subject: [PATCH] usb: fix setup_len init (CVE-2020-14364)
+
+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 <kraxel@redhat.com>
+---
+ 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 5abd128b6bc5..5234dcc73fea 100644
+--- a/tools/qemu-xen/hw/usb/core.c
++++ b/tools/qemu-xen/hw/usb/core.c
+@@ -129,6 +129,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;
+@@ -138,14 +139,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];
+@@ -259,26 +261,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.4