Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/sysutils/xentools413 Always use system-supplied IOCTL ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/652b172e3384
branches:  trunk
changeset: 437585:652b172e3384
user:      bouyer <bouyer%pkgsrc.org@localhost>
date:      Thu Aug 27 08:22:33 2020 +0000

description:
Always use system-supplied IOCTL definitions, remove xen-provided
include files.
Build seabios and ipxe, they're needed by qemu-xen (ipxe not strictly
needed but it's convenient to have)
Switch default device model from qemu-xen-traditional to qemu-xen
(the former being unmaintained)
Add upstream patch for XSA335 security issue.
Bump PKGREVISION.

diffstat:

 sysutils/xentools413/MESSAGE.NetBSD                                              |   10 +-
 sysutils/xentools413/Makefile                                                    |   26 +-
 sysutils/xentools413/PLIST                                                       |    7 +-
 sysutils/xentools413/distinfo                                                    |   25 +-
 sysutils/xentools413/patches/patch-XSA335                                        |   86 +++++++
 sysutils/xentools413/patches/patch-tools_debugger_gdbsx_xg_xg_main.c             |   20 +-
 sysutils/xentools413/patches/patch-tools_firmware_Makefile                       |   13 +
 sysutils/xentools413/patches/patch-tools_firmware_etherboot_Makefile             |    4 +-
 sysutils/xentools413/patches/patch-tools_include_Makefile                        |   13 +
 sysutils/xentools413/patches/patch-tools_include_xen-sys_NetBSD_gntdev.h         |  110 ----------
 sysutils/xentools413/patches/patch-tools_libs_call_private.h                     |   17 +-
 sysutils/xentools413/patches/patch-tools_libs_evtchn_netbsd.c                    |   23 +-
 sysutils/xentools413/patches/patch-tools_libxc_xc_private.h                      |   16 +
 sysutils/xentools413/patches/patch-tools_libxl_libxl_netbsd.c                    |   13 +
 sysutils/xentools413/patches/patch-tools_ocaml_libs_eventchn_xeneventchn_stubs.c |   12 +
 15 files changed, 253 insertions(+), 142 deletions(-)

diffs (truncated from 583 to 300 lines):

diff -r 8f76b3dd07c3 -r 652b172e3384 sysutils/xentools413/MESSAGE.NetBSD
--- a/sysutils/xentools413/MESSAGE.NetBSD       Thu Aug 27 07:00:51 2020 +0000
+++ b/sysutils/xentools413/MESSAGE.NetBSD       Thu Aug 27 08:22:33 2020 +0000
@@ -1,5 +1,5 @@
 ===========================================================================
-$NetBSD: MESSAGE.NetBSD,v 1.1 2020/05/26 11:12:10 bouyer Exp $
+$NetBSD: MESSAGE.NetBSD,v 1.2 2020/08/27 08:22:33 bouyer Exp $
 
 Please ensure that the Xen-specific devices needed by xend(8) exist:
 
@@ -15,3 +15,11 @@
        http://www.NetBSD.org/ports/xen/howto.html
 
 ===========================================================================
+WARNING: this version switches from the unmaintained qemu-xen-traditional
+(aka qemu-dm) to qemu-upstream (aka qemu-system-i386, aka qemu-xen).
+To switch back to qemu-xen-traditional add
+device_model_version='qemu-xen-traditional'
+to your HVM domain config file.
+Use of qemu-xen-traditional is deprecated and is not recommened. It may have
+security issues.
+===========================================================================
diff -r 8f76b3dd07c3 -r 652b172e3384 sysutils/xentools413/Makefile
--- a/sysutils/xentools413/Makefile     Thu Aug 27 07:00:51 2020 +0000
+++ b/sysutils/xentools413/Makefile     Thu Aug 27 08:22:33 2020 +0000
@@ -1,16 +1,26 @@
-# $NetBSD: Makefile,v 1.7 2020/07/26 08:49:38 rillig Exp $
+# $NetBSD: Makefile,v 1.8 2020/08/27 08:22:33 bouyer Exp $
 #
 VERSION=       4.13.1
 
 DIST_SUBDIR=           xen413
 DISTNAME=              xen-${VERSION}
 PKGNAME=               xentools413-${VERSION}
-#PKGREVISION=          2
+PKGREVISION=           1
 CATEGORIES=            sysutils
 MASTER_SITES=          https://downloads.xenproject.org/release/xen/${VERSION}/
 
 DISTFILES=             ${DISTNAME}.tar.gz
 
+SEABIOS_VERSION=       1.12.1
+SEABIOS_DIST=          seabios-${SEABIOS_VERSION}.tar.gz
+DISTFILES+=            ${SEABIOS_DIST}
+SITES.${SEABIOS_DIST}= -http://xenbits.xen.org/gitweb/?p=seabios.git;a=snapshot;h=refs/tags/rel-${SEABIOS_VERSION};sf=tgz
+
+IPXE_VERSION=          1dd56dbd11082fb622c2ed21cfaced4f47d798a6        
+IPXE_DIST=             ipxe-${IPXE_VERSION}.tar.gz
+DISTFILES+=            ${IPXE_DIST}    
+SITES.${IPXE_DIST}=    -https://github.com/ipxe/ipxe/archive/${IPXE_VERSION}.tar.gz
+
 MAINTAINER=            bouyer%NetBSD.org@localhost
 HOMEPAGE=              https://xenproject.org/
 COMMENT=               Userland Tools for Xen 4.13.x
@@ -43,19 +53,21 @@
 MESSAGE_SUBST+=                EGDIR=${EGDIR}
 
 USE_TOOLS+=            pod2man gmake pkg-config makeinfo perl bash cmake
-USE_LANGUAGES=         c
+USE_LANGUAGES=         c c++
 
 GNU_CONFIGURE=         YES
 #CONFIGURE_ARGS+=      --enable-xenapi
-CONFIGURE_ARGS+=       --disable-seabios
-CONFIGURE_ARGS+=       --disable-ipxe
+#CONFIGURE_ARGS+=      --disable-seabios
+#CONFIGURE_ARGS+=      --disable-ipxe
 
 CONFIGURE_ARGS+=       --sysconfdir=${PKG_SYSCONFBASE}
 
 MAKE_ENV+=             PREFIX=${prefix:Q} WRKSRC=${WRKSRC}
 MAKE_ENV+=             APPEND_LIB=${LDFLAGS:Q}
 MAKE_ENV+=             XEN_EXAMPLES_DIR=${EGDIR}
-MAKE_ENV+=             MV=${MV:Q} PYTHON=${PYTHONBIN:Q} SED=${SED:Q}
+MAKE_ENV+=             MV=${MV:Q} CP=${CP:Q}
+MAKE_ENV+=             PYTHON=${PYTHONBIN:Q} PYTHON_COMMAND=${PYTHONBIN:Q}
+MAKE_ENV+=             SED=${SED:Q}  
 MAKE_ENV+=             V=YES
 MAKE_ENV+=             NO_WERROR=1
 
@@ -119,6 +131,8 @@
 
 pre-build:
        rm -f ${WRKSRC}/check/check_x11_devel
+       rm -f ${WRKSRC}/tools/include/xen-sys/NetBSD/evtchn.h
+       rm -f ${WRKSRC}/tools/include/xen-sys/NetBSD/privcmd.h
        ${CP} -f ${FILESDIR}/locking.sh  ${WRKSRC}/tools/hotplug/NetBSD/
        ${SED} -e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g" \
                ${WRKSRC}/docs/man/xenstore-chmod.1.pod |\
diff -r 8f76b3dd07c3 -r 652b172e3384 sysutils/xentools413/PLIST
--- a/sysutils/xentools413/PLIST        Thu Aug 27 07:00:51 2020 +0000
+++ b/sysutils/xentools413/PLIST        Thu Aug 27 08:22:33 2020 +0000
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST,v 1.1 2020/05/26 11:12:10 bouyer Exp $
+@comment $NetBSD: PLIST,v 1.2 2020/08/27 08:22:33 bouyer Exp $
 ${PYSITELIB}/grub/ExtLinuxConf.py
 ${PYSITELIB}/grub/ExtLinuxConf.pyc
 ${PYSITELIB}/grub/GrubConf.py
@@ -124,9 +124,6 @@
 include/xen/platform.h
 include/xen/pmu.h
 include/xen/sched.h
-include/xen/sys/evtchn.h
-include/xen/sys/gntdev.h
-include/xen/sys/privcmd.h
 include/xen/sysctl.h
 include/xen/tmem.h
 include/xen/trace.h
@@ -308,6 +305,8 @@
 libexec/xen/bin/xenpaging
 libexec/xen/bin/xenpvnetboot
 libexec/xen/boot/hvmloader
+libexec/xen/boot/ipxe.bin
+libexec/xen/boot/seabios.bin
 libexec/xen/boot/xen-shim
 man/man1/xenstore-chmod.1
 man/man1/xenstore-ls.1
diff -r 8f76b3dd07c3 -r 652b172e3384 sysutils/xentools413/distinfo
--- a/sysutils/xentools413/distinfo     Thu Aug 27 07:00:51 2020 +0000
+++ b/sysutils/xentools413/distinfo     Thu Aug 27 08:22:33 2020 +0000
@@ -1,11 +1,20 @@
-$NetBSD: distinfo,v 1.1 2020/05/26 11:12:10 bouyer Exp $
+$NetBSD: distinfo,v 1.2 2020/08/27 08:22:33 bouyer Exp $
 
+SHA1 (xen413/ipxe-1dd56dbd11082fb622c2ed21cfaced4f47d798a6.tar.gz) = b78d21457bc07b4c4d3e770109c169ddafdacdf5
+RMD160 (xen413/ipxe-1dd56dbd11082fb622c2ed21cfaced4f47d798a6.tar.gz) = 846dbcc0f56e87fca8c87b00ca2ed031471d4246
+SHA512 (xen413/ipxe-1dd56dbd11082fb622c2ed21cfaced4f47d798a6.tar.gz) = 0d96236385d241fdddafc88e8b4dac37298f2371b0c61055b78d6ce794166559127de2c110409c55738ca16c4a9e9e1834b03f7a2de85729d0a66cf5c313c9e8
+Size (xen413/ipxe-1dd56dbd11082fb622c2ed21cfaced4f47d798a6.tar.gz) = 3814909 bytes
+SHA1 (xen413/seabios-1.12.1.tar.gz) = 229f14b55876a20e1b60be075e99569a6bd8967d
+RMD160 (xen413/seabios-1.12.1.tar.gz) = d7e778971c68454b27730213b5d72c0600e77344
+SHA512 (xen413/seabios-1.12.1.tar.gz) = 58755ce842adcb99c0f2f3ebbf9ec6d4a5072753966ab46805a96db1570847b109a90e6e03d61f9088ef877ca8ba96a8006777dc38ec434fce6b487f6c1f91d0
+Size (xen413/seabios-1.12.1.tar.gz) = 613450 bytes
 SHA1 (xen413/xen-4.13.1.tar.gz) = 194a314171120dad0b3c5433104c92343ec884ba
 RMD160 (xen413/xen-4.13.1.tar.gz) = 29cfb90b9da0ede99c1228b8e5964a99547c205d
 SHA512 (xen413/xen-4.13.1.tar.gz) = b56d20704155d98d803496cba83eb928e0f986a750831cd5600fc88d0ae772fe1456571654375054043d2da8daca255cc98385ebf08b1b1a75ecf7f4b7a0ee90
 Size (xen413/xen-4.13.1.tar.gz) = 39024612 bytes
 SHA1 (patch-Config.mk) = c41005a60de2f94a72b0206030eb021c137653d3
 SHA1 (patch-Makefile) = 6c580cbea532d08a38cf5e54228bd0210a98da21
+SHA1 (patch-XSA335) = eb976f2742093ddf1858848da17abcb682c0e9bd
 SHA1 (patch-docs_man_xl-disk-configuration.5.pod) = 9261cc5035dba3414e32955da80707baab042476
 SHA1 (patch-docs_man_xl.1.pod.in) = ac3525478471a43fd30fa40c7e89d4b5cb164038
 SHA1 (patch-docs_man_xl.cfg.5.pod.in) = 5970961552f29c4536a884161a208a27a20dccf4
@@ -24,31 +33,35 @@
 SHA1 (patch-tools_Rules.mk) = c7b4ca2068182c2305522b0efc6f33a3b0ed513c
 SHA1 (patch-tools_configure) = aa0838a1eadf70f5ed99748926234c0376989ff5
 SHA1 (patch-tools_console_daemon_utils.c) = 1c954e1edadad2607f7b87eaf2d6285be7f968ff
-SHA1 (patch-tools_debugger_gdbsx_xg_xg_main.c) = 059551256e95858d7ade25e7637667862bd92499
+SHA1 (patch-tools_debugger_gdbsx_xg_xg_main.c) = 50e7a7e584a44771292a514cd96c1dcbff3e4b7d
 SHA1 (patch-tools_examples_Makefile) = fe258fc26e4507ca2fb4363c5e2197ee06e89d64
-SHA1 (patch-tools_firmware_etherboot_Makefile) = ca9f42207888de19e44b2129311e0bce1d4cfee1
+SHA1 (patch-tools_firmware_Makefile) = 592e292ee25facaefcd2627ca3591dab9a10e61c
+SHA1 (patch-tools_firmware_etherboot_Makefile) = 61741d59c72430d53682ea83deed91ee4ff3d220
 SHA1 (patch-tools_firmware_hvmloader_Makefile) = 02cac5e9314c4c71105f15a3c1c303c573d6583a
 SHA1 (patch-tools_hotplug_NetBSD_Makefile) = a880a38f82e97a5d7846345307d354c8055d23a9
 SHA1 (patch-tools_hotplug_NetBSD_block) = 535ecef7cc0431a14515387e47aadea5dec79569
 SHA1 (patch-tools_hotplug_NetBSD_vif-bridge) = 6d5288c9c47fe81b388ea73f9a71ca3975df36c2
 SHA1 (patch-tools_hotplug_NetBSD_vif-ip) = cb8fd1150f6ac24fa853444618437f7d984b4282
 SHA1 (patch-tools_hotplug_common_Makefile) = 590186dfb31713e8d9ee675186f826bcbcba3c15
-SHA1 (patch-tools_include_xen-sys_NetBSD_gntdev.h) = ce4f7160e92d23afa029c9548cead180fe980ff4
+SHA1 (patch-tools_include_Makefile) = 4d9cb71ff924259dfd3c1ff9f77060cb50805b45
 SHA1 (patch-tools_libs_call_netbsd.c) = c5e166212b0069220d9155636b41028f0f7f9e9e
-SHA1 (patch-tools_libs_call_private.h) = caeaf937ae379836c3187bee97ac0b986af53f9f
-SHA1 (patch-tools_libs_evtchn_netbsd.c) = 1abb0f128ab0702b606e22f199d297d1e9c0aae5
+SHA1 (patch-tools_libs_call_private.h) = fed1882d4b6cdfb13be4637fb219cabc3b432fc8
+SHA1 (patch-tools_libs_evtchn_netbsd.c) = dcb876d581b4b9f5ccabe2bbd3ed2b1704d1976b
 SHA1 (patch-tools_libs_foreignmemory_Makefile) = d225187d9a1c988b9a46ab464fc7e141097e56e3
 SHA1 (patch-tools_libs_foreignmemory_netbsd.c) = a8eaa785fc3d46cce943f6f205066ff175f7f0e6
 SHA1 (patch-tools_libs_foreignmemory_private.h) = 4dfd16cb0bc14882f9aba8ccbd543b09e7959499
 SHA1 (patch-tools_libs_gnttab_Makefile) = 613a1e1867c5110f0fcf85a3c766306c02a1f001
 SHA1 (patch-tools_libs_gnttab_netbsd.c) = fecbb0d41365fc49621964dbf8d3b3fcbfddb5d3
+SHA1 (patch-tools_libxc_xc_private.h) = b627c3f92a6e74e3708bbc110d0b6a4d6ea64c37
 SHA1 (patch-tools_libxl_libxl__create.c) = 09cd562f0839dda6f92d63d8fc8ed6de08dd82a8
 SHA1 (patch-tools_libxl_libxl_dm.c) = f1f1842dc75afbc6114f201b8a7ed09fea0e271b
 SHA1 (patch-tools_libxl_libxl_dom.c) = 0c4a96523d13de65aaa71ef705c3579ee8d641f3
 SHA1 (patch-tools_libxl_libxl_event.c) = 8147122d03102eccc45c48a7d6ca1aa5d6286040
 SHA1 (patch-tools_libxl_libxl_internal.h) = 31da26f2121fe2a1928d75f719554ed9389c187b
+SHA1 (patch-tools_libxl_libxl_netbsd.c) = e2289fabc37bbb0fa078ce9a7256229f998c5982
 SHA1 (patch-tools_libxl_libxl_uuid.c) = 1eb8c027dbeb7e67df7475ee6e4d87220140c65b
 SHA1 (patch-tools_ocaml_common.make) = 4b845bdf3a013852109749ee18dfe28e3440d951
+SHA1 (patch-tools_ocaml_libs_eventchn_xeneventchn_stubs.c) = 371e45af87b4432aedeaba1871aa94a4f492e011
 SHA1 (patch-tools_ocaml_xenstored_Makefile) = b267702cf4090c7b45bba530e60327fced24e3e5
 SHA1 (patch-tools_ocaml_xenstored_utils.ml) = fd951de732d6c31cae89bd4b58c5650108578d79
 SHA1 (patch-tools_qemu-xen-traditional_Makefile) = 5fbb55bf84f9856043be301d5d06530190fe9a60
diff -r 8f76b3dd07c3 -r 652b172e3384 sysutils/xentools413/patches/patch-XSA335
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/xentools413/patches/patch-XSA335 Thu Aug 27 08:22:33 2020 +0000
@@ -0,0 +1,86 @@
+$NetBSD: patch-XSA335,v 1.1 2020/08/27 08:22:33 bouyer Exp $
+
+From c5bd2924c6d6a5bcbffb8b5e7798a88970131c07 Mon Sep 17 00:00:00 2001
+From: Gerd Hoffmann <kraxel%redhat.com@localhost>
+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@localhost>
+---
+ 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
+--- tools/qemu-xen/hw/usb/core.c.orig
++++ 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
diff -r 8f76b3dd07c3 -r 652b172e3384 sysutils/xentools413/patches/patch-tools_debugger_gdbsx_xg_xg_main.c
--- a/sysutils/xentools413/patches/patch-tools_debugger_gdbsx_xg_xg_main.c      Thu Aug 27 07:00:51 2020 +0000
+++ b/sysutils/xentools413/patches/patch-tools_debugger_gdbsx_xg_xg_main.c      Thu Aug 27 08:22:33 2020 +0000
@@ -1,8 +1,20 @@
-$NetBSD: patch-tools_debugger_gdbsx_xg_xg_main.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+$NetBSD: patch-tools_debugger_gdbsx_xg_xg_main.c,v 1.2 2020/08/27 08:22:33 bouyer Exp $
 
---- tools/debugger/gdbsx/xg/xg_main.c.orig     2020-04-30 09:57:45.000000000 +0200
-+++ tools/debugger/gdbsx/xg/xg_main.c  2020-04-30 09:58:43.000000000 +0200
-@@ -126,12 +126,19 @@
+--- tools/debugger/gdbsx/xg/xg_main.c.orig     2020-05-14 14:19:32.000000000 +0200
++++ tools/debugger/gdbsx/xg/xg_main.c  2020-08-26 23:12:04.349806717 +0200
+@@ -49,7 +49,11 @@
+ #include "xg_public.h"
+ #include <xen/version.h>
+ #include <xen/domctl.h>
++#ifdef __NetBSD__
++#include <xen/xenio.h>
++#else
+ #include <xen/sys/privcmd.h>
++#endif
+ #include <xen/foreign/x86_32.h>
+ #include <xen/foreign/x86_64.h>
+ 
+@@ -126,12 +130,19 @@
      int flags, saved_errno;
  



Home | Main Index | Thread Index | Old Index