pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/sysutils/xentools45 add patches to XSAs 178 and 180 fr...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/5869da2721d8
branches:  trunk
changeset: 350810:5869da2721d8
user:      spz <spz%pkgsrc.org@localhost>
date:      Sat Aug 06 12:41:36 2016 +0000

description:
add patches to XSAs 178 and 180 from upstream
add an initialization for a pointer where the compiler doesn't
recognize it being assigned by posix_memalign (trivial compile fix)

diffstat:

 sysutils/xentools45/Makefile                            |     4 +-
 sysutils/xentools45/distinfo                            |     5 +-
 sysutils/xentools45/patches/patch-XSA-178               |  1332 +++++++++++++++
 sysutils/xentools45/patches/patch-XSA-180               |    66 +
 sysutils/xentools45/patches/patch-xenpaging_xenpaging.c |    14 +
 5 files changed, 1418 insertions(+), 3 deletions(-)

diffs (truncated from 1462 to 300 lines):

diff -r 408b86bbe752 -r 5869da2721d8 sysutils/xentools45/Makefile
--- a/sysutils/xentools45/Makefile      Sat Aug 06 11:58:07 2016 +0000
+++ b/sysutils/xentools45/Makefile      Sat Aug 06 12:41:36 2016 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.36 2016/07/09 13:04:08 wiz Exp $
+# $NetBSD: Makefile,v 1.37 2016/08/06 12:41:36 spz Exp $
 
 VERSION=       4.5.3
-PKGREVISION=   2
+PKGREVISION=   3
 VERSION_IPXE=  9a93db3f0947484e30e753bbd61a10b17336e20e
 
 DISTNAME=              xen-${VERSION}
diff -r 408b86bbe752 -r 5869da2721d8 sysutils/xentools45/distinfo
--- a/sysutils/xentools45/distinfo      Sat Aug 06 11:58:07 2016 +0000
+++ b/sysutils/xentools45/distinfo      Sat Aug 06 12:41:36 2016 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.24 2016/05/21 20:11:21 bad Exp $
+$NetBSD: distinfo,v 1.25 2016/08/06 12:41:36 spz Exp $
 
 SHA1 (ipxe-git-9a93db3f0947484e30e753bbd61a10b17336e20e.tar.gz) = fecadf952821e830ce1a1d19655288eef8488f88
 RMD160 (ipxe-git-9a93db3f0947484e30e753bbd61a10b17336e20e.tar.gz) = 539bfa12db7054228250d6dd380bbf96c1a040f8
@@ -20,7 +20,9 @@
 SHA1 (patch-.._docs_misc_xl-disk-configuration.txt) = 5b59cfc2569d1a4c10d6c0fcb98ed35278723b79
 SHA1 (patch-Makefile) = eb5d3211b26c5f10a24fcca658c83d5f60990d9f
 SHA1 (patch-Rules.mk) = e0dc4234c35dc2d78afad4a90b0af829a6a10b50
+SHA1 (patch-XSA-178) = 5cb68dd7d82f537e9a9d0417cc79e8cafeb05ac2
 SHA1 (patch-XSA-179) = b73d44757651efe4b8df27cedd7f9827f3d6a6ca
+SHA1 (patch-XSA-180) = 58a93dec38792a36bca74123444eb72fafe158a3
 SHA1 (patch-blktap_drivers_Makefile) = 7cc53b2a0dea1694a969046ab8542271ca63f9e7
 SHA1 (patch-configure) = 97fa4274e425984d593cd93aea36edc681462b88
 SHA1 (patch-console_daemon_utils.c) = 915078ce6155a367e3e597fa7ab551f6afac083f
@@ -65,4 +67,5 @@
 SHA1 (patch-qemu-xen_qemu-doc.texi) = 721e80d15ac30ac71df3d6c4c485b0bf70897cf9
 SHA1 (patch-qemu-xen_util_hbitmap.c) = 5a495ae2b47d1ff6dd342633b8d655582f21dffe
 SHA1 (patch-qemu-xen_xen-hvm.c) = 11d4deb5de577e8beb2d1c6c3ca886e3d7563f8a
+SHA1 (patch-xenpaging_xenpaging.c) = 3faaa93ae6e1a0debdadf2e520f0f2781ee2ae10
 SHA1 (patch-xenstore_xc.c) = 51b39e9929062e72d0ff85f0ee6d13a6ac04ac65
diff -r 408b86bbe752 -r 5869da2721d8 sysutils/xentools45/patches/patch-XSA-178
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/xentools45/patches/patch-XSA-178 Sat Aug 06 12:41:36 2016 +0000
@@ -0,0 +1,1332 @@
+$NetBSD: patch-XSA-178,v 1.1 2016/08/06 12:41:36 spz Exp $
+
+patch for XSA-178 from the xenbits.xen.org git (stable-45 branch)
+by updating the affected files to the versions in git from today
+(20160806).
+
+Thus also included are:
+"libxl: Fix NULL pointer due to XSA-178 fix wrong XS nodename"
+"libxl: Cleanup: Have libxl__alloc_vdev use /libxl"
+"libxl: Cleanup: use libxl__backendpath_parse_domid in libxl__device_disk_from_xs_be"
+"libxl: keep PoD target adjustment by memory fudge after reload_domain_config()"
+
+which are fixes of errors introduced by XSA-178, XSA-175 and XSA-180 patches.
+
+This patch can be dropped when updating to 4.5.4
+
+--- libxl/libxl.c.orig 2016-03-23 13:57:27.000000000 +0000
++++ libxl/libxl.c
+@@ -21,10 +21,10 @@
+ #define PAGE_TO_MEMKB(pages) ((pages) * 4)
+ #define BACKEND_STRING_SIZE 5
+ 
+-/* Utility to read backend xenstore keys */
+-#define READ_BACKEND(tgc, subpath) ({                                   \
++/* Utility to read /libxl xenstore keys, from libxl_path */
++#define READ_LIBXLDEV(tgc, subpath) ({                                  \
+         rc = libxl__xs_read_checked(tgc, XBT_NULL,                      \
+-                                    GCSPRINTF("%s/" subpath, be_path),  \
++                                    GCSPRINTF("%s/" subpath, libxl_path),  \
+                                     &tmp);                              \
+         if (rc) goto out;                                               \
+         (char*)tmp;                                                     \
+@@ -1323,9 +1323,10 @@ static void disk_eject_xswatch_callback(
+                                         const char *wpath, const char *epath) {
+     EGC_GC;
+     libxl_evgen_disk_eject *evg = (void*)w;
+-    char *backend;
++    const char *backend;
+     char *value;
+     char backend_type[BACKEND_STRING_SIZE+1];
++    int rc;
+ 
+     value = libxl__xs_read(gc, XBT_NULL, wpath);
+ 
+@@ -1341,9 +1342,16 @@ static void disk_eject_xswatch_callback(
+     libxl_event *ev = NEW_EVENT(egc, DISK_EJECT, evg->domid, evg->user);
+     libxl_device_disk *disk = &ev->u.disk_eject.disk;
+     
+-    backend = libxl__xs_read(gc, XBT_NULL,
+-                             libxl__sprintf(gc, "%.*s/backend",
+-                                            (int)strlen(wpath)-6, wpath));
++    rc = libxl__xs_read_checked(gc, XBT_NULL, evg->be_ptr_path, &backend);
++    if (rc) {
++        LIBXL__EVENT_DISASTER(egc, "xs_read failed reading be_ptr_path",
++                              errno, LIBXL_EVENT_TYPE_DISK_EJECT);
++        return;
++    }
++    if (!backend) {
++        /* device has been removed, not simply ejected */
++        return;
++    }
+ 
+     sscanf(backend,
+             "/local/domain/%d/backend/%" TOSTRING(BACKEND_STRING_SIZE)
+@@ -1360,8 +1368,7 @@ static void disk_eject_xswatch_callback(
+     disk->pdev_path = strdup(""); /* xxx fixme malloc failure */
+     disk->format = LIBXL_DISK_FORMAT_EMPTY;
+     /* this value is returned to the user: do not free right away */
+-    disk->vdev = xs_read(CTX->xsh, XBT_NULL,
+-                         libxl__sprintf(gc, "%s/dev", backend), NULL);
++    disk->vdev = libxl__strdup(NOGC, evg->vdev);
+     disk->removable = 1;
+     disk->readwrite = 0;
+     disk->is_cdrom = 1;
+@@ -1384,19 +1391,30 @@ int libxl_evenable_disk_eject(libxl_ctx 
+     evg->domid = guest_domid;
+     LIBXL_LIST_INSERT_HEAD(&CTX->disk_eject_evgens, evg, entry);
+ 
+-    evg->vdev = strdup(vdev);
+-    if (!evg->vdev) { rc = ERROR_NOMEM; goto out; }
+-
+     uint32_t domid = libxl_get_stubdom_id(ctx, guest_domid);
+ 
+     if (!domid)
+         domid = guest_domid;
+ 
+-    path = libxl__sprintf(gc, "%s/device/vbd/%d/eject",
++    int devid = libxl__device_disk_dev_number(vdev, NULL, NULL);
++
++    path = GCSPRINTF("%s/device/vbd/%d/eject",
+                  libxl__xs_get_dompath(gc, domid),
+-                 libxl__device_disk_dev_number(vdev, NULL, NULL));
++                 devid);
+     if (!path) { rc = ERROR_NOMEM; goto out; }
+ 
++    const char *libxl_path = GCSPRINTF("%s/device/vbd/%d",
++                                 libxl__xs_libxl_path(gc, domid),
++                                 devid);
++    evg->be_ptr_path = libxl__sprintf(NOGC, "%s/backend", libxl_path);
++
++    const char *configured_vdev;
++    rc = libxl__xs_read_checked(gc, XBT_NULL,
++            GCSPRINTF("%s/dev", libxl_path), &configured_vdev);
++    if (rc) goto out;
++
++    evg->vdev = libxl__strdup(NOGC, configured_vdev);
++
+     rc = libxl__ev_xswatch_register(gc, &evg->watch,
+                                     disk_eject_xswatch_callback, path);
+     if (rc) goto out;
+@@ -1423,6 +1441,7 @@ void libxl__evdisable_disk_eject(libxl__
+         libxl__ev_xswatch_deregister(gc, &evg->watch);
+ 
+     free(evg->vdev);
++    free(evg->be_ptr_path);
+     free(evg);
+ 
+     CTX_UNLOCK;
+@@ -1985,15 +2004,16 @@ out:
+ /* common function to get next device id */
+ static int libxl__device_nextid(libxl__gc *gc, uint32_t domid, char *device)
+ {
+-    char *dompath, **l;
++    char *libxl_dom_path, **l;
+     unsigned int nb;
+     int nextid = -1;
+ 
+-    if (!(dompath = libxl__xs_get_dompath(gc, domid)))
++    if (!(libxl_dom_path = libxl__xs_libxl_path(gc, domid)))
+         return nextid;
+ 
+     l = libxl__xs_directory(gc, XBT_NULL,
+-                            GCSPRINTF("%s/device/%s", dompath, device), &nb);
++        GCSPRINTF("%s/device/%s", libxl_dom_path, device),
++                            &nb);
+     if (l == NULL || nb == 0)
+         nextid = 0;
+     else
+@@ -2156,14 +2176,15 @@ libxl_device_vtpm *libxl_device_vtpm_lis
+     GC_INIT(ctx);
+ 
+     libxl_device_vtpm* vtpms = NULL;
+-    char* fe_path = NULL;
++    char *libxl_path;
+     char** dir = NULL;
+     unsigned int ndirs = 0;
++    int rc;
+ 
+     *num = 0;
+ 
+-    fe_path = libxl__sprintf(gc, "%s/device/vtpm", libxl__xs_get_dompath(gc, domid));
+-    dir = libxl__xs_directory(gc, XBT_NULL, fe_path, &ndirs);
++    libxl_path = GCSPRINTF("%s/device/vtpm", libxl__xs_libxl_path(gc, domid));
++    dir = libxl__xs_directory(gc, XBT_NULL, libxl_path, &ndirs);
+     if (dir && ndirs) {
+        vtpms = malloc(sizeof(*vtpms) * ndirs);
+        libxl_device_vtpm* vtpm;
+@@ -2172,18 +2193,17 @@ libxl_device_vtpm *libxl_device_vtpm_lis
+           char* tmp;
+           const char* be_path = libxl__xs_read(gc, XBT_NULL,
+                 GCSPRINTF("%s/%s/backend",
+-                   fe_path, *dir));
++                   libxl_path, *dir));
+ 
+           libxl_device_vtpm_init(vtpm);
+ 
+           vtpm->devid = atoi(*dir);
+ 
+-          tmp = libxl__xs_read(gc, XBT_NULL,
+-                GCSPRINTF("%s/%s/backend-id",
+-                   fe_path, *dir));
+-          vtpm->backend_domid = atoi(tmp);
++          rc = libxl__backendpath_parse_domid(gc, be_path,
++                                              &vtpm->backend_domid);
++          if (rc) return NULL;
+ 
+-          tmp = libxl__xs_read(gc, XBT_NULL, GCSPRINTF("%s/uuid", be_path));
++          tmp = libxl__xs_read(gc, XBT_NULL, GCSPRINTF("%s/uuid", libxl_path));
+           if (tmp) {
+               if(libxl_uuid_from_string(&(vtpm->uuid), tmp)) {
+                   LOG(ERROR, "%s/uuid is a malformed uuid?? (%s) Probably a bug!!\n", be_path, tmp);
+@@ -2205,7 +2225,7 @@ int libxl_device_vtpm_getinfo(libxl_ctx 
+                               libxl_vtpminfo *vtpminfo)
+ {
+     GC_INIT(ctx);
+-    char *dompath, *vtpmpath;
++    char *libxl_path, *dompath, *vtpmpath;
+     char *val;
+     int rc = 0;
+ 
+@@ -2214,18 +2234,17 @@ int libxl_device_vtpm_getinfo(libxl_ctx 
+     vtpminfo->devid = vtpm->devid;
+ 
+     vtpmpath = GCSPRINTF("%s/device/vtpm/%d", dompath, vtpminfo->devid);
++    libxl_path = GCSPRINTF("%s/device/vtpm/%d",
++                           libxl__xs_libxl_path(gc, domid), vtpminfo->devid);
+     vtpminfo->backend = xs_read(ctx->xsh, XBT_NULL,
+-          GCSPRINTF("%s/backend", vtpmpath), NULL);
++          GCSPRINTF("%s/backend", libxl_path), NULL);
+     if (!vtpminfo->backend) {
+         goto err;
+     }
+-    if(!libxl__xs_read(gc, XBT_NULL, vtpminfo->backend)) {
+-       goto err;
+-    }
+ 
+-    val = libxl__xs_read(gc, XBT_NULL,
+-          GCSPRINTF("%s/backend-id", vtpmpath));
+-    vtpminfo->backend_id = val ? strtoul(val, NULL, 10) : -1;
++    rc = libxl__backendpath_parse_domid(gc, vtpminfo->backend,
++                                        &vtpminfo->backend_id);
++    if (rc) goto exit;
+ 
+     val = libxl__xs_read(gc, XBT_NULL,
+           GCSPRINTF("%s/state", vtpmpath));
+@@ -2240,14 +2259,11 @@ int libxl_device_vtpm_getinfo(libxl_ctx 
+     vtpminfo->rref = val ? strtoul(val, NULL, 10) : -1;
+ 
+     vtpminfo->frontend = xs_read(ctx->xsh, XBT_NULL,
+-          GCSPRINTF("%s/frontend", vtpminfo->backend), NULL);
++          GCSPRINTF("%s/frontend", libxl_path), NULL);
++    vtpminfo->frontend_id = domid;
+ 
+     val = libxl__xs_read(gc, XBT_NULL,
+-          GCSPRINTF("%s/frontend-id", vtpminfo->backend));
+-    vtpminfo->frontend_id = val ? strtoul(val, NULL, 10) : -1;
+-
+-    val = libxl__xs_read(gc, XBT_NULL,
+-          GCSPRINTF("%s/uuid", vtpminfo->backend));
++          GCSPRINTF("%s/uuid", libxl_path));
+     if(val == NULL) {
+        LOG(ERROR, "%s/uuid does not exist!\n", vtpminfo->backend);
+        goto err;
+@@ -2601,8 +2617,8 @@ void libxl__device_disk_add(libxl__egc *
+     device_disk_add(egc, domid, disk, aodev, NULL, NULL);
+ }
+ 
+-static int libxl__device_disk_from_xs_be(libxl__gc *gc,
+-                                         const char *be_path,
++static int libxl__device_disk_from_xenstore(libxl__gc *gc,
++                                         const char *libxl_path,
+                                          libxl_device_disk *disk)
+ {
+     libxl_ctx *ctx = libxl__gc_owner(gc);
+@@ -2612,15 +2628,27 @@ static int libxl__device_disk_from_xs_be
+ 
+     libxl_device_disk_init(disk);
+ 
+-    rc = sscanf(be_path, "/local/domain/%d/", &disk->backend_domid);
+-    if (rc != 1) {
+-        LOG(ERROR, "Unable to fetch device backend domid from %s", be_path);
+-        goto cleanup;
++    const char *backend_path;
++    rc = libxl__xs_read_checked(gc, XBT_NULL,
++                                GCSPRINTF("%s/backend", libxl_path),
++                                &backend_path);
++    if (rc) goto out;
++



Home | Main Index | Thread Index | Old Index