Re: libvirt 1.2.1 vs. Xen 4.1.4

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

 



Guido Günther wrote:
> Hi,
>
> a user of Debian's libvirt backport to wheezy using Xen reported libvirt
> 1.2.1 failing for him like:
>
>  info : libvirt version: 1.2.1
>  error : virIdentityGetSystem:173 : Unable to lookup SELinux process context: Invalid argument
>  error : xenHypervisorDoV2Sys:1011 : Unable to issue hypervisor ioctl 3166208: Permission denied
>  error : xenHypervisorDoV2Sys:1011 : Unable to issue hypervisor ioctl 3166208: Permission denied
>  error : xenHypervisorDoV2Sys:1011 : Unable to issue hypervisor ioctl 3166208: Permission denied
>  error : xenHypervisorDoV2Sys:1011 : Unable to issue hypervisor ioctl 3166208: Permission denied
>  error : xenHypervisorDoV2Sys:1011 : Unable to issue hypervisor ioctl 3166208: Permission denied
>  error : xend_req:302 : internal error: failed to parse Xend response return code
>  error : xend_req:302 : internal error: failed to parse Xend response return code
>  error : virNetSocketReadWire:1454 : End of file while reading data: Input/output error
>   

I was able to reproduce this with git master and Xen 4.1.6.  The
attached patch fixes it for me.

Regards,
Jim
>From 37564b471da7e9080284149f8350241afd448515 Mon Sep 17 00:00:00 2001
From: Jim Fehlig <jfehlig@xxxxxxxx>
Date: Tue, 28 Jan 2014 18:15:48 -0700
Subject: [PATCH] xen: fix parsing xend http response

Commit df36af58 broke parsing of http response from xend.  The prior
use of atoi() would happily parse e.g. a string containing "200 OK\r\n",
whereas virStrToLong_i() will fail when called with a NULL end_ptr.
Change the calls to virStrToLong_i() to provide a non-NULL end_ptr.

Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxx>
---
 src/xen/xend_internal.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index 87e77a6..25137b8 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -282,6 +282,7 @@ xend_req(int fd, char **content)
     size_t buffer_size = 4096;
     int content_length = 0;
     int retcode = 0;
+    char *end_ptr;
 
     if (VIR_ALLOC_N(buffer, buffer_size) < 0)
         return -1;
@@ -291,13 +292,13 @@ xend_req(int fd, char **content)
             break;
 
         if (istartswith(buffer, "Content-Length: ")) {
-            if (virStrToLong_i(buffer + 16, NULL, 10, &content_length) < 0) {
+            if (virStrToLong_i(buffer + 16, &end_ptr, 10, &content_length) < 0) {
                 virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                                _("failed to parse Xend response content length"));
                 return -1;
             }
         } else if (istartswith(buffer, "HTTP/1.1 ")) {
-            if (virStrToLong_i(buffer + 9, NULL, 10, &retcode) < 0) {
+            if (virStrToLong_i(buffer + 9, &end_ptr, 10, &retcode) < 0) {
                 virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                                _("failed to parse Xend response return code"));
                 return -1;
-- 
1.8.1.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]