diff options
author | wiz <wiz> | 2016-12-29 23:12:23 +0000 |
---|---|---|
committer | wiz <wiz> | 2016-12-29 23:12:23 +0000 |
commit | 070e4a656a7d0c3d35d6f98d45832ac491b24ef4 (patch) | |
tree | ccc142caff91c9b15a218c7c10b1c845274cdb06 /sysutils | |
parent | 403ca2b8466067d5325c83908eca87087d6a7fbe (diff) | |
download | pkgsrc-070e4a656a7d0c3d35d6f98d45832ac491b24ef4.tar.gz |
Fix build. Not sure if this makes sense, since it's for the removed xen 4.1.
Diffstat (limited to 'sysutils')
65 files changed, 2291 insertions, 8 deletions
diff --git a/sysutils/xenstoretools/Makefile b/sysutils/xenstoretools/Makefile index fba16ce600d..5ca99368f44 100644 --- a/sysutils/xenstoretools/Makefile +++ b/sysutils/xenstoretools/Makefile @@ -1,8 +1,4 @@ -# $NetBSD: Makefile,v 1.5 2016/07/09 13:07:20 rillig Exp $ -# - -# VERSION is set in xentool41/version.mk -.include "../../sysutils/xentools41/version.mk" +# $NetBSD: Makefile,v 1.6 2016/12/29 23:12:23 wiz Exp $ DISTNAME= xen-${VERSION} PKGNAME= xenstoretools-${VERSION} @@ -17,10 +13,11 @@ SITES.ipxe-git-v${VERSION_IPXE}.tar.gz+= http://xenbits.xensource.com/xen-extfil MAINTAINER= sborrill@NetBSD.org HOMEPAGE= http://xen.org/ COMMENT= Xenstore Tools for Xen 4.1.x - LICENSE= gnu-gpl-v2 -DISTINFO_FILE= ${.CURDIR}/../xentools41/distinfo -PATCHDIR= ${.CURDIR}/../xentools41/patches + +VERSION= 4.1.6.1 +VERSION_IPXE= 1.0.0 + BUILD_DIRS= xenstore BUILD_TARGET= clients INSTALL_TARGET= installclients diff --git a/sysutils/xenstoretools/patches/patch-.._.._ipxe_src_arch_i386_include_librm.h b/sysutils/xenstoretools/patches/patch-.._.._ipxe_src_arch_i386_include_librm.h new file mode 100644 index 00000000000..c0c35bb5013 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-.._.._ipxe_src_arch_i386_include_librm.h @@ -0,0 +1,16 @@ +$NetBSD: patch-.._.._ipxe_src_arch_i386_include_librm.h,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- ../../ipxe/src/arch/i386/include/librm.h.orig 2010-02-02 16:12:44.000000000 +0000 ++++ ../../ipxe/src/arch/i386/include/librm.h +@@ -122,8 +122,9 @@ extern char *text16; + _data16_ ## variable __asm__ ( #variable ) + + #define __bss16_array( variable, array ) \ +- __attribute__ (( section ( ".bss16" ) )) \ +- _data16_ ## variable array __asm__ ( #variable ) ++ _data16_ ## variable array \ ++ __asm__ ( #variable ) \ ++ __attribute__ (( section ( ".bss16" ) )) + + #define __text16( variable ) \ + __attribute__ (( section ( ".text16.data" ) )) \ diff --git a/sysutils/xenstoretools/patches/patch-.._.._ipxe_src_core_settings.c b/sysutils/xenstoretools/patches/patch-.._.._ipxe_src_core_settings.c new file mode 100644 index 00000000000..26d37b7d021 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-.._.._ipxe_src_core_settings.c @@ -0,0 +1,34 @@ +$NetBSD: patch-.._.._ipxe_src_core_settings.c,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- ../../ipxe/src/core/settings.c.orig 2013-03-25 18:48:57.000000000 +0000 ++++ ../../ipxe/src/core/settings.c +@@ -263,10 +263,12 @@ static struct settings * find_child_sett + */ + static struct settings * autovivify_child_settings ( struct settings *parent, + const char *name ) { ++ size_t nlen = strlen ( name ) + 1 /* NUL */; + struct { + struct generic_settings generic; +- char name[ strlen ( name ) + 1 /* NUL */ ]; ++ char name[]; + } *new_child; ++ size_t tlen = sizeof(*new_child) + nlen; + struct settings *settings; + + /* Return existing settings, if existent */ +@@ -274,13 +276,13 @@ static struct settings * autovivify_chil + return settings; + + /* Create new generic settings block */ +- new_child = zalloc ( sizeof ( *new_child ) ); ++ new_child = zalloc ( tlen ); + if ( ! new_child ) { + DBGC ( parent, "Settings %p could not create child %s\n", + parent, name ); + return NULL; + } +- memcpy ( new_child->name, name, sizeof ( new_child->name ) ); ++ memcpy ( new_child->name, name, nlen ); + generic_settings_init ( &new_child->generic, NULL, new_child->name ); + settings = &new_child->generic.settings; + register_settings ( settings, parent ); diff --git a/sysutils/xenstoretools/patches/patch-.._.._ipxe_src_net_tls.c b/sysutils/xenstoretools/patches/patch-.._.._ipxe_src_net_tls.c new file mode 100644 index 00000000000..fbf7a395f16 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-.._.._ipxe_src_net_tls.c @@ -0,0 +1,69 @@ +$NetBSD: patch-.._.._ipxe_src_net_tls.c,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- ../../ipxe/src/net/tls.c.orig 2013-03-25 18:53:57.000000000 +0000 ++++ ../../ipxe/src/net/tls.c +@@ -650,18 +650,22 @@ static int tls_send_client_key_exchange + RSA_CTX *rsa_ctx; + RSA_pub_key_new ( &rsa_ctx, tls->rsa.modulus, tls->rsa.modulus_len, + tls->rsa.exponent, tls->rsa.exponent_len ); ++ size_t elen = rsa_ctx->num_octets; + struct { + uint32_t type_length; + uint16_t encrypted_pre_master_secret_len; +- uint8_t encrypted_pre_master_secret[rsa_ctx->num_octets]; +- } __attribute__ (( packed )) key_xchg; +- +- memset ( &key_xchg, 0, sizeof ( key_xchg ) ); +- key_xchg.type_length = ( cpu_to_le32 ( TLS_CLIENT_KEY_EXCHANGE ) | +- htonl ( sizeof ( key_xchg ) - +- sizeof ( key_xchg.type_length ) ) ); +- key_xchg.encrypted_pre_master_secret_len +- = htons ( sizeof ( key_xchg.encrypted_pre_master_secret ) ); ++ uint8_t encrypted_pre_master_secret[]; ++ } __attribute__ (( packed )) *key_xchg; ++ size_t klen = sizeof(*key_xchg) + elen; ++ ++ key_xchg = alloca(klen); ++ ++ memset ( key_xchg, 0, klen ); ++ key_xchg->type_length = ( cpu_to_le32 ( TLS_CLIENT_KEY_EXCHANGE ) | ++ htonl ( klen - ++ sizeof ( key_xchg->type_length ) ) ); ++ key_xchg->encrypted_pre_master_secret_len ++ = htons ( elen ); + + /* FIXME: Hack alert */ + DBGC ( tls, "RSA encrypting plaintext, modulus, exponent:\n" ); +@@ -671,14 +675,13 @@ static int tls_send_client_key_exchange + DBGC_HD ( tls, tls->rsa.exponent, tls->rsa.exponent_len ); + RSA_encrypt ( rsa_ctx, ( const uint8_t * ) &tls->pre_master_secret, + sizeof ( tls->pre_master_secret ), +- key_xchg.encrypted_pre_master_secret, 0 ); ++ key_xchg->encrypted_pre_master_secret, 0 ); + DBGC ( tls, "RSA encrypt done. Ciphertext:\n" ); +- DBGC_HD ( tls, &key_xchg.encrypted_pre_master_secret, +- sizeof ( key_xchg.encrypted_pre_master_secret ) ); ++ DBGC_HD ( tls, &key_xchg->encrypted_pre_master_secret, elen ); + RSA_free ( rsa_ctx ); + + +- return tls_send_handshake ( tls, &key_xchg, sizeof ( key_xchg ) ); ++ return tls_send_handshake ( tls, key_xchg, klen ); + } + + /** +@@ -802,12 +805,12 @@ static int tls_new_server_hello ( struct + uint8_t session_id_len; + char next[0]; + } __attribute__ (( packed )) *hello_a = data; ++ size_t slen = hello_a->session_id_len; + struct { +- uint8_t session_id[hello_a->session_id_len]; + uint16_t cipher_suite; + uint8_t compression_method; + char next[0]; +- } __attribute__ (( packed )) *hello_b = ( void * ) &hello_a->next; ++ } __attribute__ (( packed )) *hello_b = ( void * ) ((uint8_t *)&hello_a->next + slen); + void *end = hello_b->next; + int rc; + diff --git a/sysutils/xenstoretools/patches/patch-.._Config.mk b/sysutils/xenstoretools/patches/patch-.._Config.mk new file mode 100644 index 00000000000..419b34c1843 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-.._Config.mk @@ -0,0 +1,22 @@ +$NetBSD: patch-.._Config.mk,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- ../Config.mk.orig 2013-03-25 09:51:57.000000000 +0000 ++++ ../Config.mk +@@ -15,7 +15,7 @@ SHELL ?= /bin/sh + # Tools to run on system hosting the build + HOSTCC = gcc + HOSTCFLAGS = -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer +-HOSTCFLAGS += -fno-strict-aliasing ++HOSTCFLAGS += -fno-strict-aliasing ${EXTRA_HOSTCFLAGS} + + DISTDIR ?= $(XEN_ROOT)/dist + DESTDIR ?= / +@@ -141,6 +141,8 @@ CFLAGS += -Wall -Wstrict-prototypes + # result of any casted expression causes a warning. + CFLAGS += -Wno-unused-value + ++CFLAGS += ${EXTRA_CFLAGS} ++ + $(call cc-option-add,HOSTCFLAGS,HOSTCC,-Wdeclaration-after-statement) + $(call cc-option-add,CFLAGS,CC,-Wdeclaration-after-statement) + $(call cc-option-add,CFLAGS,CC,-Wno-unused-but-set-variable) diff --git a/sysutils/xenstoretools/patches/patch-CVE-2014-1950 b/sysutils/xenstoretools/patches/patch-CVE-2014-1950 new file mode 100644 index 00000000000..66fc7ab6ab2 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-CVE-2014-1950 @@ -0,0 +1,14 @@ +$NetBSD: patch-CVE-2014-1950,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +http://lists.xenproject.org/archives/html/xen-announce/2014-02/msg00006.html + +--- libxc/xc_cpupool.c.orig 2014-02-12 16:27:31.000000000 +0000 ++++ libxc/xc_cpupool.c 2014-02-12 16:28:11.000000000 +0000 +@@ -104,6 +104,7 @@ xc_cpupoolinfo_t *xc_cpupool_getinfo(xc_ + info->cpumap = xc_cpumap_alloc(xch); + if (!info->cpumap) { + free(info); ++ info = NULL; + goto out; + } + info->cpupool_id = sysctl.u.cpupool_op.cpupool_id; diff --git a/sysutils/xenstoretools/patches/patch-CVE-2015-2752 b/sysutils/xenstoretools/patches/patch-CVE-2015-2752 new file mode 100644 index 00000000000..bfe1bd7453c --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-CVE-2015-2752 @@ -0,0 +1,83 @@ +$NetBSD: patch-CVE-2015-2752,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +Patch for CVE-2015-2752 aka XSA-125 from +http://xenbits.xenproject.org/xsa/xsa125-4.2.patch + +--- libxc/xc_domain.c.orig 2013-09-10 06:42:18.000000000 +0000 ++++ libxc/xc_domain.c +@@ -1322,6 +1322,13 @@ int xc_domain_bind_pt_isa_irq( + PT_IRQ_TYPE_ISA, 0, 0, 0, machine_irq)); + } + ++#ifndef min ++#define min(X, Y) ({ \ ++ const typeof (X) _x = (X); \ ++ const typeof (Y) _y = (Y); \ ++ (void) (&_x == &_y); \ ++ (_x < _y) ? _x : _y; }) ++#endif + int xc_domain_memory_mapping( + xc_interface *xch, + uint32_t domid, +@@ -1331,17 +1338,55 @@ int xc_domain_memory_mapping( + uint32_t add_mapping) + { + DECLARE_DOMCTL; ++ int ret = 0, err; ++ unsigned long done = 0, nr, max_batch_sz; ++ ++ if ( !nr_mfns ) ++ return 0; + + domctl.cmd = XEN_DOMCTL_memory_mapping; + domctl.domain = domid; +- domctl.u.memory_mapping.first_gfn = first_gfn; +- domctl.u.memory_mapping.first_mfn = first_mfn; +- domctl.u.memory_mapping.nr_mfns = nr_mfns; + domctl.u.memory_mapping.add_mapping = add_mapping; ++ max_batch_sz = nr_mfns; ++ do ++ { ++ nr = min(nr_mfns - done, max_batch_sz); ++ domctl.u.memory_mapping.nr_mfns = nr; ++ domctl.u.memory_mapping.first_gfn = first_gfn + done; ++ domctl.u.memory_mapping.first_mfn = first_mfn + done; ++ err = do_domctl(xch, &domctl); ++ if ( err && errno == E2BIG ) ++ { ++ if ( max_batch_sz <= 1 ) ++ break; ++ max_batch_sz >>= 1; ++ continue; ++ } ++ /* Save the first error... */ ++ if ( !ret ) ++ ret = err; ++ /* .. and ignore the rest of them when removing. */ ++ if ( err && add_mapping != DPCI_REMOVE_MAPPING ) ++ break; ++ ++ done += nr; ++ } while ( done < nr_mfns ); ++ ++ /* ++ * Undo what we have done unless unmapping, by unmapping the entire region. ++ * Errors here are ignored. ++ */ ++ if ( ret && add_mapping != DPCI_REMOVE_MAPPING ) ++ xc_domain_memory_mapping(xch, domid, first_gfn, first_mfn, nr_mfns, ++ DPCI_REMOVE_MAPPING); ++ ++ /* We might get E2BIG so many times that we never advance. */ ++ if ( !done && !ret ) ++ ret = -1; + +- return do_domctl(xch, &domctl); ++ return ret; + } +- ++#undef min + int xc_domain_ioport_mapping( + xc_interface *xch, + uint32_t domid, + diff --git a/sysutils/xenstoretools/patches/patch-CVE-2015-2756 b/sysutils/xenstoretools/patches/patch-CVE-2015-2756 new file mode 100644 index 00000000000..6b0f28bf69c --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-CVE-2015-2756 @@ -0,0 +1,142 @@ +$NetBSD: patch-CVE-2015-2756,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +patch for CVE-2015-2756 aka XSA-126 from +http://xenbits.xenproject.org/xsa/xsa126-qemut.patch + +--- ioemu-qemu-xen/hw/pass-through.c.orig 2013-07-17 10:59:40.000000000 +0000 ++++ ioemu-qemu-xen/hw/pass-through.c +@@ -171,9 +171,6 @@ static int pt_word_reg_read(struct pt_de + static int pt_long_reg_read(struct pt_dev *ptdev, + struct pt_reg_tbl *cfg_entry, + uint32_t *value, uint32_t valid_mask); +-static int pt_cmd_reg_read(struct pt_dev *ptdev, +- struct pt_reg_tbl *cfg_entry, +- uint16_t *value, uint16_t valid_mask); + static int pt_bar_reg_read(struct pt_dev *ptdev, + struct pt_reg_tbl *cfg_entry, + uint32_t *value, uint32_t valid_mask); +@@ -277,9 +274,9 @@ static struct pt_reg_info_tbl pt_emu_reg + .size = 2, + .init_val = 0x0000, + .ro_mask = 0xF880, +- .emu_mask = 0x0740, ++ .emu_mask = 0x0743, + .init = pt_common_reg_init, +- .u.w.read = pt_cmd_reg_read, ++ .u.w.read = pt_word_reg_read, + .u.w.write = pt_cmd_reg_write, + .u.w.restore = pt_cmd_reg_restore, + }, +@@ -1865,7 +1862,7 @@ static int pt_dev_is_virtfn(struct pci_d + return rc; + } + +-static int pt_register_regions(struct pt_dev *assigned_device) ++static int pt_register_regions(struct pt_dev *assigned_device, uint16_t *cmd) + { + int i = 0; + uint32_t bar_data = 0; +@@ -1885,17 +1882,26 @@ static int pt_register_regions(struct pt + + /* Register current region */ + if ( pci_dev->base_addr[i] & PCI_ADDRESS_SPACE_IO ) ++ { + pci_register_io_region((PCIDevice *)assigned_device, i, + (uint32_t)pci_dev->size[i], PCI_ADDRESS_SPACE_IO, + pt_ioport_map); ++ *cmd |= PCI_COMMAND_IO; ++ } + else if ( pci_dev->base_addr[i] & PCI_ADDRESS_SPACE_MEM_PREFETCH ) ++ { + pci_register_io_region((PCIDevice *)assigned_device, i, + (uint32_t)pci_dev->size[i], PCI_ADDRESS_SPACE_MEM_PREFETCH, + pt_iomem_map); ++ *cmd |= PCI_COMMAND_MEMORY; ++ } + else ++ { + pci_register_io_region((PCIDevice *)assigned_device, i, + (uint32_t)pci_dev->size[i], PCI_ADDRESS_SPACE_MEM, + pt_iomem_map); ++ *cmd |= PCI_COMMAND_MEMORY; ++ } + + PT_LOG("IO region registered (size=0x%08x base_addr=0x%08x)\n", + (uint32_t)(pci_dev->size[i]), +@@ -3221,27 +3227,6 @@ static int pt_long_reg_read(struct pt_de + return 0; + } + +-/* read Command register */ +-static int pt_cmd_reg_read(struct pt_dev *ptdev, +- struct pt_reg_tbl *cfg_entry, +- uint16_t *value, uint16_t valid_mask) +-{ +- struct pt_reg_info_tbl *reg = cfg_entry->reg; +- uint16_t valid_emu_mask = 0; +- uint16_t emu_mask = reg->emu_mask; +- +- if ( ptdev->is_virtfn ) +- emu_mask |= PCI_COMMAND_MEMORY; +- if ( pt_is_iomul(ptdev) ) +- emu_mask |= PCI_COMMAND_IO; +- +- /* emulate word register */ +- valid_emu_mask = emu_mask & valid_mask; +- *value = PT_MERGE_VALUE(*value, cfg_entry->data, ~valid_emu_mask); +- +- return 0; +-} +- + /* read BAR */ + static int pt_bar_reg_read(struct pt_dev *ptdev, + struct pt_reg_tbl *cfg_entry, +@@ -3376,19 +3361,13 @@ static int pt_cmd_reg_write(struct pt_de + uint16_t writable_mask = 0; + uint16_t throughable_mask = 0; + uint16_t wr_value = *value; +- uint16_t emu_mask = reg->emu_mask; +- +- if ( ptdev->is_virtfn ) +- emu_mask |= PCI_COMMAND_MEMORY; +- if ( pt_is_iomul(ptdev) ) +- emu_mask |= PCI_COMMAND_IO; + + /* modify emulate register */ + writable_mask = ~reg->ro_mask & valid_mask; + cfg_entry->data = PT_MERGE_VALUE(*value, cfg_entry->data, writable_mask); + + /* create value for writing to I/O device register */ +- throughable_mask = ~emu_mask & valid_mask; ++ throughable_mask = ~reg->emu_mask & valid_mask; + + if (*value & PCI_COMMAND_DISABLE_INTx) + { +@@ -4151,6 +4130,7 @@ static struct pt_dev * register_real_dev + struct pt_dev *assigned_device = NULL; + struct pci_dev *pci_dev; + uint8_t e_device, e_intx; ++ uint16_t cmd = 0; + char *key, *val; + int msi_translate, power_mgmt; + +@@ -4240,7 +4220,7 @@ static struct pt_dev * register_real_dev + assigned_device->dev.config[i] = pci_read_byte(pci_dev, i); + + /* Handle real device's MMIO/PIO BARs */ +- pt_register_regions(assigned_device); ++ pt_register_regions(assigned_device, &cmd); + + /* Setup VGA bios for passthroughed gfx */ + if ( setup_vga_pt(assigned_device) < 0 ) +@@ -4318,6 +4298,10 @@ static struct pt_dev * register_real_dev + } + + out: ++ if (cmd) ++ pci_write_word(pci_dev, PCI_COMMAND, ++ *(uint16_t *)(&assigned_device->dev.config[PCI_COMMAND]) | cmd); ++ + PT_LOG("Real physical device %02x:%02x.%x registered successfuly!\n" + "IRQ type = %s\n", r_bus, r_dev, r_func, + assigned_device->msi_trans_en? "MSI-INTx":"INTx"); diff --git a/sysutils/xenstoretools/patches/patch-CVE-2015-8550 b/sysutils/xenstoretools/patches/patch-CVE-2015-8550 new file mode 100644 index 00000000000..b19e1979549 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-CVE-2015-8550 @@ -0,0 +1,134 @@ +$NetBSD: patch-CVE-2015-8550,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +patch for CVE-2015-8550 aka XSA-155 from +http://xenbits.xenproject.org/xsa/xsa155-xen-0001-xen-Add-RING_COPY_REQUEST.patch +http://xenbits.xenproject.org/xsa/xsa155-xen-0002-blktap2-Use-RING_COPY_REQUEST.patch +http://xenbits.xenproject.org/xsa/xsa155-qemut-qdisk-double-access.patch +http://xenbits.xenproject.org/xsa/xsa155-qemut-xenfb.patch + +--- ../xen/include/public/io/ring.h.orig ++++ ../xen/include/public/io/ring.h +@@ -212,6 +212,20 @@ typedef struct __name##_back_ring __name##_back_ring_t + #define RING_GET_REQUEST(_r, _idx) \ + (&((_r)->sring->ring[((_idx) & (RING_SIZE(_r) - 1))].req)) + ++/* ++ * Get a local copy of a request. ++ * ++ * Use this in preference to RING_GET_REQUEST() so all processing is ++ * done on a local copy that cannot be modified by the other end. ++ * ++ * Note that https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145 may cause this ++ * to be ineffective where _req is a struct which consists of only bitfields. ++ */ ++#define RING_COPY_REQUEST(_r, _idx, _req) do { \ ++ /* Use volatile to force the copy into _req. */ \ ++ *(_req) = *(volatile typeof(_req))RING_GET_REQUEST(_r, _idx); \ ++} while (0) ++ + #define RING_GET_RESPONSE(_r, _idx) \ + (&((_r)->sring->ring[((_idx) & (RING_SIZE(_r) - 1))].rsp)) + +--- blktap2/drivers/block-log.c.orig ++++ blktap2/drivers/block-log.c +@@ -494,11 +494,12 @@ static int ctl_kick(struct tdlog_state* s, int fd) + reqstart = s->bring.req_cons; + reqend = s->sring->req_prod; + ++ xen_mb(); + BDPRINTF("ctl: ring kicked (start = %u, end = %u)", reqstart, reqend); + + while (reqstart != reqend) { + /* XXX actually submit these! */ +- memcpy(&req, RING_GET_REQUEST(&s->bring, reqstart), sizeof(req)); ++ RING_COPY_REQUEST(&s->bring, reqstart, &req); + BDPRINTF("ctl: read request %"PRIu64":%u", req.sector, req.count); + s->bring.req_cons = ++reqstart; + +--- blktap2/drivers/tapdisk-vbd.c.orig ++++ blktap2/drivers/tapdisk-vbd.c +@@ -1555,7 +1555,7 @@ tapdisk_vbd_pull_ring_requests(td_vbd_t *vbd) + int idx; + RING_IDX rp, rc; + td_ring_t *ring; +- blkif_request_t *req; ++ blkif_request_t req; + td_vbd_request_t *vreq; + + ring = &vbd->ring; +@@ -1566,16 +1566,16 @@ tapdisk_vbd_pull_ring_requests(td_vbd_t *vbd) + xen_rmb(); + + for (rc = ring->fe_ring.req_cons; rc != rp; rc++) { +- req = RING_GET_REQUEST(&ring->fe_ring, rc); ++ RING_COPY_REQUEST(&ring->fe_ring, rc, &req); + ++ring->fe_ring.req_cons; + +- idx = req->id; ++ idx = req.id; + vreq = &vbd->request_list[idx]; + + ASSERT(list_empty(&vreq->next)); + ASSERT(vreq->secs_pending == 0); + +- memcpy(&vreq->req, req, sizeof(blkif_request_t)); ++ memcpy(&vreq->req, &req, sizeof(blkif_request_t)); + vbd->received++; + vreq->vbd = vbd; + +--- ioemu-qemu-xen/hw/xen_blkif.h.orig ++++ ioemu-qemu-xen/hw/xen_blkif.h +@@ -79,8 +79,10 @@ static inline void blkif_get_x86_32_req(blkif_request_t *dst, blkif_x86_32_reque + dst->handle = src->handle; + dst->id = src->id; + dst->sector_number = src->sector_number; +- if (n > src->nr_segments) +- n = src->nr_segments; ++ /* prevent the compiler from optimizing the code and using src->nr_segments instead */ ++ xen_mb(); ++ if (n > dst->nr_segments) ++ n = dst->nr_segments; + for (i = 0; i < n; i++) + dst->seg[i] = src->seg[i]; + } +@@ -94,8 +96,10 @@ static inline void blkif_get_x86_64_req(blkif_request_t *dst, blkif_x86_64_reque + dst->handle = src->handle; + dst->id = src->id; + dst->sector_number = src->sector_number; +- if (n > src->nr_segments) +- n = src->nr_segments; ++ /* prevent the compiler from optimizing the code and using src->nr_segments instead */ ++ xen_mb(); ++ if (n > dst->nr_segments) ++ n = dst->nr_segments; + for (i = 0; i < n; i++) + dst->seg[i] = src->seg[i]; + } + +--- ioemu-qemu-xen/hw/xenfb.c ++++ ioemu-qemu-xen/hw/xenfb.c +@@ -827,18 +827,20 @@ static void xenfb_invalidate(void *opaque) + + static void xenfb_handle_events(struct XenFB *xenfb) + { +- uint32_t prod, cons; ++ uint32_t prod, cons, out_cons; + struct xenfb_page *page = xenfb->c.page; + + prod = page->out_prod; +- if (prod == page->out_cons) ++ out_cons = page->out_cons; ++ if (prod == out_cons) + return; + xen_rmb(); /* ensure we see ring contents up to prod */ +- for (cons = page->out_cons; cons != prod; cons++) { ++ for (cons = out_cons; cons != prod; cons++) { + union xenfb_out_event *event = &XENFB_OUT_RING_REF(page, cons); ++ uint8_t type = event->type; + int x, y, w, h; + +- switch (event->type) { ++ switch (type) { + case XENFB_TYPE_UPDATE: + if (xenfb->up_count == UP_QUEUE) + xenfb->up_fullscreen = 1; diff --git a/sysutils/xenstoretools/patches/patch-CVE-2015-8554 b/sysutils/xenstoretools/patches/patch-CVE-2015-8554 new file mode 100644 index 00000000000..75e640bae27 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-CVE-2015-8554 @@ -0,0 +1,21 @@ +$NetBSD: patch-CVE-2015-8554,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +patch for CVE-2015-8554 aka XSA-164 from +http://xenbits.xenproject.org/xsa/xsa164.patch + +--- ioemu-qemu-xen/hw/pt-msi.c.orig ++++ ioemu-qemu-xen/hw/pt-msi.c +@@ -440,6 +440,13 @@ static void pci_msix_writel(void *opaque + return; + } + ++ if ( addr - msix->mmio_base_addr >= msix->total_entries * 16 ) ++ { ++ PT_LOG("Error: Out of bounds write to MSI-X table," ++ " addr %016"PRIx64"\n", addr); ++ return; ++ } ++ + entry_nr = (addr - msix->mmio_base_addr) / 16; + entry = &msix->msix_entry[entry_nr]; + offset = ((addr - msix->mmio_base_addr) % 16) / 4; diff --git a/sysutils/xenstoretools/patches/patch-XSA-197 b/sysutils/xenstoretools/patches/patch-XSA-197 new file mode 100644 index 00000000000..3721c7efed1 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-XSA-197 @@ -0,0 +1,69 @@ +$NetBSD: patch-XSA-197,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +Backported from: + +From: Jan Beulich <jbeulich@suse.com> +Subject: xen: fix ioreq handling + +Avoid double fetches and bounds check size to avoid overflowing +internal variables. + +This is XSA-197. + +Reported-by: yanghongke <yanghongke@huawei.com> +Signed-off-by: Jan Beulich <jbeulich@suse.com> +Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com> + +--- ioemu-qemu-xen/i386-dm/helper2.c.orig 2013-07-17 12:59:40.000000000 +0200 ++++ ioemu-qemu-xen/i386-dm/helper2.c 2016-11-22 16:15:32.000000000 +0100 +@@ -333,6 +333,11 @@ + + sign = req->df ? -1 : 1; + ++ if (req->size > sizeof(unsigned long)) { ++ fprintf(stderr, "PIO: bad size (%u)\n", req->size); ++ exit(-1); ++ } ++ + if (req->dir == IOREQ_READ) { + if (!req->data_is_ptr) { + req->data = do_inp(env, req->addr, req->size); +@@ -368,6 +373,11 @@ + + sign = req->df ? -1 : 1; + ++ if (req->size > sizeof(req->data)) { ++ fprintf(stderr, "MMIO: bad size (%u)\n", req->size); ++ exit(-1); ++ } ++ + if (!req->data_is_ptr) { + if (req->dir == IOREQ_READ) { + for (i = 0; i < req->count; i++) { +@@ -481,11 +491,13 @@ + req.df = 1; + req.type = buf_req->type; + req.data_is_ptr = 0; ++ xen_rmb(); + qw = (req.size == 8); + if (qw) { + buf_req = &buffered_io_page->buf_ioreq[ + (buffered_io_page->read_pointer+1) % IOREQ_BUFFER_SLOT_NUM]; + req.data |= ((uint64_t)buf_req->data) << 32; ++ xen_rmb(); + } + + __handle_ioreq(env, &req); +@@ -512,7 +524,11 @@ + + __handle_buffered_iopage(env); + if (req) { +- __handle_ioreq(env, req); ++ ioreq_t copy = *req; ++ ++ xen_rmb(); ++ __handle_ioreq(env, ©); ++ req->data = copy.data; + + if (req->state != STATE_IOREQ_INPROCESS) { + fprintf(logfile, "Badness in I/O request ... not in service?!: " diff --git a/sysutils/xenstoretools/patches/patch-XSA-198 b/sysutils/xenstoretools/patches/patch-XSA-198 new file mode 100644 index 00000000000..251222f0feb --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-XSA-198 @@ -0,0 +1,58 @@ +$NetBSD: patch-XSA-198,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +Backported from: + +From 71a389ae940bc52bf897a6e5becd73fd8ede94c5 Mon Sep 17 00:00:00 2001 +From: Ian Jackson <ian.jackson@eu.citrix.com> +Date: Thu, 3 Nov 2016 16:37:40 +0000 +Subject: [PATCH] pygrub: Properly quote results, when returning them to the + caller: + +* When the caller wants sexpr output, use `repr()' + This is what Xend expects. + + The returned S-expressions are now escaped and quoted by Python, + generally using '...'. Previously kernel and ramdisk were unquoted + and args was quoted with "..." but without proper escaping. This + change may break toolstacks which do not properly dequote the + returned S-expressions. + +* When the caller wants "simple" output, crash if the delimiter is + contained in the returned value. + + With --output-format=simple it does not seem like this could ever + happen, because the bootloader config parsers all take line-based + input from the various bootloader config files. + + With --output-format=simple0, this can happen if the bootloader + config file contains nul bytes. + +This is XSA-198. + +Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> +Tested-by: Ian Jackson <Ian.Jackson@eu.citrix.com> +Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> + +--- pygrub/src/pygrub.orig 2013-09-10 08:42:18.000000000 +0200 ++++ pygrub/src/pygrub 2016-11-22 16:26:10.000000000 +0100 +@@ -653,14 +653,17 @@ + return cfg + + def format_sxp(kernel, ramdisk, args): +- s = "linux (kernel %s)" % kernel ++ s = "linux (kernel %s)" % repr(kernel) + if ramdisk: +- s += "(ramdisk %s)" % ramdisk ++ s += "(ramdisk %s)" % repr(ramdisk) + if args: +- s += "(args \"%s\")" % args ++ s += "(args %s)" % repr(args) + return s + + def format_simple(kernel, ramdisk, args, sep): ++ for check in (kernel, ramdisk, args): ++ if check is not None and sep in check: ++ raise RuntimeError, "simple format cannot represent delimiter-containing value" + s = ("kernel %s" % kernel) + sep + if ramdisk: + s += ("ramdisk %s" % ramdisk) + sep diff --git a/sysutils/xenstoretools/patches/patch-XSA-199 b/sysutils/xenstoretools/patches/patch-XSA-199 new file mode 100644 index 00000000000..da2d4932210 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-XSA-199 @@ -0,0 +1,90 @@ +$NetBSD: patch-XSA-199,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +From b73bd1edc05d1bad5c018228146930d79315a5da Mon Sep 17 00:00:00 2001 +From: Ian Jackson <ian.jackson@eu.citrix.com> +Date: Mon, 14 Nov 2016 17:19:46 +0000 +Subject: [PATCH] qemu: ioport_read, ioport_write: be defensive about 32-bit + addresses + +On x86, ioport addresses are 16-bit. That these functions take 32-bit +arguments is a mistake. Changing the argument type to 16-bit will +discard the top bits of any erroneous values from elsewhere in qemu. + +Also, check just before use that the value is in range. (This turns +an ill-advised change to MAX_IOPORTS into a possible guest crash +rather than a privilege escalation vulnerability.) + +And, in the Xen ioreq processor, clamp incoming ioport addresses to +16-bit values. Xen will never write >16-bit values but the guest may +have access to the ioreq ring. We want to defend the rest of the qemu +code from wrong values. + +This is XSA-199. + +Reported-by: yanghongke <yanghongke@huawei.com> +Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> +--- + i386-dm/helper2.c | 2 ++ + vl.c | 9 +++++++-- + 2 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/i386-dm/helper2.c b/i386-dm/helper2.c +index 2706f2e..5d276bb 100644 +--- ioemu-qemu-xen/i386-dm/helper2.c.orig ++++ ioemu-qemu-xen/i386-dm/helper2.c +@@ -375,6 +375,8 @@ static void cpu_ioreq_pio(CPUState *env, ioreq_t *req) + + sign = req->df ? -1 : 1; + ++ req->addr &= 0x0ffffU; ++ + if (req->size > sizeof(req->data)) { + fprintf(stderr, "MMIO: bad size (%u)\n", req->size); + exit(-1); +diff --git a/vl.c b/vl.c +index f9c4d7e..c3c5d63 100644 +--- ioemu-qemu-xen/vl.c.orig ++++ ioemu-qemu-xen/vl.c +@@ -52,6 +52,7 @@ + + #include <xen/hvm/hvm_info_table.h> + ++#include <assert.h> + #include <unistd.h> + #include <fcntl.h> + #include <signal.h> +@@ -290,26 +291,30 @@ PicState2 *isa_pic; + static IOPortReadFunc default_ioport_readb, default_ioport_readw, default_ioport_readl; + static IOPortWriteFunc default_ioport_writeb, default_ioport_writew, default_ioport_writel; + +-static uint32_t ioport_read(int index, uint32_t address) ++static uint32_t ioport_read(int index, uint16_t address) + { + static IOPortReadFunc *default_func[3] = { + default_ioport_readb, + default_ioport_readw, + default_ioport_readl + }; ++ if (address >= MAX_IOPORTS) ++ abort(); + IOPortReadFunc *func = ioport_read_table[index][address]; + if (!func) + func = default_func[index]; + return func(ioport_opaque[address], address); + } + +-static void ioport_write(int index, uint32_t address, uint32_t data) ++static void ioport_write(int index, uint16_t address, uint32_t data) + { + static IOPortWriteFunc *default_func[3] = { + default_ioport_writeb, + default_ioport_writew, + default_ioport_writel + }; ++ if (address >= MAX_IOPORTS) ++ abort(); + IOPortWriteFunc *func = ioport_write_table[index][address]; + if (!func) + func = default_func[index]; +-- +2.1.4 diff --git a/sysutils/xenstoretools/patches/patch-aa b/sysutils/xenstoretools/patches/patch-aa new file mode 100644 index 00000000000..7ef14497428 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-aa @@ -0,0 +1,12 @@ +$NetBSD: patch-aa,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- xentrace/Makefile.orig 2010-04-07 16:12:05.000000000 +0000 ++++ xentrace/Makefile +@@ -43,6 +43,7 @@ install: build + [ -z "$(LIBBIN)" ] || $(INSTALL_PROG) $(LIBBIN) $(DESTDIR)$(PRIVATE_BINDIR) + $(INSTALL_DATA) $(MAN1) $(DESTDIR)$(MAN1DIR) + $(INSTALL_DATA) $(MAN8) $(DESTDIR)$(MAN8DIR) ++ $(INSTALL_DATA) formats $(DESTDIR)$(EGDIR) + + .PHONY: clean + clean: diff --git a/sysutils/xenstoretools/patches/patch-ab b/sysutils/xenstoretools/patches/patch-ab new file mode 100644 index 00000000000..f34e712c04b --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-ab @@ -0,0 +1,16 @@ +$NetBSD: patch-ab,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- blktap/drivers/Makefile.orig 2008-08-01 16:38:07.000000000 +0200 ++++ blktap/drivers/Makefile +@@ -37,9 +37,11 @@ BLK-OBJS-y += block-qcow2.o + BLK-OBJS-y += aes.o + BLK-OBJS-y += tapaio.o + BLK-OBJS-$(CONFIG_Linux) += blk_linux.o ++BLK-OBJS-$(CONFIG_NetBSD) += blk_netbsd.o + + BLKTAB-OBJS-y := blktapctrl.o + BLKTAB-OBJS-$(CONFIG_Linux) += blktapctrl_linux.o ++BLKTAB-OBJS-$(CONFIG_NetBSD) += blktapctrl_netbsd.o + + all: $(IBIN) qcow-util + diff --git a/sysutils/xenstoretools/patches/patch-ac b/sysutils/xenstoretools/patches/patch-ac new file mode 100644 index 00000000000..b44a8d2c968 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-ac @@ -0,0 +1,13 @@ +$NetBSD: patch-ac,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- libfsimage/common/Makefile.orig 2010-05-11 21:27:58.000000000 +0000 ++++ libfsimage/common/Makefile +@@ -4,6 +4,8 @@ include $(XEN_ROOT)/tools/Rules.mk + MAJOR = 1.0 + MINOR = 0 + ++CFLAGS += -DFSIMAGE_FSDIR=\"$(LIBDIR)/fs\" ++ + LDFLAGS-$(CONFIG_SunOS) = -Wl,-M -Wl,mapfile-SunOS + LDFLAGS-$(CONFIG_Linux) = -Wl,mapfile-GNU + LDFLAGS = $(LDFLAGS-y) diff --git a/sysutils/xenstoretools/patches/patch-ad b/sysutils/xenstoretools/patches/patch-ad new file mode 100644 index 00000000000..c9946f251a6 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-ad @@ -0,0 +1,13 @@ +$NetBSD: patch-ad,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- examples/xend-config.sxp.orig 2010-04-07 16:12:04.000000000 +0000 ++++ examples/xend-config.sxp +@@ -190,7 +190,7 @@ + + # Whether to enable auto-ballooning of dom0 to allow domUs to be created. + # If enable-dom0-ballooning = no, dom0 will never balloon out. +-(enable-dom0-ballooning yes) ++(enable-dom0-ballooning no) + + # 32-bit paravirtual domains can only consume physical + # memory below 168GB. On systems with memory beyond that address, diff --git a/sysutils/xenstoretools/patches/patch-ae b/sysutils/xenstoretools/patches/patch-ae new file mode 100644 index 00000000000..0fb34de990e --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-ae @@ -0,0 +1,14 @@ +$NetBSD: patch-ae,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- Makefile.orig 2011-10-20 17:05:41.000000000 +0000 ++++ Makefile +@@ -24,7 +24,8 @@ SUBDIRS-$(CONFIG_Linux) += memshr + SUBDIRS-$(CONFIG_Linux) += blktap + SUBDIRS-$(CONFIG_Linux) += blktap2 + SUBDIRS-$(CONFIG_NetBSD) += libaio +-SUBDIRS-$(CONFIG_NetBSD) += blktap2 ++SUBDIRS-$(CONFIG_NetBSD) += blktap ++#SUBDIRS-$(CONFIG_NetBSD) += blktap2 + SUBDIRS-$(CONFIG_NetBSD) += xenbackendd + SUBDIRS-y += libfsimage + SUBDIRS-$(LIBXENAPI_BINDINGS) += libxen diff --git a/sysutils/xenstoretools/patches/patch-af b/sysutils/xenstoretools/patches/patch-af new file mode 100644 index 00000000000..8f332f5d439 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-af @@ -0,0 +1,26 @@ +$NetBSD: patch-af,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- firmware/etherboot/Makefile.orig 2011-03-25 10:42:50.000000000 +0000 ++++ firmware/etherboot/Makefile +@@ -34,18 +34,10 @@ eb-roms.h: Config + $(MAKE) NO_WERROR=1 $@.new + mv -f $@.new $@ + +-$T: +- if ! wget -O _$T $(IPXE_TARBALL_URL); then \ +- $(GIT) clone $(IPXE_GIT_URL) $D.git; \ +- (cd $D.git && $(GIT) archive --format=tar --prefix=$D/ \ +- $(IPXE_GIT_TAG) | gzip >../_$T); \ +- rm -rf $D.git; \ +- fi +- mv _$T $T ++$D: ++ ln -sf $(WRKSRC)/../../ipxe $D + +-$D/src/arch/i386/Makefile: $T Config +- rm -rf $D +- gzip -dc $T | tar xf - ++$D/src/arch/i386/Makefile: $D Config + for i in $$(cat patches/series) ; do \ + patch -d $D -p1 --quiet <patches/$$i || exit 1 ; \ + done diff --git a/sysutils/xenstoretools/patches/patch-ag b/sysutils/xenstoretools/patches/patch-ag new file mode 100644 index 00000000000..1ea47d7b91a --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-ag @@ -0,0 +1,23 @@ +$NetBSD: patch-ag,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- ../config/NetBSD.mk.orig 2011-03-25 11:42:47.000000000 +0100 ++++ ../config/NetBSD.mk 2011-04-15 11:36:19.000000000 +0200 +@@ -7,12 +7,13 @@ + LIBEXEC = $(PREFIX)/libexec + PRIVATE_BINDIR = $(BINDIR) + ++MANDIR = $(PREFIX)/man ++MAN1DIR = $(MANDIR)/man1 ++MAN8DIR = $(MANDIR)/man8 ++ + DLOPEN_LIBS = + +-ifeq ($(PREFIX),/usr) +-XEN_LOCK_DIR = /var/lib +-else +-XEN_LOCK_DIR = $(PREFIX)/var/lib +-endif ++XEN_LOCK_DIR = $(VARBASE)/run ++XEN_EXAMPLES_DIR=$(PREFIX)/share/examples/xen + + WGET = ftp diff --git a/sysutils/xenstoretools/patches/patch-ah b/sysutils/xenstoretools/patches/patch-ah new file mode 100644 index 00000000000..b4a677599b7 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-ah @@ -0,0 +1,40 @@ +$NetBSD: patch-ah,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- hotplug/NetBSD/Makefile.orig 2011-03-25 11:42:50.000000000 +0100 ++++ hotplug/NetBSD/Makefile 2011-04-15 11:38:32.000000000 +0200 +@@ -8,7 +8,7 @@ + XEN_SCRIPTS += vif-ip + + XEN_SCRIPT_DATA = +-XEN_RCD_PROG = rc.d/xencommons rc.d/xend rc.d/xendomains rc.d/xen-watchdog ++#XEN_RCD_PROG = rc.d/xencommons rc.d/xend rc.d/xendomains rc.d/xen-watchdog + + .PHONY: all + all: +@@ -21,10 +21,11 @@ + + .PHONY: install-scripts + install-scripts: +- $(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR) ++ $(INSTALL_DIR) $(DESTDIR)$(XEN_EXAMPLES_DIR) ++ $(INSTALL_DIR) $(DESTDIR)$(XEN_EXAMPLES_DIR)/scripts + set -e; for i in $(XEN_SCRIPTS); \ + do \ +- $(INSTALL_PROG) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \ ++ $(INSTALL_PROG) $$i $(DESTDIR)$(XEN_EXAMPLES_DIR)/scripts; \ + done + set -e; for i in $(XEN_SCRIPT_DATA); \ + do \ +@@ -33,12 +34,6 @@ + + .PHONY: install-rcd + install-rcd: +- $(INSTALL_DIR) $(DESTDIR)$(CONFIG_DIR)/rc.d +- set -e; for i in $(XEN_RCD_PROG); \ +- do \ +- $(INSTALL_PROG) $$i $(DESTDIR)$(CONFIG_DIR)/rc.d; \ +- done +- $(INSTALL_DATA) ../common/hotplugpath.sh $(DESTDIR)$(CONFIG_DIR)/rc.d/xen-hotplugpath.sh + + .PHONY: clean + clean: diff --git a/sysutils/xenstoretools/patches/patch-ai b/sysutils/xenstoretools/patches/patch-ai new file mode 100644 index 00000000000..ee96fc68d4a --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-ai @@ -0,0 +1,18 @@ +$NetBSD: patch-ai,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- python/xen/xend/osdep.py.orig 2011-04-01 12:03:13.000000000 +0200 ++++ python/xen/xend/osdep.py 2011-04-01 13:49:45.000000000 +0200 +@@ -94,8 +94,12 @@ + return None + cmd = "/sbin/sysctl " + cmdarg + sysctloutput = commands.getoutput(cmd) ++ div = 1 ++ if label == 'current' and '=' not in sysctloutput: ++ sysctloutput = commands.getoutput( "/sbin/sysctl hw.physmem64") ++ div = 1024 + (name, value) = sysctloutput.split('=') +- return int(value) ++ return int(value) / div + + def _solaris_balloon_stat(label): + """Returns the value for the named label, or None if an error occurs.""" diff --git a/sysutils/xenstoretools/patches/patch-aj b/sysutils/xenstoretools/patches/patch-aj new file mode 100644 index 00000000000..afd5cfd504b --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-aj @@ -0,0 +1,16 @@ +$NetBSD: patch-aj,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- hotplug/NetBSD/vif-bridge.orig 2011-03-25 11:42:50.000000000 +0100 ++++ hotplug/NetBSD/vif-bridge 2011-04-01 14:55:58.000000000 +0200 +@@ -23,7 +23,10 @@ + xbridge=$(xenstore-read "$xpath/bridge") + xfid=$(xenstore-read "$xpath/frontend-id") + xhandle=$(xenstore-read "$xpath/handle") +- iface=$(xenstore-read "$xpath/vifname") ++ iface=$(xenstore-read "$xpath/vifname") || true ++ if [ x${iface} = "x" ] ; then ++ iface=xvif$xfid.$xhandle ++ fi + echo ifconfig $iface up + ifconfig $iface up + brconfig $xbridge add $iface diff --git a/sysutils/xenstoretools/patches/patch-ak b/sysutils/xenstoretools/patches/patch-ak new file mode 100644 index 00000000000..2557e72a616 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-ak @@ -0,0 +1,16 @@ +$NetBSD: patch-ak,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- hotplug/NetBSD/vif-ip.orig 2011-04-01 16:04:24.000000000 +0200 ++++ hotplug/NetBSD/vif-ip 2011-04-01 16:04:54.000000000 +0200 +@@ -23,7 +23,10 @@ + xip=$(xenstore-read "$xpath/ip") + xfid=$(xenstore-read "$xpath/frontend-id") + xhandle=$(xenstore-read "$xpath/handle") +- iface=$(xenstore-read "$xpath/vifname") ++ iface=$(xenstore-read "$xpath/vifname") || true ++ if [ x${iface} = "x" ] ; then ++ iface=xvif$xfid.$xhandle ++ fi + echo ifconfig $iface $xip up + ifconfig $iface $xip up + xenstore-write $xpath/hotplug-status connected diff --git a/sysutils/xenstoretools/patches/patch-al b/sysutils/xenstoretools/patches/patch-al new file mode 100644 index 00000000000..86c63b98d29 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-al @@ -0,0 +1,12 @@ +$NetBSD: patch-al,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- ioemu-qemu-xen/i386-dm/hookstarget.mak.orig 2011-04-15 11:45:21.000000000 +0200 ++++ ioemu-qemu-xen/i386-dm/hookstarget.mak 2011-04-15 11:46:36.000000000 +0200 +@@ -2,5 +2,5 @@ + + install-hook: + $(INSTALL_DIR) "$(DESTDIR)/$(bindir)" +- $(INSTALL_DIR) "$(DESTDIR)/$(configdir)" +- $(INSTALL_PROG) $(QEMU_ROOT)/i386-dm/qemu-ifup-$(IOEMU_OS) "$(DESTDIR)/$(configdir)/qemu-ifup" ++ $(INSTALL_DIR) "$(DESTDIR)/$(XEN_EXAMPLES_DIR)/scripts" ++ $(INSTALL_PROG) $(QEMU_ROOT)/i386-dm/qemu-ifup-$(IOEMU_OS) "$(DESTDIR)/$(XEN_EXAMPLES_DIR)/scripts/qemu-ifup" diff --git a/sysutils/xenstoretools/patches/patch-am b/sysutils/xenstoretools/patches/patch-am new file mode 100644 index 00000000000..706fa22c53a --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-am @@ -0,0 +1,13 @@ +$NetBSD: patch-am,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- libxc/xc_dom.h.orig 2013-11-29 18:20:47.000000000 +0000 ++++ libxc/xc_dom.h 2013-11-29 18:22:14.000000000 +0000 +@@ -303,7 +303,7 @@ static inline void *xc_dom_vaddr_to_ptr( + if ( ptr == NULL ) + return ptr; + *safe_region_out = (safe_region_count << XC_DOM_PAGE_SHIFT(dom)) - offset; +- return ptr; ++ return ptr + offset; + } + + static inline int xc_dom_feature_translated(struct xc_dom_image *dom) diff --git a/sysutils/xenstoretools/patches/patch-ba b/sysutils/xenstoretools/patches/patch-ba new file mode 100644 index 00000000000..fe0f7e7d553 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-ba @@ -0,0 +1,56 @@ +$NetBSD: patch-ba,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- python/xen/xend/XendNode.py.orig 2010-04-07 16:12:05.000000000 +0000 ++++ python/xen/xend/XendNode.py +@@ -276,28 +276,29 @@ class XendNode: + except KeyError: + pass + +- for pci_dev in PciUtil.get_all_pci_devices(): +- ppci_record = { +- 'domain': pci_dev.domain, +- 'bus': pci_dev.bus, +- 'slot': pci_dev.slot, +- 'func': pci_dev.func, +- 'vendor_id': pci_dev.vendor, +- 'vendor_name': pci_dev.vendorname, +- 'device_id': pci_dev.device, +- 'device_name': pci_dev.devicename, +- 'revision_id': pci_dev.revision, +- 'class_code': pci_dev.classcode, +- 'class_name': pci_dev.classname, +- 'subsystem_vendor_id': pci_dev.subvendor, +- 'subsystem_vendor_name': pci_dev.subvendorname, +- 'subsystem_id': pci_dev.subdevice, +- 'subsystem_name': pci_dev.subdevicename, +- 'driver': pci_dev.driver +- } +- # If saved uuid exists, use it. Otherwise create one. +- ppci_uuid = saved_ppci_table.get(pci_dev.name, uuid.createString()) +- XendPPCI(ppci_uuid, ppci_record) ++ pass ++ #for pci_dev in PciUtil.get_all_pci_devices(): ++ # ppci_record = { ++ # 'domain': pci_dev.domain, ++ # 'bus': pci_dev.bus, ++ # 'slot': pci_dev.slot, ++ # 'func': pci_dev.func, ++ # 'vendor_id': pci_dev.vendor, ++ # 'vendor_name': pci_dev.vendorname, ++ # 'device_id': pci_dev.device, ++ # 'device_name': pci_dev.devicename, ++ # 'revision_id': pci_dev.revision, ++ # 'class_code': pci_dev.classcode, ++ # 'class_name': pci_dev.classname, ++ # 'subsystem_vendor_id': pci_dev.subvendor, ++ # 'subsystem_vendor_name': pci_dev.subvendorname, ++ # 'subsystem_id': pci_dev.subdevice, ++ # 'subsystem_name': pci_dev.subdevicename, ++ # 'driver': pci_dev.driver ++ # } ++ # # If saved uuid exists, use it. Otherwise create one. ++ # ppci_uuid = saved_ppci_table.get(pci_dev.name, uuid.createString()) ++ # XendPPCI(ppci_uuid, ppci_record) + + def _init_PSCSIs(self): + # Initialise PSCSIs and PSCSI_HBAs diff --git a/sysutils/xenstoretools/patches/patch-bb b/sysutils/xenstoretools/patches/patch-bb new file mode 100644 index 00000000000..6a390db7705 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-bb @@ -0,0 +1,213 @@ +$NetBSD: patch-bb,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- libxc/xc_netbsd.c.orig 2011-03-29 17:09:58.000000000 +0000 ++++ libxc/xc_netbsd.c +@@ -21,6 +21,7 @@ + #include "xc_private.h" + + #include <xen/sys/evtchn.h> ++#include <xen/sys/gntdev.h> + #include <unistd.h> + #include <fcntl.h> + +@@ -351,7 +352,189 @@ void discard_file_cache(xc_interface *xc + errno = saved_errno; + } + +-static struct xc_osdep_ops *netbsd_osdep_init(xc_interface *xch, enum xc_osdep_type type) ++#define DEVXEN "/dev/xen/" ++ ++static xc_osdep_handle ++netbsd_gnttab_open(xc_gnttab *xcg) ++{ ++ int fd; ++ ++ fd = open(DEVXEN "gntdev", O_RDWR); ++ if (fd == -1) ++ return XC_OSDEP_OPEN_ERROR; ++ ++ return (xc_osdep_handle)fd; ++} ++ ++static int ++netbsd_gnttab_close(xc_gnttab *xcg, xc_osdep_handle h) ++{ ++ int fd = (int)h; ++ return close(fd); ++} ++ ++static void * ++netbsd_gnttab_map_grant_ref(xc_gnttab *xch, xc_osdep_handle h, ++ uint32_t domid, uint32_t ref, int prot) ++{ ++ int fd = (int)h; ++ struct ioctl_gntdev_map_grant_ref map; ++ void *addr; ++ ++ map.count = 1; ++ map.refs[0].domid = domid; ++ map.refs[0].ref = ref; ++ ++ if ( ioctl(fd, IOCTL_GNTDEV_MAP_GRANT_REF, &map) ) { ++ PERROR("netbsd_gnttab_map_grant_ref: ioctl MAP_GRANT_REF failed"); ++ return NULL; ++ } ++ ++mmap_again: ++ addr = mmap(NULL, XC_PAGE_SIZE, prot, MAP_SHARED, fd, map.index); ++ if ( addr == MAP_FAILED ) ++ { ++ int saved_errno = errno; ++ struct ioctl_gntdev_unmap_grant_ref unmap_grant; ++ ++ if ( saved_errno == EAGAIN ) ++ { ++ usleep(1000); ++ goto mmap_again; ++ } ++ /* Unmap the driver slots used to store the grant information. */ ++ PERROR("netbsd_gnttab_map_grant_ref: mmap failed"); ++ unmap_grant.index = map.index; ++ unmap_grant.count = 1; ++ ioctl(fd, IOCTL_GNTDEV_UNMAP_GRANT_REF, &unmap_grant); ++ errno = saved_errno; ++ return NULL; ++ } ++ ++ return addr; ++} ++ ++static void * ++do_gnttab_map_grant_refs(xc_gnttab *xch, xc_osdep_handle h, ++ uint32_t count, uint32_t *domids, int domids_stride, ++ uint32_t *refs, int prot) ++{ ++ int fd = (int)h; ++ struct ioctl_gntdev_map_grant_ref *map; ++ void *addr = NULL; ++ int i; ++ ++ map = malloc(sizeof(*map) + ++ (count - 1) * sizeof(struct ioctl_gntdev_map_grant_ref)); ++ if ( map == NULL ) ++ return NULL; ++ ++ for ( i = 0; i < count; i++ ) ++ { ++ map->refs[i].domid = domids[i * domids_stride]; ++ map->refs[i].ref = refs[i]; ++ } ++ ++ map->count = count; ++ ++ if ( ioctl(fd, IOCTL_GNTDEV_MAP_GRANT_REF, map) ) { ++ PERROR("xc_gnttab_map_grant_refs: ioctl MAP_GRANT_REF failed"); ++ goto out; ++ } ++ ++ addr = mmap(NULL, XC_PAGE_SIZE * count, prot, MAP_SHARED, fd, ++ map->index); ++ if ( addr == MAP_FAILED ) ++ { ++ int saved_errno = errno; ++ struct ioctl_gntdev_unmap_grant_ref unmap_grant; ++ ++ /* Unmap the driver slots used to store the grant information. */ ++ PERROR("xc_gnttab_map_grant_refs: mmap failed"); ++ unmap_grant.index = map->index; ++ unmap_grant.count = count; ++ ioctl(fd, IOCTL_GNTDEV_UNMAP_GRANT_REF, &unmap_grant); ++ errno = saved_errno; ++ addr = NULL; ++ } ++ ++ out: ++ free(map); ++ ++ return addr; ++} ++ ++static void * ++netbsd_gnttab_map_grant_refs(xc_gnttab *xcg, xc_osdep_handle h, ++ uint32_t count, uint32_t *domids, uint32_t *refs, int prot) ++{ ++ return do_gnttab_map_grant_refs(xcg, h, count, domids, 1, refs, prot); ++} ++ ++static void * ++netbsd_gnttab_map_domain_grant_refs(xc_gnttab *xcg, xc_osdep_handle h, ++ uint32_t count, uint32_t domid, uint32_t *refs, int prot) ++{ ++ return do_gnttab_map_grant_refs(xcg, h, count, &domid, 0, refs, prot); ++} ++ ++static int ++netbsd_gnttab_munmap(xc_gnttab *xcg, xc_osdep_handle h, ++ void *start_address, uint32_t count) ++{ ++ int fd = (int)h; ++ struct ioctl_gntdev_get_offset_for_vaddr get_offset; ++ struct ioctl_gntdev_unmap_grant_ref unmap_grant; ++ int rc; ++ ++ if ( start_address == NULL ) ++ { ++ errno = EINVAL; ++ return -1; ++ } ++ ++ /* First, it is necessary to get the offset which was initially used to ++ * mmap() the pages. ++ */ ++ get_offset.vaddr = (unsigned long)start_address; ++ rc = ioctl(fd, IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR, &get_offset); ++ if ( rc ) ++ return rc; ++ ++ if ( get_offset.count != count ) ++ { ++ errno = EINVAL; ++ return -1; ++ } ++ ++ /* Next, unmap the memory. */ ++ rc = munmap(start_address, count * getpagesize()); ++ if ( rc ) ++ return rc; ++ ++ /* Finally, unmap the driver slots used to store the grant information. */ ++ unmap_grant.index = get_offset.offset; ++ unmap_grant.count = count; ++ rc = ioctl(fd, IOCTL_GNTDEV_UNMAP_GRANT_REF, &unmap_grant); ++ if ( rc ) ++ return rc; ++ return 0; ++} ++ ++static struct xc_osdep_ops netbsd_gnttab_ops = { ++ .open = &netbsd_gnttab_open, ++ .close = &netbsd_gnttab_close, ++ ++ .u.gnttab = { ++ .map_grant_ref = &netbsd_gnttab_map_grant_ref, ++ .map_grant_refs = &netbsd_gnttab_map_grant_refs, ++ .map_domain_grant_refs = &netbsd_gnttab_map_domain_grant_refs, ++ .munmap = &netbsd_gnttab_munmap, ++ }, ++}; ++ ++static struct xc_osdep_ops * ++netbsd_osdep_init(xc_interface *xch, enum xc_osdep_type type) + { + switch ( type ) + { +@@ -360,8 +543,7 @@ static struct xc_osdep_ops *netbsd_osdep + case XC_OSDEP_EVTCHN: + return &netbsd_evtchn_ops; + case XC_OSDEP_GNTTAB: +- ERROR("GNTTAB interface not supported on this platform"); +- return NULL; ++ return &netbsd_gnttab_ops; + default: + return NULL; + } diff --git a/sysutils/xenstoretools/patches/patch-bc b/sysutils/xenstoretools/patches/patch-bc new file mode 100644 index 00000000000..7ea7ef4da01 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-bc @@ -0,0 +1,110 @@ +$NetBSD: patch-bc,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- include/xen-sys/NetBSD/gntdev.h.orig 2011-03-29 17:10:31.000000000 +0000 ++++ include/xen-sys/NetBSD/gntdev.h +@@ -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/xenstoretools/patches/patch-ca b/sysutils/xenstoretools/patches/patch-ca new file mode 100644 index 00000000000..7cb3b2ee2cb --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-ca @@ -0,0 +1,47 @@ +$NetBSD: patch-ca,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- ../docs/man/xend-config.sxp.pod.5.orig 2010-04-07 16:12:04.000000000 +0000 ++++ ../docs/man/xend-config.sxp.pod.5 +@@ -4,7 +4,7 @@ xend-config.sxp - Xen daemon configurati + + =head1 SYNOPSIS + +-/etc/xen/xend-config.sxp ++@XENDCONFDIR@/xend-config.sxp + + =head1 DESCRIPTION + +@@ -12,7 +12,7 @@ The xend(1) program requires xend-config + parameters which determine the behavior of the daemon at runtime. + + The parameters are specified in S-expression format. See the example +-configuration file in I</etc/xen/xend-config.sxp> for details. ++configuration file in I<@XENDCONFDIR@/xend-config.sxp> for details. + + =head1 OPTIONS + +@@ -82,13 +82,13 @@ Defaults to I<1024>. + + =item I<network-script> + +-The name of the script in I</etc/xen/scripts> that will be run to ++The name of the script in I<@XENDCONFDIR@/scripts> that will be run to + setup the networking environment. This can be any name, but in + general is either I<network-bridge> or I<network-route>. + + =item I<vif-script> + +-The name of the script in I</etc/xen/scripts> that will be run to ++The name of the script in I<@XENDCONFDIR@/scripts> that will be run to + setup a virtual interface when it is created or destroyed. This needs + to (in general) work in unison with the I<network-script>. + +@@ -113,7 +113,7 @@ domains should be saved when a crash occ + + The name of an application or script that can handle external device + migration, such as for example virtual TPM migration. An example +-script is I</etc/xen/scripts/external-device-migrate>. ++script is I<@XENDCONFDIR@/scripts/external-device-migrate>. + + =item I<device-create-timeout> + diff --git a/sysutils/xenstoretools/patches/patch-cb b/sysutils/xenstoretools/patches/patch-cb new file mode 100644 index 00000000000..264db1a9201 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-cb @@ -0,0 +1,36 @@ +$NetBSD: patch-cb,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- ../docs/man/xmdomain.cfg.pod.5.orig 2008-08-01 16:38:07.000000000 +0200 ++++ ../docs/man/xmdomain.cfg.pod.5 +@@ -4,9 +4,9 @@ xmdomain.cfg - xm domain config file for + + =head1 SYNOPSIS + +- /etc/xen/myxendomain +- /etc/xen/myxendomain2 +- /etc/xen/auto/myxenautostarted ++ @XENDCONFDIR@/myxendomain ++ @XENDCONFDIR@/myxendomain2 ++ @XENDCONFDIR@/auto/myxenautostarted + + =head1 DESCRIPTION + +@@ -14,14 +14,14 @@ The B<xm>(1) program uses python executa + domains to create from scratch. Each of these config files needs to + contain a number of required options, and may specify many more. + +-Domain configuration files live in /etc/xen by default, if you store ++Domain configuration files live in @XENDCONFDIR@ by default, if you store + config files anywhere else the full path to the config file must be + specified in the I<xm create> command. + +-/etc/xen/auto is a special case. Domain config files in that ++@XENDCONFDIR@/auto is a special case. Domain config files in that + directory will be started automatically at system boot if the +-xendomain init script is enabled. The contents of /etc/xen/auto +-should be symlinks to files in /etc/xen to allow I<xm create> to be ++xendomain init script is enabled. The contents of @XENDCONFDIR@/auto ++should be symlinks to files in @XENDCONFDIR@ to allow I<xm create> to be + used without full paths. + + Options are specified by I<name = value> statements in the diff --git a/sysutils/xenstoretools/patches/patch-cc b/sysutils/xenstoretools/patches/patch-cc new file mode 100644 index 00000000000..b084dea7715 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-cc @@ -0,0 +1,40 @@ +$NetBSD: patch-cc,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- ../docs/man/xm.pod.1.orig 2009-01-05 11:26:58.000000000 +0000 ++++ ../docs/man/xm.pod.1 +@@ -75,7 +75,7 @@ in the config file. See L<xmdomain.cfg> + format, and possible options used in either the configfile or for I<vars>. + + I<configfile> can either be an absolute path to a file, or a relative +-path to a file located in /etc/xen. ++path to a file located in @XENDCONFDIR@. + + Create will return B<as soon> as the domain is started. This B<does + not> mean the guest OS in the domain has actually booted, or is +@@ -156,7 +156,7 @@ B<EXAMPLES> + + xm create Fedora4 + +-This creates a domain with the file /etc/xen/Fedora4, and returns as ++This creates a domain with the file @XENDCONFDIR@/Fedora4, and returns as + soon as it is run. + + =item I<without config file> +@@ -388,7 +388,7 @@ file format, and possible options used i + I<vars>. + + I<configfile> can either be an absolute path to a file, or a relative +-path to a file located in /etc/xen. ++path to a file located in @XENDCONFDIR@. + + The new subcommand will return without starting the domain. The + domain needs to be started using the B<xm start> command. +@@ -1068,7 +1068,7 @@ I<policy> is a dot-separated list of nam + name pre-fix for the policy XML file. The preceding name parts are + translated into the local path pointing to the policy XML file + relative to the global policy root directory +-(/etc/xen/acm-security/policies). For example, ++(@XENDCONFDIR@/acm-security/policies). For example, + example.chwall_ste.client_v1 denotes the policy file + example/chwall_ste/client_v1-security_policy.xml relative to the + global policy root directory. diff --git a/sysutils/xenstoretools/patches/patch-cd b/sysutils/xenstoretools/patches/patch-cd new file mode 100644 index 00000000000..30b85cbe925 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-cd @@ -0,0 +1,13 @@ +$NetBSD: patch-cd,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- python/xen/xm/create.py.orig 2010-04-07 16:12:05.000000000 +0000 ++++ python/xen/xm/create.py +@@ -426,7 +426,7 @@ gopts.var('vtpm', val="instance=INSTANCE + preferred instance number. The hotplug script will determine + which instance number will actually be assigned to the domain. + The associtation between virtual machine and the TPM instance +- number can be found in /etc/xen/vtpm.db. Use the backend in the ++ number can be found in @XENDCONFDIR@/vtpm.db. Use the backend in the + given domain. + The type parameter can be used to select a specific driver type + that the VM can use. To prevent a fully virtualized domain (HVM) diff --git a/sysutils/xenstoretools/patches/patch-ce b/sysutils/xenstoretools/patches/patch-ce new file mode 100644 index 00000000000..6bd6f9d597e --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-ce @@ -0,0 +1,24 @@ +$NetBSD: patch-ce,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- security/policytools.txt.orig 2008-08-01 16:38:07.000000000 +0200 ++++ security/policytools.txt +@@ -16,10 +16,10 @@ XML. Read in the user manual about the n + name is used by the Xen management tools to identify existing + policies. Creating the security policy means creating a policy + description in XML: +-/etc/xen/acm-security/policies/example/chwall_ste/test-security_policy.xml. ++@XENDCONFDIR@/acm-security/policies/example/chwall_ste/test-security_policy.xml. + + The policy XML description must follow the XML schema definition in +-/etc/xen/acm-security/policies/security_policy.xsd. The policy tools ++@XENDCONFDIR@/acm-security/policies/security_policy.xsd. The policy tools + are written against this schema; they will create and refine policies + that conform to this scheme. + +@@ -144,5 +144,5 @@ policy file naming conventions based on + choose to use. + + To get a feel for the tool, you could use one of the example policy +-definitions files from /etc/xen/acm-security/policies/example as ++definitions files from @XENDCONFDIR@/acm-security/policies/example as + input or a policy created by the xensec_ezpolicy tool. diff --git a/sysutils/xenstoretools/patches/patch-cf b/sysutils/xenstoretools/patches/patch-cf new file mode 100644 index 00000000000..845416cef4d --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-cf @@ -0,0 +1,17 @@ +$NetBSD: patch-cf,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- xm-test/tests/security-acm/Makefile.am.orig 2008-08-01 16:38:07.000000000 +0200 ++++ xm-test/tests/security-acm/Makefile.am +@@ -19,10 +19,10 @@ TESTS_ENVIRONMENT=@TENV@ + %.test: %.py + cp $< $@ + chmod +x $@ +- @if [ -d /etc/xen/acm-security/policies ]; then \ ++ @if [ -d @XENDCONFDIR@/acm-security/policies ]; then \ + cp -f xm-test-security_policy.xml \ + xm-test-update-security_policy.xml\ +- /etc/xen/acm-security/policies; \ ++ @XENDCONFDIR@/acm-security/policies; \ + fi; + + clean-local: am_config_clean-local diff --git a/sysutils/xenstoretools/patches/patch-cg b/sysutils/xenstoretools/patches/patch-cg new file mode 100644 index 00000000000..14541ccb89d --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-cg @@ -0,0 +1,22 @@ +$NetBSD: patch-cg,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- security/xensec_ezpolicy.orig 2008-08-01 16:38:07.000000000 +0200 ++++ security/xensec_ezpolicy +@@ -935,7 +935,7 @@ class ezFrame(wx.Frame): + policyname = transInfo() + if not policyname: + return +- path="/etc/xen/acm-security/policies/" ++ path="@XENDCONFDIR@/acm-security/policies/" + nameparts=string.split(policyname, ".") + if len(nameparts) > 1: + path = path + "/".join(nameparts[0:len(nameparts)-1]) +@@ -1592,7 +1592,7 @@ where you merely replace "NAME" + Save the policy under the name proposed by the tool in the proposed directory + if you are using this tool in your Xen environment. Otherwise, you need + to copy the resulting file into your Xen environment to the directory +-"/etc/xen/acm-security/policies/example/chwall_ste/".<BR> ++"@XENDCONFDIR@/acm-security/policies/example/chwall_ste/".<BR> + <BR> + This tool creates policies for the Xen Chinese Wall and Simple Type Enforcement + policy. The Xen access control policy in general is more expressive and diff --git a/sysutils/xenstoretools/patches/patch-ch b/sysutils/xenstoretools/patches/patch-ch new file mode 100644 index 00000000000..232a6468f91 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-ch @@ -0,0 +1,16 @@ +$NetBSD: patch-ch,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- xm-test/runtest.sh.orig 2008-08-01 16:38:07.000000000 +0200 ++++ xm-test/runtest.sh +@@ -220,9 +220,9 @@ unsafe=no + GROUPENTERED=default + + #Prepare for usage with ACM +-if [ -d /etc/xen/acm-security/policies ]; then ++if [ -d @XENDCONFDIR@/acm-security/policies ]; then + cp -f tests/security-acm/xm-test-security_policy.xml \ +- /etc/xen/acm-security/policies ++ @XENDCONFDIR@/acm-security/policies + fi + + unset XM_MANAGED_DOMAINS diff --git a/sysutils/xenstoretools/patches/patch-config_StdGNU.mk b/sysutils/xenstoretools/patches/patch-config_StdGNU.mk new file mode 100644 index 00000000000..cd091553dd7 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-config_StdGNU.mk @@ -0,0 +1,15 @@ +$NetBSD: patch-config_StdGNU.mk,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +Allow XEN_CONFIG_DIR to be overriden in the environment + +--- ../config/StdGNU.mk.orig 2012-05-10 15:51:14.000000000 +0000 ++++ ../config/StdGNU.mk +@@ -53,7 +53,7 @@ endif + + SYSCONFIG_DIR = $(CONFIG_DIR)/$(CONFIG_LEAF_DIR) + +-XEN_CONFIG_DIR = $(CONFIG_DIR)/xen ++XEN_CONFIG_DIR ?= $(CONFIG_DIR)/xen + XEN_SCRIPT_DIR = $(XEN_CONFIG_DIR)/scripts + + SOCKET_LIBS = diff --git a/sysutils/xenstoretools/patches/patch-da b/sysutils/xenstoretools/patches/patch-da new file mode 100644 index 00000000000..45ffcef60a6 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-da @@ -0,0 +1,42 @@ +$NetBSD: patch-da,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- ioemu-qemu-xen/configure.orig 2013-07-17 12:59:40.000000000 +0200 ++++ ioemu-qemu-xen/configure 2014-08-28 13:59:55.000000000 +0200 +@@ -1089,7 +1089,7 @@ + # Check if tools are available to build documentation. + if [ -x "`which texi2html 2>/dev/null`" ] && \ + [ -x "`which pod2man 2>/dev/null`" ]; then +- build_docs="yes" ++# build_docs="yes" + fi + + ########################################## +@@ -1124,7 +1124,7 @@ + if test -z "$prefix" ; then + prefix="/usr/local" + fi +- mansuffix="/share/man" ++ mansuffix="/man" + datasuffix="/share/qemu" + docsuffix="/share/doc/qemu" + binsuffix="/bin" +@@ -1215,6 +1215,9 @@ + echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h + echo "MAKE=$make" >> $config_mak + echo "INSTALL=$install" >> $config_mak ++echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_mak ++echo "INSTALL_DATA=$install -d -m0644 -p" >> $config_mak ++echo "INSTALL_PROG=$install -d -m0755 -p" >> $config_mak + echo "CC=$cc" >> $config_mak + echo "HOST_CC=$host_cc" >> $config_mak + echo "AR=$ar" >> $config_mak +@@ -1492,7 +1495,9 @@ + # XXX: suppress that + if [ "$bsd" = "yes" ] ; then + echo "#define O_LARGEFILE 0" >> $config_h ++ echo "#ifndef MAP_ANONYMOUS" >> $config_h + echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h ++ echo "#endif" >> $config_h + echo "#define _BSD 1" >> $config_h + fi + diff --git a/sysutils/xenstoretools/patches/patch-db b/sysutils/xenstoretools/patches/patch-db new file mode 100644 index 00000000000..4e9d0b1ce0a --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-db @@ -0,0 +1,85 @@ +$NetBSD: patch-db,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- ioemu-qemu-xen/Makefile.orig 2011-02-11 17:54:51.000000000 +0000 ++++ ioemu-qemu-xen/Makefile +@@ -1,7 +1,7 @@ + # Makefile for QEMU. + +-include config-host.mak +-include $(SRC_PATH)/rules.mak ++-include config-host.mak ++-include $(SRC_PATH)/rules.mak + + .PHONY: all clean cscope distclean dvi html info install install-doc \ + recurse-all speed tar tarbin test +@@ -231,30 +231,30 @@ BLOBS= + endif + + install-doc: $(DOCS) +- mkdir -p "$(DESTDIR)$(docdir)" +- $(INSTALL) -m 644 qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)" ++ $(INSTALL_DIR) "$(DESTDIR)$(docdir)" ++ $(INSTALL_DATA) qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)" + ifndef CONFIG_WIN32 +- mkdir -p "$(DESTDIR)$(mandir)/man1" +- $(INSTALL) -m 644 qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1" +- mkdir -p "$(DESTDIR)$(mandir)/man8" +- $(INSTALL) -m 644 qemu-nbd.8 "$(DESTDIR)$(mandir)/man8" ++ $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1" ++ $(INSTALL_DATA) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1" ++ $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8" ++ $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8" + endif + + install: all $(if $(BUILD_DOCS),install-doc) +- mkdir -p "$(DESTDIR)$(bindir)" ++ $(INSTALL_DIR) "$(DESTDIR)$(bindir)" + ifneq ($(TOOLS),) +- $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)" ++ $(INSTALL_PROG) -s $(TOOLS) "$(DESTDIR)$(bindir)" + endif + ifneq ($(BLOBS),) +- mkdir -p "$(DESTDIR)$(datadir)" ++ $(INSTALL_DIR) "$(DESTDIR)$(datadir)" + set -e; for x in $(BLOBS); do \ +- $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \ ++ $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \ + done + endif + ifndef CONFIG_WIN32 +- mkdir -p "$(DESTDIR)$(datadir)/keymaps" ++ $(INSTALL_DIR) "$(DESTDIR)$(datadir)/keymaps" + set -e; for x in $(KEYMAPS); do \ +- $(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \ ++ $(INSTALL_DATA) $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \ + done + endif + for d in $(TARGET_DIRS); do \ +@@ -275,7 +275,7 @@ cscope: + + # documentation + %.html: %.texi +- texi2html -monolithic -number $< ++ texi2html -monolithic -number-sections $< + + %.info: %.texi + makeinfo $< -o $@ +@@ -284,15 +284,15 @@ cscope: + texi2dvi $< + + qemu.1: qemu-doc.texi +- $(SRC_PATH)/texi2pod.pl $< qemu.pod ++ perl $(SRC_PATH)/texi2pod.pl $< qemu.pod + pod2man --section=1 --center=" " --release=" " qemu.pod > $@ + + qemu-img.1: qemu-img.texi +- $(SRC_PATH)/texi2pod.pl $< qemu-img.pod ++ perl $(SRC_PATH)/texi2pod.pl $< qemu-img.pod + pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@ + + qemu-nbd.8: qemu-nbd.texi +- $(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod ++ perl $(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod + pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@ + + info: qemu-doc.info qemu-tech.info diff --git a/sysutils/xenstoretools/patches/patch-dc b/sysutils/xenstoretools/patches/patch-dc new file mode 100644 index 00000000000..8c63cdca5f7 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-dc @@ -0,0 +1,34 @@ +$NetBSD: patch-dc,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +From sysutils/xentools33/patches/patch-ak. + +qemu-0.13.x will include this fix: +http://git.qemu.org/qemu.git/commit/?id=9651ac55e5de0e1534d898316cc851af6ffc4334 + +--- ioemu-qemu-xen/hw/e1000.c.orig 2009-08-06 12:56:34.000000000 +0000 ++++ ioemu-qemu-xen/hw/e1000.c +@@ -244,16 +244,20 @@ set_eecd(E1000State *s, int index, uint3 + + s->eecd_state.old_eecd = val & (E1000_EECD_SK | E1000_EECD_CS | + E1000_EECD_DI|E1000_EECD_FWE_MASK|E1000_EECD_REQ); ++ if (!(E1000_EECD_CS & val)) // CS inactive; nothing to do ++ return; ++ if (E1000_EECD_CS & (val ^ oldval)) { // CS rise edge; reset state ++ s->eecd_state.val_in = 0; ++ s->eecd_state.bitnum_in = 0; ++ s->eecd_state.bitnum_out = 0; ++ s->eecd_state.reading = 0; ++ } + if (!(E1000_EECD_SK & (val ^ oldval))) // no clock edge + return; + if (!(E1000_EECD_SK & val)) { // falling edge + s->eecd_state.bitnum_out++; + return; + } +- if (!(val & E1000_EECD_CS)) { // rising, no CS (EEPROM reset) +- memset(&s->eecd_state, 0, sizeof s->eecd_state); +- return; +- } + s->eecd_state.val_in <<= 1; + if (val & E1000_EECD_DI) + s->eecd_state.val_in |= 1; diff --git a/sysutils/xenstoretools/patches/patch-dd b/sysutils/xenstoretools/patches/patch-dd new file mode 100644 index 00000000000..14b171100bd --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-dd @@ -0,0 +1,11 @@ +$NetBSD: patch-dd,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- ../tools/examples/Makefile.orig 2011-10-20 19:05:41.000000000 +0200 ++++ ../tools/examples/Makefile 2011-10-26 13:55:46.000000000 +0200 +@@ -1,5 +1,6 @@ + XEN_ROOT = $(CURDIR)/../.. + include $(XEN_ROOT)/tools/Rules.mk ++XEN_CONFIG_DIR=${EGDIR} + + # Init scripts. + XEND_INITD = init.d/xend diff --git a/sysutils/xenstoretools/patches/patch-de b/sysutils/xenstoretools/patches/patch-de new file mode 100644 index 00000000000..b3671695f2a --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-de @@ -0,0 +1,11 @@ +$NetBSD: patch-de,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- ../tools/hotplug/common/Makefile.orig 2011-10-20 19:05:42.000000000 +0200 ++++ ../tools/hotplug/common/Makefile 2011-10-26 13:57:09.000000000 +0200 +@@ -1,5 +1,6 @@ + XEN_ROOT = $(CURDIR)/../../.. + include $(XEN_ROOT)/tools/Rules.mk ++XEN_SCRIPT_DIR = ${EGDIR}/scripts + + HOTPLUGPATH="hotplugpath.sh" + diff --git a/sysutils/xenstoretools/patches/patch-df b/sysutils/xenstoretools/patches/patch-df new file mode 100644 index 00000000000..33ba4cb3fa4 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-df @@ -0,0 +1,37 @@ +$NetBSD: patch-df,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- ioemu-qemu-xen/hw/ide.c.orig 2014-01-09 13:44:42.000000000 +0100 ++++ ioemu-qemu-xen/hw/ide.c 2015-06-11 16:15:49.000000000 +0200 +@@ -757,10 +757,15 @@ + put_le16(p + 58, oldsize >> 16); + if (s->mult_sectors) + put_le16(p + 59, 0x100 | s->mult_sectors); +- put_le16(p + 60, s->nb_sectors); +- put_le16(p + 61, s->nb_sectors >> 16); ++ if (s->nb_sectors > 0x10000000) ++ oldsize = 0x10000000; /* report only 128GB */ ++ else ++ oldsize = s->nb_sectors; ++ put_le16(p + 60, oldsize); ++ put_le16(p + 61, oldsize >> 16); + put_le16(p + 62, 0x07); /* single word dma0-2 supported */ + put_le16(p + 63, 0x07); /* mdma0-2 supported */ ++ put_le16(p + 64, 0x03); /* pio3-4 supported */ + put_le16(p + 65, 120); + put_le16(p + 66, 120); + put_le16(p + 67, 120); +@@ -812,13 +817,12 @@ + put_le16(p + 53, 7); /* words 64-70, 54-58, 88 valid */ + put_le16(p + 62, 7); /* single word dma0-2 supported */ + put_le16(p + 63, 7); /* mdma0-2 supported */ +- put_le16(p + 64, 0x3f); /* PIO modes supported */ + #else + put_le16(p + 49, 1 << 9); /* LBA supported, no DMA */ + put_le16(p + 53, 3); /* words 64-70, 54-58 valid */ + put_le16(p + 63, 0x103); /* DMA modes XXX: may be incorrect */ +- put_le16(p + 64, 1); /* PIO modes */ + #endif ++ put_le16(p + 64, 3); /* pio3-4 supported */ + put_le16(p + 65, 0xb4); /* minimum DMA multiword tx cycle time */ + put_le16(p + 66, 0xb4); /* recommended DMA multiword tx cycle time */ + put_le16(p + 67, 0x12c); /* minimum PIO cycle time without flow control */ diff --git a/sysutils/xenstoretools/patches/patch-firmware_hvmloader_Makefile b/sysutils/xenstoretools/patches/patch-firmware_hvmloader_Makefile new file mode 100644 index 00000000000..e2fce1d9f86 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-firmware_hvmloader_Makefile @@ -0,0 +1,13 @@ +$NetBSD: patch-firmware_hvmloader_Makefile,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- firmware/hvmloader/Makefile.orig 2013-03-25 19:35:30.000000000 +0000 ++++ firmware/hvmloader/Makefile +@@ -26,7 +26,7 @@ SUBDIRS := acpi + # The HVM loader is started in 32-bit mode at the address below: + LOADADDR = 0x100000 + +-CFLAGS += $(CFLAGS_include) -I. ++CFLAGS += $(CFLAGS_include) -I. $(EXTRA_CFLAGS) + + SRCS = hvmloader.c mp_tables.c util.c smbios.c + SRCS += 32bitbios_support.c smp.c cacheattr.c xenbus.c diff --git a/sysutils/xenstoretools/patches/patch-ioemu-qemu-xen_hw_pass-through.c b/sysutils/xenstoretools/patches/patch-ioemu-qemu-xen_hw_pass-through.c new file mode 100644 index 00000000000..75cbfc8d2e9 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-ioemu-qemu-xen_hw_pass-through.c @@ -0,0 +1,13 @@ +$NetBSD: patch-ioemu-qemu-xen_hw_pass-through.c,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- ioemu-qemu-xen/hw/pass-through.c.orig 2012-05-24 16:05:23.000000000 +0200 ++++ ioemu-qemu-xen/hw/pass-through.c 2012-05-24 16:06:19.000000000 +0200 +@@ -84,8 +84,6 @@ + */ + + #include "pass-through.h" +-#include "pci/header.h" +-#include "pci/pci.h" + #include "pt-msi.h" + #include "qemu-xen.h" + #include "iomulti.h" diff --git a/sysutils/xenstoretools/patches/patch-ioemu-qemu-xen_hw_pass-through.h b/sysutils/xenstoretools/patches/patch-ioemu-qemu-xen_hw_pass-through.h new file mode 100644 index 00000000000..bcc8d3566dc --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-ioemu-qemu-xen_hw_pass-through.h @@ -0,0 +1,18 @@ +$NetBSD: patch-ioemu-qemu-xen_hw_pass-through.h,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- ioemu-qemu-xen/hw/pass-through.h.orig 2012-05-24 15:57:12.000000000 +0200 ++++ ioemu-qemu-xen/hw/pass-through.h 2012-05-24 15:58:46.000000000 +0200 +@@ -20,8 +20,13 @@ + + #include "hw.h" + #include "pci.h" ++#ifdef __NetBSD__ ++#include "pciutils/header.h" ++#include "pciutils/pci.h" ++#else + #include "pci/header.h" + #include "pci/pci.h" ++#endif + #include "exec-all.h" + #include "sys-queue.h" + #include "qemu-timer.h" diff --git a/sysutils/xenstoretools/patches/patch-ioemu-qemu-xen_hw_piix4acpi.c b/sysutils/xenstoretools/patches/patch-ioemu-qemu-xen_hw_piix4acpi.c new file mode 100644 index 00000000000..eafc6e7d9aa --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-ioemu-qemu-xen_hw_piix4acpi.c @@ -0,0 +1,17 @@ +$NetBSD: patch-ioemu-qemu-xen_hw_piix4acpi.c,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- ioemu-qemu-xen/hw/piix4acpi.c.orig 2012-05-30 10:21:32.000000000 +0200 ++++ ioemu-qemu-xen/hw/piix4acpi.c 2012-05-30 10:23:11.000000000 +0200 +@@ -41,8 +41,12 @@ + #define PIIX4ACPI_LOG(level, fmt, ...) do { if (level <= PIIX4ACPI_LOGLEVEL) qemu_log(fmt, ## __VA_ARGS__); } while (0) + + #ifdef CONFIG_PASSTHROUGH ++#ifdef __NetBSD__ ++#include <pciutils/header.h> ++#else + #include <pci/header.h> + #endif ++#endif + + /* PM1a_CNT bits, as defined in the ACPI specification. */ + #define SCI_EN (1 << 0) diff --git a/sysutils/xenstoretools/patches/patch-ioemu-qemu-xen_hw_pt-graphics.c b/sysutils/xenstoretools/patches/patch-ioemu-qemu-xen_hw_pt-graphics.c new file mode 100644 index 00000000000..f22feb10cf1 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-ioemu-qemu-xen_hw_pt-graphics.c @@ -0,0 +1,13 @@ +$NetBSD: patch-ioemu-qemu-xen_hw_pt-graphics.c,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- ioemu-qemu-xen/hw/pt-graphics.c.orig 2012-05-24 16:16:49.000000000 +0200 ++++ ioemu-qemu-xen/hw/pt-graphics.c 2012-05-24 16:16:55.000000000 +0200 +@@ -3,8 +3,6 @@ + */ + + #include "pass-through.h" +-#include "pci/header.h" +-#include "pci/pci.h" + + #include <unistd.h> + #include <sys/ioctl.h> diff --git a/sysutils/xenstoretools/patches/patch-ioemu-qemu-xen_hw_pt-msi.c b/sysutils/xenstoretools/patches/patch-ioemu-qemu-xen_hw_pt-msi.c new file mode 100644 index 00000000000..b8f1828854b --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-ioemu-qemu-xen_hw_pt-msi.c @@ -0,0 +1,15 @@ +$NetBSD: patch-ioemu-qemu-xen_hw_pt-msi.c,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- ioemu-qemu-xen/hw/pt-msi.c.orig 2012-05-24 13:27:50.000000000 +0200 ++++ ioemu-qemu-xen/hw/pt-msi.c 2012-05-24 13:28:42.000000000 +0200 +@@ -22,6 +22,10 @@ + #include "pt-msi.h" + #include <sys/mman.h> + ++#ifdef __NetBSD__ ++#define MAP_LOCKED MAP_WIRED ++#endif ++ + void msi_set_enable(struct pt_dev *dev, int en) + { + uint16_t val = 0; diff --git a/sysutils/xenstoretools/patches/patch-ioemu-qemu-xen_hw_pt-msi.h b/sysutils/xenstoretools/patches/patch-ioemu-qemu-xen_hw_pt-msi.h new file mode 100644 index 00000000000..c6539ee0315 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-ioemu-qemu-xen_hw_pt-msi.h @@ -0,0 +1,12 @@ +$NetBSD: patch-ioemu-qemu-xen_hw_pt-msi.h,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- ioemu-qemu-xen/hw/pt-msi.h.orig 2012-05-24 16:09:24.000000000 +0200 ++++ ioemu-qemu-xen/hw/pt-msi.h 2012-05-24 16:15:19.000000000 +0200 +@@ -1,7 +1,6 @@ + #ifndef _PT_MSI_H + #define _PT_MSI_H + +-#include "pci/pci.h" + #include "pass-through.h" + + #define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */ diff --git a/sysutils/xenstoretools/patches/patch-ioemu-qemu-xen_xen-hooks.mak b/sysutils/xenstoretools/patches/patch-ioemu-qemu-xen_xen-hooks.mak new file mode 100644 index 00000000000..4d22339b2dc --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-ioemu-qemu-xen_xen-hooks.mak @@ -0,0 +1,34 @@ +$NetBSD: patch-ioemu-qemu-xen_xen-hooks.mak,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +enable PCI passthrough when pciutils is present + +--- ioemu-qemu-xen/xen-hooks.mak.orig 2012-05-24 15:41:11.000000000 +0200 ++++ ioemu-qemu-xen/xen-hooks.mak 2012-05-24 15:46:21.000000000 +0200 +@@ -55,17 +55,25 @@ + ifdef CONFIG_STUBDOM + CONFIG_PASSTHROUGH=1 + else +- ifeq (,$(wildcard /usr/include/pci)) ++ ifeq ($(CONFIG_NetBSD), y) ++CONFIG_PASSTHROUGH=1 ++ else ++ ifeq (,$(wildcard /usr/include/pci)) + $(warning === pciutils-dev package not found - missing /usr/include/pci) + $(warning === PCI passthrough capability has been disabled) +- else ++ else + CONFIG_PASSTHROUGH=1 ++ endif + endif + endif + + ifdef CONFIG_PASSTHROUGH + OBJS+= pass-through.o pt-msi.o pt-graphics.o ++ifeq ($(CONFIG_NetBSD), y) ++LIBS += -lpciutils -lpci ++else + LIBS += -lpci ++endif + CFLAGS += -DCONFIG_PASSTHROUGH + $(info === PCI passthrough capability has been enabled ===) + endif diff --git a/sysutils/xenstoretools/patches/patch-libfsimage_ufs_ufs.h b/sysutils/xenstoretools/patches/patch-libfsimage_ufs_ufs.h new file mode 100644 index 00000000000..14f59b9c142 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-libfsimage_ufs_ufs.h @@ -0,0 +1,13 @@ +$NetBSD: patch-libfsimage_ufs_ufs.h,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- libfsimage/ufs/ufs.h.orig 2013-07-14 19:44:35.000000000 +0000 ++++ libfsimage/ufs/ufs.h +@@ -4,7 +4,7 @@ + */ + + #ifndef _GRUB_UFS_H +-#define _GRUB_UFS_H_ ++#define _GRUB_UFS_H + + /* ufs specific constants */ + #define UFS_SBLOCK 16 diff --git a/sysutils/xenstoretools/patches/patch-libxl_libxl_create.c b/sysutils/xenstoretools/patches/patch-libxl_libxl_create.c new file mode 100644 index 00000000000..b3db39d7cf2 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-libxl_libxl_create.c @@ -0,0 +1,40 @@ +$NetBSD: patch-libxl_libxl_create.c,v 1.1 2016/12/29 23:12:23 wiz Exp $ + +--- libxl/libxl_create.c.orig 2011-10-20 17:05:42.000000000 +0000 ++++ libxl/libxl_create.c +@@ -171,7 +171,7 @@ int libxl__domain_build(libxl_ctx *ctx, + vments[2] = "image/ostype"; + vments[3] = "hvm"; + vments[4] = "start_time"; +- vments[5] = libxl__sprintf(&gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000); ++ vments[5] = libxl__sprintf(&gc, "%llu.%02d", (unsigned long long)start_time.tv_sec,(int)start_time.tv_usec/10000); + } else { + ret = libxl__build_pv(ctx, domid, info, state); + if (ret) +@@ -184,7 +184,7 @@ int libxl__domain_build(libxl_ctx *ctx, + vments[i++] = "image/kernel"; + vments[i++] = (char*) info->kernel.path; + vments[i++] = "start_time"; +- vments[i++] = libxl__sprintf(&gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000); ++ vments[i++] = libxl__sprintf(&gc, "%llu.%02d", (unsigned long long)start_time.tv_sec,(int)start_time.tv_usec/10000); + if (info->u.pv.ramdisk.path) { + vments[i++] = "image/ramdisk"; + vments[i++] = (char*) info->u.pv.ramdisk.path; +@@ -227,7 +227,7 @@ static int domain_restore(libxl_ctx *ctx + vments[2] = "image/ostype"; + vments[3] = "hvm"; + vments[4] = "start_time"; +- vments[5] = libxl__sprintf(&gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000); ++ vments[5] = libxl__sprintf(&gc, "%llu.%02d", (unsigned long long)start_time.tv_sec,(int)start_time.tv_usec/10000); + } else { + vments = libxl__calloc(&gc, 11, sizeof(char *)); + i = 0; +@@ -236,7 +236,7 @@ static int domain_restore(libxl_ctx *ctx + vments[i++] = "image/kernel"; + vments[i++] = (char*) info->kernel.path; + vments[i++] = "start_time"; +- vments[i++] = libxl__sprintf(&gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000); ++ vments[i++] = libxl__sprintf(&gc, "%llu.%02d", (unsigned long long)start_time.tv_sec,(int)start_time.tv_usec/10000); + if (info->u.pv.ramdisk.path) { + vments[i++] = "image/ramdisk"; + vments[i++] = (char*) info->u.pv.ramdisk.path; diff --git a/sysutils/xenstoretools/patches/patch-libxl_libxl_internal.h b/sysutils/xenstoretools/patches/patch-libxl_libxl_internal.h new file mode 100644 index 00000000000..bc1f364174c --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-libxl_libxl_internal.h @@ -0,0 +1,16 @@ +$NetBSD: patch-libxl_libxl_internal.h,v 1.1 2016/12/29 23:12:24 wiz Exp $ + +--- libxl/libxl_internal.h.orig 2012-05-24 13:31:11.000000000 +0200 ++++ libxl/libxl_internal.h 2012-05-24 13:31:14.000000000 +0200 +@@ -109,7 +109,11 @@ + #define XC_PCI_BDF "0x%x, 0x%x, 0x%x, 0x%x" + #define AUTO_PHP_SLOT 0x100 + #define SYSFS_PCI_DEV "/sys/bus/pci/devices" ++#ifdef __NetBSD__ ++#define SYSFS_PCIBACK_DRIVER "/kern/xen/pci" ++#else + #define SYSFS_PCIBACK_DRIVER "/sys/bus/pci/drivers/pciback" ++#endif + #define XENSTORE_PID_FILE "/var/run/xenstored.pid" + + #define PROC_PCI_NUM_RESOURCES 7 diff --git a/sysutils/xenstoretools/patches/patch-libxl_xl__cmdimpl.c b/sysutils/xenstoretools/patches/patch-libxl_xl__cmdimpl.c new file mode 100644 index 00000000000..da9368708b8 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-libxl_xl__cmdimpl.c @@ -0,0 +1,13 @@ +$NetBSD: patch-libxl_xl__cmdimpl.c,v 1.1 2016/12/29 23:12:24 wiz Exp $ + +--- libxl/xl_cmdimpl.c.orig 2013-05-05 19:37:21.000000000 +0000 ++++ libxl/xl_cmdimpl.c +@@ -922,7 +922,7 @@ skip: + + for (p = strtok(buf2, ","); p; p = strtok(NULL, ",")) { + char* val; +- while (isblank(*p)) ++ while (isblank((unsigned char)*p)) + p++; + val = strchr(p, '='); + if (val == NULL) diff --git a/sysutils/xenstoretools/patches/patch-ocaml_Makefile.rules b/sysutils/xenstoretools/patches/patch-ocaml_Makefile.rules new file mode 100644 index 00000000000..a6f470a61af --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-ocaml_Makefile.rules @@ -0,0 +1,13 @@ +$NetBSD: patch-ocaml_Makefile.rules,v 1.1 2016/12/29 23:12:24 wiz Exp $ + +--- ocaml/Makefile.rules.orig 2012-08-10 13:51:28.000000000 +0000 ++++ ocaml/Makefile.rules +@@ -65,7 +65,7 @@ define OCAML_LIBRARY_template + $(1)_stubs.a: $(foreach obj,$$($(1)_C_OBJS),$(obj).o) + $(call mk-caml-stubs,$$@, $$+) + lib$(1)_stubs.a: $(foreach obj,$($(1)_C_OBJS),$(obj).o) +- $(call mk-caml-lib-stubs,$$@, $$+, $(LIBS_$(1))) ++ $(call mk-caml-lib-stubs,$$@, $$+, -dllpath $(PREFIX)/lib $(LIBS_$(1))) + endef + + define OCAML_NOC_LIBRARY_template diff --git a/sysutils/xenstoretools/patches/patch-ocaml_common.make b/sysutils/xenstoretools/patches/patch-ocaml_common.make new file mode 100644 index 00000000000..5f01fe509cb --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-ocaml_common.make @@ -0,0 +1,13 @@ +$NetBSD: patch-ocaml_common.make,v 1.1 2016/12/29 23:12:24 wiz Exp $ + +--- ocaml/common.make.orig 2013-03-13 09:31:47.000000000 +0000 ++++ ocaml/common.make +@@ -3,7 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk + CC ?= gcc + OCAMLOPT ?= ocamlopt + OCAMLC ?= ocamlc +-OCAMLMKLIB ?= ocamlmklib ++OCAMLMKLIB ?= ocamlmklib -elfmode + OCAMLDEP ?= ocamldep + OCAMLLEX ?= ocamllex + OCAMLYACC ?= ocamlyacc diff --git a/sysutils/xenstoretools/patches/patch-ocaml_libs_xb_xs__ring__stubs.c b/sysutils/xenstoretools/patches/patch-ocaml_libs_xb_xs__ring__stubs.c new file mode 100644 index 00000000000..677ef3f4a8e --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-ocaml_libs_xb_xs__ring__stubs.c @@ -0,0 +1,26 @@ +$NetBSD: patch-ocaml_libs_xb_xs__ring__stubs.c,v 1.1 2016/12/29 23:12:24 wiz Exp $ + +--- ocaml/libs/xb/xs_ring_stubs.c.orig 2016-09-30 12:57:34.000000000 +0000 ++++ ocaml/libs/xb/xs_ring_stubs.c +@@ -46,8 +46,8 @@ static int xs_ring_read(struct mmap_inte + XENSTORE_RING_IDX cons, prod; /* offsets only */ + int to_read; + +- cons = *(volatile uint32*)&intf->req_cons; +- prod = *(volatile uint32*)&intf->req_prod; ++ cons = *(volatile uint32_t*)&intf->req_cons; ++ prod = *(volatile uint32_t*)&intf->req_prod; + xen_mb(); + + if ((prod - cons) > XENSTORE_RING_SIZE) +@@ -76,8 +76,8 @@ static int xs_ring_write(struct mmap_int + XENSTORE_RING_IDX cons, prod; + int can_write; + +- cons = *(volatile uint32*)&intf->rsp_cons; +- prod = *(volatile uint32*)&intf->rsp_prod; ++ cons = *(volatile uint32_t*)&intf->rsp_cons; ++ prod = *(volatile uint32_t*)&intf->rsp_prod; + xen_mb(); + if ( (prod - cons) >= XENSTORE_RING_SIZE ) + return 0; diff --git a/sysutils/xenstoretools/patches/patch-ocaml_xenstored_define.ml b/sysutils/xenstoretools/patches/patch-ocaml_xenstored_define.ml new file mode 100644 index 00000000000..731f8413264 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-ocaml_xenstored_define.ml @@ -0,0 +1,20 @@ +$NetBSD: patch-ocaml_xenstored_define.ml,v 1.1 2016/12/29 23:12:24 wiz Exp $ + +--- ocaml/xenstored/define.ml.orig 2012-11-24 07:27:21.000000000 +0000 ++++ ocaml/xenstored/define.ml 2012-11-24 07:33:59.000000000 +0000 +@@ -17,13 +17,13 @@ + let xenstored_major = 1 + let xenstored_minor = 0 + +-let xenstored_proc_kva = "/proc/xen/xsd_kva" ++let xenstored_proc_kva = "@PROCDEV@/xsd_kva" + let xenstored_proc_port = "/proc/xen/xsd_port" + + let xs_daemon_socket = "/var/run/xenstored/socket" + let xs_daemon_socket_ro = "/var/run/xenstored/socket_ro" + +-let default_config_dir = "/etc/xensource" ++let default_config_dir = "@XENDCONFDIR@" + + let maxwatch = ref (50) + let maxtransaction = ref (20) diff --git a/sysutils/xenstoretools/patches/patch-ocaml_xenstored_utils.ml b/sysutils/xenstoretools/patches/patch-ocaml_xenstored_utils.ml new file mode 100644 index 00000000000..c2e22799208 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-ocaml_xenstored_utils.ml @@ -0,0 +1,13 @@ +$NetBSD: patch-ocaml_xenstored_utils.ml,v 1.1 2016/12/29 23:12:24 wiz Exp $ + +--- ocaml/xenstored/utils.ml.orig ++++ ocaml/xenstored/utils.ml +@@ -87,7 +83,7 @@ let read_file_single_integer filename = + let buf = String.make 20 (char_of_int 0) in + let sz = Unix.read fd buf 0 20 in + Unix.close fd; +- int_of_string (String.sub buf 0 sz) ++ int_of_string (String.trim (String.sub buf 0 sz)) + + let path_complete path connection_path = + if String.get path 0 <> '/' then diff --git a/sysutils/xenstoretools/patches/patch-qemu-phy-devices b/sysutils/xenstoretools/patches/patch-qemu-phy-devices new file mode 100644 index 00000000000..5a482f2f194 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-qemu-phy-devices @@ -0,0 +1,97 @@ +$NetBSD: patch-qemu-phy-devices,v 1.1 2016/12/29 23:12:24 wiz Exp $ + +This does 2 things: +- use the correct way to get the size of a disk device or partition (from + haad@NetBSD.org) +- if given a block device, use the character device instead. + +--- ioemu-qemu-xen/block-raw-posix.c.orig 2011-05-20 16:47:37.000000000 +0200 ++++ ioemu-qemu-xen/block-raw-posix.c 2011-05-20 18:06:44.000000000 +0200 +@@ -66,6 +66,13 @@ + #include <sys/disklabel.h> + #include <sys/dkio.h> + #endif ++#if defined(__NetBSD__) ++#include <sys/ioctl.h> ++#include <sys/disklabel.h> ++#include <sys/dkio.h> ++#define SLIST_ENTRY(x) int /*XXXX !*/ ++#include <sys/disk.h> ++#endif + + //#define DEBUG_FLOPPY + +@@ -120,6 +127,33 @@ + { + BDRVRawState *s = bs->opaque; + int fd, open_flags, ret; ++#ifdef __NetBSD__ ++ struct stat sb; ++ static char namebuf[MAXPATHLEN]; ++ const char *dp; ++ ++ if (lstat(filename, &sb) < 0) { ++ fprintf(stderr, "%s: stat failed: %s\n", filename, strerror(errno)); ++ return -errno; ++ } ++ if (S_ISLNK(sb.st_mode)) { ++ fprintf(stderr, "%s: symolink links not supported by qemu-dm\n", ++ filename); ++ return -EINVAL; ++ } ++ if (S_ISBLK(sb.st_mode)) { ++ dp = strrchr(filename, '/'); ++ if (dp == NULL) { ++ snprintf(namebuf, MAXPATHLEN, "r%s", filename); ++ } else { ++ snprintf(namebuf, MAXPATHLEN, "%.*s/r%s", ++ (int)(dp - filename), filename, dp + 1); ++ } ++ fprintf(stderr, "%s is a block device", filename); ++ filename = namebuf; ++ fprintf(stderr, ", using %s\n", filename); ++ } ++#endif + + posix_aio_init(); + +@@ -749,7 +783,7 @@ + return 0; + } + +-#ifdef __OpenBSD__ ++#if defined(__OpenBSD__) || defined(__NetBSD__) + static int64_t raw_getlength(BlockDriverState *bs) + { + BDRVRawState *s = bs->opaque; +@@ -759,16 +793,29 @@ + if (fstat(fd, &st)) + return -1; + if (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode)) { ++#if defined(__OpenBSD__) + struct disklabel dl; + + if (ioctl(fd, DIOCGDINFO, &dl)) + return -1; + return (uint64_t)dl.d_secsize * + dl.d_partitions[DISKPART(st.st_rdev)].p_size; ++#else ++ struct dkwedge_info dkw; ++ if (ioctl(fd, DIOCGWEDGEINFO, &dkw) != -1) { ++ return dkw.dkw_size * 512; ++ } else { ++ struct disklabel dl; ++ if(ioctl(fd, DIOCGDINFO, &dl)) ++ return -1; ++ return (uint64_t)dl.d_secsize * ++ dl.d_partitions[DISKPART(st.st_rdev)].p_size; ++ } ++#endif + } else + return st.st_size; + } +-#else /* !__OpenBSD__ */ ++#else /* !__OpenBSD__ && ! __NetBSD__ */ + static int64_t raw_getlength(BlockDriverState *bs) + { + BDRVRawState *s = bs->opaque; diff --git a/sysutils/xenstoretools/patches/patch-xenstat_libxenstat_Makefile b/sysutils/xenstoretools/patches/patch-xenstat_libxenstat_Makefile new file mode 100644 index 00000000000..d76e9ae8af4 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-xenstat_libxenstat_Makefile @@ -0,0 +1,30 @@ +$NetBSD: patch-xenstat_libxenstat_Makefile,v 1.1 2016/12/29 23:12:24 wiz Exp $ + +--- xenstat/libxenstat/Makefile.orig 2013-03-25 19:37:42.000000000 +0000 ++++ xenstat/libxenstat/Makefile +@@ -40,7 +40,7 @@ + LDFLAGS+=-Lsrc -L$(XEN_XENSTORE)/ -L$(XEN_LIBXC)/ + LDLIBS-y = -lxenstore -lxenctrl + LDLIBS-$(CONFIG_SunOS) += -lkstat +-ARLIBS-y = $(XEN_XENSTORE)/libxenstore.so $(XEN_LIBXC)/libxenctrl.so ++ARLIBS-y = + ARLIBS-x86_64 = /usr/lib/amd64/libkstat.so + ARLIBS-x86_32 = /usr/lib/libkstat.so + ARLIBS-$(CONFIG_SunOS) += $(ARLIBS-$(XEN_TARGET_ARCH)) +@@ -57,13 +57,13 @@ + $(OBJECTS-y) $(LDLIBS-y) + + src/xenstat.o: src/xenstat.c src/xenstat.h src/xenstat_priv.h +- $(CC) $(CFLAGS) $(WARN_FLAGS) -c -o $@ $< ++ $(CC) $(WARN_FLAGS) $(CFLAGS) -c -o $@ $< + + src/xenstat_linux.o: src/xenstat_linux.c src/xenstat_priv.h +- $(CC) $(CFLAGS) $(WARN_FLAGS) -c -o $@ $< ++ $(CC) $(WARN_FLAGS) $(CFLAGS) -c -o $@ $< + + src/xenstat_solaris.o: src/xenstat_solaris.c src/xenstat_priv.h +- $(CC) $(CFLAGS) $(WARN_FLAGS) -c -o $@ $< ++ $(CC) $(WARN_FLAGS) $(CFLAGS) -c -o $@ $< + + src/libxenstat.so.$(MAJOR): $(LIB) + $(MAKE_LINK) $(<F) $@ diff --git a/sysutils/xenstoretools/patches/patch-xenstat_xentop_Makefile b/sysutils/xenstoretools/patches/patch-xenstat_xentop_Makefile new file mode 100644 index 00000000000..79667658a80 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-xenstat_xentop_Makefile @@ -0,0 +1,15 @@ +$NetBSD: patch-xenstat_xentop_Makefile,v 1.1 2016/12/29 23:12:24 wiz Exp $ + +--- xenstat/xentop/Makefile.orig 2014-05-14 15:15:54.000000000 +0200 ++++ xenstat/xentop/Makefile 2014-05-14 15:15:56.000000000 +0200 +@@ -19,8 +19,8 @@ + else + + CFLAGS += -DGCC_PRINTF -Wall -Werror -I$(XEN_LIBXENSTAT) +-LDFLAGS += -L$(XEN_LIBXENSTAT) +-LDLIBS += -lxenstat $(CURSES_LIBS) $(SOCKET_LIBS) ++LDFLAGS += -L$(XEN_LIBXENSTAT) -L$(XEN_XENSTORE) -L$(XEN_LIBXC) ++LDLIBS += -lxenstat -lxenstore -lxenctrl $(CURSES_LIBS) $(SOCKET_LIBS) + CFLAGS += -DHOST_$(XEN_OS) + + .PHONY: all diff --git a/sysutils/xenstoretools/patches/patch-xenstore_Makefile b/sysutils/xenstoretools/patches/patch-xenstore_Makefile new file mode 100644 index 00000000000..af73a435630 --- /dev/null +++ b/sysutils/xenstoretools/patches/patch-xenstore_Makefile @@ -0,0 +1,29 @@ +$NetBSD: patch-xenstore_Makefile,v 1.1 2016/12/29 23:12:24 wiz Exp $ + +Adds a target to install just the useful bits for the xenstore tools. + +Used by sysutils/xenstoretools only, but patch maintained here in xentools41 as +xenstoretools shares the same distinfo. + +--- xenstore/Makefile.orig 2011-06-14 17:03:45.000000000 +0100 ++++ xenstore/Makefile 2011-10-03 13:16:43.000000000 +0100 +@@ -111,6 +111,19 @@ + $(INSTALL_DATA) xs.h $(DESTDIR)$(INCLUDEDIR) + $(INSTALL_DATA) xs_lib.h $(DESTDIR)$(INCLUDEDIR) + ++.PHONY: install ++installclients: clients ++ $(INSTALL_DIR) $(DESTDIR)$(BINDIR) ++ $(INSTALL_PROG) xenstore-control $(DESTDIR)$(BINDIR) ++ $(INSTALL_PROG) xenstore $(DESTDIR)$(BINDIR) ++ set -e ; for c in $(CLIENTS) ; do \ ++ ln -f $(DESTDIR)$(BINDIR)/xenstore $(DESTDIR)$(BINDIR)/$${c} ; \ ++ done ++ $(INSTALL_DIR) $(DESTDIR)$(LIBDIR) ++ $(INSTALL_PROG) libxenstore.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR) ++ ln -sf libxenstore.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libxenstore.so.$(MAJOR) ++ ln -sf libxenstore.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libxenstore.so ++ + -include $(DEPS) + + # never delete any intermediate files. |