From 50468ceeaa0e0c3160dad6527e36e05d8fa17dfe Mon Sep 17 00:00:00 2001 From: bouyer Date: Thu, 27 Aug 2020 08:22:33 +0000 Subject: 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. --- sysutils/xentools413/MESSAGE.NetBSD | 10 +- sysutils/xentools413/Makefile | 26 +++-- sysutils/xentools413/PLIST | 7 +- sysutils/xentools413/distinfo | 25 +++-- sysutils/xentools413/patches/patch-XSA335 | 86 ++++++++++++++++ .../patch-tools_debugger_gdbsx_xg_xg_main.c | 20 +++- .../patches/patch-tools_firmware_Makefile | 13 +++ .../patch-tools_firmware_etherboot_Makefile | 4 +- .../patches/patch-tools_include_Makefile | 13 +++ .../patch-tools_include_xen-sys_NetBSD_gntdev.h | 110 --------------------- .../patches/patch-tools_libs_call_private.h | 17 +++- .../patches/patch-tools_libs_evtchn_netbsd.c | 23 ++++- .../patches/patch-tools_libxc_xc_private.h | 16 +++ .../patches/patch-tools_libxl_libxl_netbsd.c | 13 +++ ...h-tools_ocaml_libs_eventchn_xeneventchn_stubs.c | 12 +++ 15 files changed, 253 insertions(+), 142 deletions(-) create mode 100644 sysutils/xentools413/patches/patch-XSA335 create mode 100644 sysutils/xentools413/patches/patch-tools_firmware_Makefile create mode 100644 sysutils/xentools413/patches/patch-tools_include_Makefile delete mode 100644 sysutils/xentools413/patches/patch-tools_include_xen-sys_NetBSD_gntdev.h create mode 100644 sysutils/xentools413/patches/patch-tools_libxc_xc_private.h create mode 100644 sysutils/xentools413/patches/patch-tools_libxl_libxl_netbsd.c create mode 100644 sysutils/xentools413/patches/patch-tools_ocaml_libs_eventchn_xeneventchn_stubs.c (limited to 'sysutils') diff --git a/sysutils/xentools413/MESSAGE.NetBSD b/sysutils/xentools413/MESSAGE.NetBSD index ebabd8761c2..c8629387433 100644 --- a/sysutils/xentools413/MESSAGE.NetBSD +++ b/sysutils/xentools413/MESSAGE.NetBSD @@ -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 @@ creating a Xen setup: 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 --git a/sysutils/xentools413/Makefile b/sysutils/xentools413/Makefile index fcecd51cfee..490952afa5d 100644 --- a/sysutils/xentools413/Makefile +++ b/sysutils/xentools413/Makefile @@ -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 HOMEPAGE= https://xenproject.org/ COMMENT= Userland Tools for Xen 4.13.x @@ -43,19 +53,21 @@ EGDIR= ${PREFIX}/share/examples/xen 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 @@ CONF_FILES_PERMS+= ${EGDIR}/scripts/${s} ${PKG_SYSCONFDIR}/scripts/${s} \ 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 --git a/sysutils/xentools413/PLIST b/sysutils/xentools413/PLIST index fc681efadbf..b9c58e96b1b 100644 --- a/sysutils/xentools413/PLIST +++ b/sysutils/xentools413/PLIST @@ -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/physdev.h 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/xenctx 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 --git a/sysutils/xentools413/distinfo b/sysutils/xentools413/distinfo index b2eacbf9aa2..8338a8a8296 100644 --- a/sysutils/xentools413/distinfo +++ b/sysutils/xentools413/distinfo @@ -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_Makefile) = a0cba219b1a48a4809be1aaf1758699fe56c885b 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 --git a/sysutils/xentools413/patches/patch-XSA335 b/sysutils/xentools413/patches/patch-XSA335 new file mode 100644 index 00000000000..5edb7b8a02e --- /dev/null +++ b/sysutils/xentools413/patches/patch-XSA335 @@ -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 +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 +--- + 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 --git a/sysutils/xentools413/patches/patch-tools_debugger_gdbsx_xg_xg_main.c b/sysutils/xentools413/patches/patch-tools_debugger_gdbsx_xg_xg_main.c index 481d2f617f5..baee73fefcf 100644 --- a/sysutils/xentools413/patches/patch-tools_debugger_gdbsx_xg_xg_main.c +++ b/sysutils/xentools413/patches/patch-tools_debugger_gdbsx_xg_xg_main.c @@ -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 + #include ++#ifdef __NetBSD__ ++#include ++#else + #include ++#endif + #include + #include + +@@ -126,12 +130,19 @@ int flags, saved_errno; XGTRC("E\n"); diff --git a/sysutils/xentools413/patches/patch-tools_firmware_Makefile b/sysutils/xentools413/patches/patch-tools_firmware_Makefile new file mode 100644 index 00000000000..18d052ab036 --- /dev/null +++ b/sysutils/xentools413/patches/patch-tools_firmware_Makefile @@ -0,0 +1,13 @@ +$NetBSD: patch-tools_firmware_Makefile,v 1.1 2020/08/27 08:22:33 bouyer Exp $ + +--- tools/firmware/Makefile.orig 2020-05-14 14:19:32.000000000 +0200 ++++ tools/firmware/Makefile 2020-08-26 19:39:04.950176746 +0200 +@@ -24,7 +24,7 @@ + cp ovmf-makefile ovmf-dir/Makefile; + + seabios-dir: +- GIT=$(GIT) $(XEN_ROOT)/scripts/git-checkout.sh $(SEABIOS_UPSTREAM_URL) $(SEABIOS_UPSTREAM_REVISION) seabios-dir ++ ln -sf ../../../seabios-rel-1.12.1 ${WRKSRC}/tools/firmware/seabios-dir + cp seabios-config seabios-dir/.config; + $(MAKE) -C seabios-dir olddefconfig CC=$(SEABIOSCC) LD=$(SEABIOSLD) + rm -f seabios-dir/.version diff --git a/sysutils/xentools413/patches/patch-tools_firmware_etherboot_Makefile b/sysutils/xentools413/patches/patch-tools_firmware_etherboot_Makefile index f64546e0f90..3e3fe4fef9f 100644 --- a/sysutils/xentools413/patches/patch-tools_firmware_etherboot_Makefile +++ b/sysutils/xentools413/patches/patch-tools_firmware_etherboot_Makefile @@ -1,4 +1,4 @@ -$NetBSD: patch-tools_firmware_etherboot_Makefile,v 1.1 2020/05/26 11:12:11 bouyer Exp $ +$NetBSD: patch-tools_firmware_etherboot_Makefile,v 1.2 2020/08/27 08:22:33 bouyer Exp $ --- tools/firmware/etherboot/Makefile.orig 2019-12-17 15:23:09.000000000 +0100 +++ tools/firmware/etherboot/Makefile 2020-05-08 16:59:46.337172477 +0200 @@ -15,7 +15,7 @@ $NetBSD: patch-tools_firmware_etherboot_Makefile,v 1.1 2020/05/26 11:12:11 bouye - fi - mv _$T $T +$D: -+ ln -sf $(WRKSRC)/../ipxe $D ++ ln -sf $(WRKSRC)/../ipxe-${IPXE_GIT_TAG} $D -$D/src/arch/i386/Makefile: $T Config - rm -rf $D diff --git a/sysutils/xentools413/patches/patch-tools_include_Makefile b/sysutils/xentools413/patches/patch-tools_include_Makefile new file mode 100644 index 00000000000..d5980770d11 --- /dev/null +++ b/sysutils/xentools413/patches/patch-tools_include_Makefile @@ -0,0 +1,13 @@ +$NetBSD: patch-tools_include_Makefile,v 1.1 2020/08/27 08:22:33 bouyer Exp $ + +--- tools/include/Makefile.orig 2020-08-27 00:04:16.538336097 +0200 ++++ tools/include/Makefile 2020-08-27 00:05:22.129359415 +0200 +@@ -69,7 +69,7 @@ + $(INSTALL_DATA) xen/foreign/*.h $(DESTDIR)$(includedir)/xen/foreign + $(INSTALL_DATA) xen/hvm/*.h $(DESTDIR)$(includedir)/xen/hvm + $(INSTALL_DATA) xen/io/*.h $(DESTDIR)$(includedir)/xen/io +- $(INSTALL_DATA) xen/sys/*.h $(DESTDIR)$(includedir)/xen/sys ++ $(INSTALL_DATA) xen/sys/*.h $(DESTDIR)$(includedir)/xen/sys || true + $(INSTALL_DATA) xen/xsm/*.h $(DESTDIR)$(includedir)/xen/xsm + + .PHONY: uninstall diff --git a/sysutils/xentools413/patches/patch-tools_include_xen-sys_NetBSD_gntdev.h b/sysutils/xentools413/patches/patch-tools_include_xen-sys_NetBSD_gntdev.h deleted file mode 100644 index b10421d07b2..00000000000 --- a/sysutils/xentools413/patches/patch-tools_include_xen-sys_NetBSD_gntdev.h +++ /dev/null @@ -1,110 +0,0 @@ -$NetBSD: patch-tools_include_xen-sys_NetBSD_gntdev.h,v 1.1 2020/05/26 11:12:11 bouyer Exp $ - ---- tools/include/xen-sys/NetBSD/gntdev.h.orig 2015-01-19 13:16:37.000000000 +0100 -+++ tools/include/xen-sys/NetBSD/gntdev.h 2015-01-19 13:16:37.000000000 +0100 -@@ -0,0 +1,105 @@ -+/****************************************************************************** -+ * gntdev.h -+ * -+ * Interface to /dev/xen/gntdev. -+ * -+ * Copyright (c) 2007, D G Murray -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License version 2 -+ * as published by the Free Software Foundation; or, when distributed -+ * separately from the Linux kernel or incorporated into other -+ * software packages, subject to the following license: -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining a copy -+ * of this source file (the "Software"), to deal in the Software without -+ * restriction, including without limitation the rights to use, copy, modify, -+ * merge, publish, distribute, sublicense, and/or sell copies of the Software, -+ * and to permit persons to whom the Software is furnished to do so, subject to -+ * the following conditions: -+ * -+ * The above copyright notice and this permission notice shall be included in -+ * all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -+ * IN THE SOFTWARE. -+ */ -+ -+#ifndef __NetBSD_PUBLIC_GNTDEV_H__ -+#define __NetBSD_PUBLIC_GNTDEV_H__ -+ -+struct ioctl_gntdev_grant_ref { -+ /* The domain ID of the grant to be mapped. */ -+ uint32_t domid; -+ /* The grant reference of the grant to be mapped. */ -+ uint32_t ref; -+}; -+ -+/* -+ * Inserts the grant references into the mapping table of an instance -+ * of gntdev. N.B. This does not perform the mapping, which is deferred -+ * until mmap() is called with @index as the offset. -+ */ -+#define IOCTL_GNTDEV_MAP_GRANT_REF \ -+ _IOWR('G', 0, sizeof(struct ioctl_gntdev_map_grant_ref)) -+struct ioctl_gntdev_map_grant_ref { -+ /* IN parameters */ -+ /* The number of grants to be mapped. */ -+ uint32_t count; -+ uint32_t pad; -+ /* OUT parameters */ -+ /* The offset to be used on a subsequent call to mmap(). */ -+ uint64_t index; -+ /* Variable IN parameter. */ -+ /* Array of grant references, of size @count. */ -+ struct ioctl_gntdev_grant_ref refs[1]; -+}; -+ -+/* -+ * Removes the grant references from the mapping table of an instance of -+ * of gntdev. N.B. munmap() must be called on the relevant virtual address(es) -+ * before this ioctl is called, or an error will result. -+ */ -+#define IOCTL_GNTDEV_UNMAP_GRANT_REF \ -+ _IOW('G', 1, sizeof(struct ioctl_gntdev_unmap_grant_ref)) -+struct ioctl_gntdev_unmap_grant_ref { -+ /* IN parameters */ -+ /* The offset was returned by the corresponding map operation. */ -+ uint64_t index; -+ /* The number of pages to be unmapped. */ -+ uint32_t count; -+ uint32_t pad; -+}; -+ -+/* -+ * Returns the offset in the driver's address space that corresponds -+ * to @vaddr. This can be used to perform a munmap(), followed by an -+ * UNMAP_GRANT_REF ioctl, where no state about the offset is retained by -+ * the caller. The number of pages that were allocated at the same time as -+ * @vaddr is returned in @count. -+ * -+ * N.B. Where more than one page has been mapped into a contiguous range, the -+ * supplied @vaddr must correspond to the start of the range; otherwise -+ * an error will result. It is only possible to munmap() the entire -+ * contiguously-allocated range at once, and not any subrange thereof. -+ */ -+#define IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR \ -+ _IOWR('G', 2, sizeof(struct ioctl_gntdev_get_offset_for_vaddr)) -+struct ioctl_gntdev_get_offset_for_vaddr { -+ /* IN parameters */ -+ /* The virtual address of the first mapped page in a range. */ -+ uint64_t vaddr; -+ /* OUT parameters */ -+ /* The offset that was used in the initial mmap() operation. */ -+ uint64_t offset; -+ /* The number of pages mapped in the VM area that begins at @vaddr. */ -+ uint32_t count; -+ uint32_t pad; -+}; -+ -+#endif /* __NetBSD_PUBLIC_GNTDEV_H__ */ diff --git a/sysutils/xentools413/patches/patch-tools_libs_call_private.h b/sysutils/xentools413/patches/patch-tools_libs_call_private.h index ec62bcdb676..e9f18419b62 100644 --- a/sysutils/xentools413/patches/patch-tools_libs_call_private.h +++ b/sysutils/xentools413/patches/patch-tools_libs_call_private.h @@ -1,8 +1,17 @@ -$NetBSD: patch-tools_libs_call_private.h,v 1.1 2020/05/26 11:12:11 bouyer Exp $ +$NetBSD: patch-tools_libs_call_private.h,v 1.2 2020/08/27 08:22:33 bouyer Exp $ ---- tools/libs/call/private.h.orig 2017-03-28 10:42:37.000000000 +0200 -+++ tools/libs/call/private.h 2017-03-28 10:43:04.000000000 +0200 -@@ -11,8 +11,10 @@ +--- tools/libs/call/private.h.orig 2020-05-14 14:19:32.000000000 +0200 ++++ tools/libs/call/private.h 2020-05-27 14:11:18.819118697 +0200 +@@ -7,13 +7,19 @@ + #include + + #include ++#ifdef __NetBSD__ ++#include ++#else + #include ++#endif + #ifndef PAGE_SHIFT /* Mini-os, Yukk */ #define PAGE_SHIFT 12 #endif diff --git a/sysutils/xentools413/patches/patch-tools_libs_evtchn_netbsd.c b/sysutils/xentools413/patches/patch-tools_libs_evtchn_netbsd.c index 2f740b0e4b6..e7b3f27094d 100644 --- a/sysutils/xentools413/patches/patch-tools_libs_evtchn_netbsd.c +++ b/sysutils/xentools413/patches/patch-tools_libs_evtchn_netbsd.c @@ -1,8 +1,21 @@ -$NetBSD: patch-tools_libs_evtchn_netbsd.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $ +$NetBSD: patch-tools_libs_evtchn_netbsd.c,v 1.2 2020/08/27 08:22:33 bouyer Exp $ ---- tools/libs/evtchn/netbsd.c.orig 2017-03-24 18:23:27.000000000 +0100 -+++ tools/libs/evtchn/netbsd.c 2017-03-24 18:23:40.000000000 +0100 -@@ -124,7 +124,7 @@ +--- tools/libs/evtchn/netbsd.c.orig 2020-05-14 14:19:32.000000000 +0200 ++++ tools/libs/evtchn/netbsd.c 2020-05-27 14:07:41.348188034 +0200 +@@ -25,10 +25,10 @@ + + #include + +-#include +- + #include "private.h" + ++#include ++ + #define EVTCHN_DEV_NAME "/dev/xenevt" + + int osdep_evtchn_open(xenevtchn_handle *xce) +@@ -131,7 +131,7 @@ int fd = xce->fd; evtchn_port_t port; @@ -11,7 +24,7 @@ $NetBSD: patch-tools_libs_evtchn_netbsd.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $ return -1; return port; -@@ -133,7 +133,7 @@ +@@ -140,7 +140,7 @@ int xenevtchn_unmask(xenevtchn_handle *xce, evtchn_port_t port) { int fd = xce->fd; diff --git a/sysutils/xentools413/patches/patch-tools_libxc_xc_private.h b/sysutils/xentools413/patches/patch-tools_libxc_xc_private.h new file mode 100644 index 00000000000..6a5edab1750 --- /dev/null +++ b/sysutils/xentools413/patches/patch-tools_libxc_xc_private.h @@ -0,0 +1,16 @@ +$NetBSD: patch-tools_libxc_xc_private.h,v 1.1 2020/08/27 08:22:33 bouyer Exp $ + +--- ./tools/libxc/xc_private.h.orig 2020-05-27 14:14:10.317819669 +0200 ++++ ./tools/libxc/xc_private.h 2020-05-27 14:13:45.466112859 +0200 +@@ -38,7 +38,11 @@ + #include + #include + ++#ifdef __NetBSD__ ++#include ++#else + #include ++#endif + + #include + diff --git a/sysutils/xentools413/patches/patch-tools_libxl_libxl_netbsd.c b/sysutils/xentools413/patches/patch-tools_libxl_libxl_netbsd.c new file mode 100644 index 00000000000..91678ac62b2 --- /dev/null +++ b/sysutils/xentools413/patches/patch-tools_libxl_libxl_netbsd.c @@ -0,0 +1,13 @@ +$NetBSD: patch-tools_libxl_libxl_netbsd.c,v 1.1 2020/08/27 08:22:33 bouyer Exp $ + +--- tools/libxl/libxl_netbsd.c.orig 2020-08-26 21:55:50.587030608 +0200 ++++ tools/libxl/libxl_netbsd.c 2020-08-26 21:56:05.491231282 +0200 +@@ -110,7 +110,7 @@ + + libxl_device_model_version libxl__default_device_model(libxl__gc *gc) + { +- return LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL; ++ return LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN; + } + + int libxl__pci_numdevs(libxl__gc *gc) diff --git a/sysutils/xentools413/patches/patch-tools_ocaml_libs_eventchn_xeneventchn_stubs.c b/sysutils/xentools413/patches/patch-tools_ocaml_libs_eventchn_xeneventchn_stubs.c new file mode 100644 index 00000000000..643d22b4dff --- /dev/null +++ b/sysutils/xentools413/patches/patch-tools_ocaml_libs_eventchn_xeneventchn_stubs.c @@ -0,0 +1,12 @@ +$NetBSD: patch-tools_ocaml_libs_eventchn_xeneventchn_stubs.c,v 1.1 2020/08/27 08:22:33 bouyer Exp $ + +--- ./tools/ocaml/libs/eventchn/xeneventchn_stubs.c.orig 2020-05-27 14:58:46.844387392 +0200 ++++ ./tools/ocaml/libs/eventchn/xeneventchn_stubs.c 2020-05-27 14:58:15.278522159 +0200 +@@ -22,7 +22,6 @@ + #include + #include + #include +-#include + #include + + #define CAML_NAME_SPACE -- cgit v1.2.3