[libvirt] [PATCH] fix virsh coredumps when using ext transport

when we use an external process to connect remote libvirtd, virsh will coredump: # virsh -c qemu+ext://<target_ip>/system?command=cmd Segmentation fault (core dumped) This bug was caused by 3348a97b. Signed-off-by: Wen Congyang <wency@cn.fujitsu.com> --- src/remote/remote_driver.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index fae191c..1c13f4a 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -802,6 +802,18 @@ doRemoteOpen (virConnectPtr conn, goto failed; } + /* Run the external process. */ + if (!cmd_argv) { + if (VIR_ALLOC_N(cmd_argv, 2) < 0) + goto out_of_memory; + + cmd_argv[0] = strdup(command); + if (cmd_argv[0] == NULL) + goto out_of_memory; + + cmd_argv[1] = NULL; + } + if (virExec((const char**)cmd_argv, NULL, NULL, &pid, sv[1], &(sv[1]), &(errfd[1]), VIR_EXEC_CLEAR_CAPS) < 0) -- 1.7.1

On 12/22/2010 02:25 AM, Wen Congyang wrote:
when we use an external process to connect remote libvirtd, virsh will coredump:
# virsh -c qemu+ext://<target_ip>/system?command=cmd Segmentation fault (core dumped)
This bug was caused by 3348a97b.
Would it be easier instead to switch virsh over to using virCommand, and fix this in that process? -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On 12/22/2010 08:51 AM, Eric Blake wrote:
On 12/22/2010 02:25 AM, Wen Congyang wrote:
when we use an external process to connect remote libvirtd, virsh will coredump:
# virsh -c qemu+ext://<target_ip>/system?command=cmd Segmentation fault (core dumped)
This bug was caused by 3348a97b.
Would it be easier instead to switch virsh over to using virCommand, and fix this in that process?
In fact, it looks like Daniel's patches here to refactor remote protocol should be applied first: https://www.redhat.com/archives/libvir-list/2010-December/msg00058.html -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

At 12/22/2010 11:55 PM, Eric Blake Write:
On 12/22/2010 08:51 AM, Eric Blake wrote:
On 12/22/2010 02:25 AM, Wen Congyang wrote:
when we use an external process to connect remote libvirtd, virsh will coredump:
# virsh -c qemu+ext://<target_ip>/system?command=cmd Segmentation fault (core dumped)
This bug was caused by 3348a97b.
Would it be easier instead to switch virsh over to using virCommand, and fix this in that process?
In fact, it looks like Daniel's patches here to refactor remote protocol should be applied first: https://www.redhat.com/archives/libvir-list/2010-December/msg00058.html
Sorry, I don't notice Daniel's patch. Please ignore this patch.
participants (2)
-
Eric Blake
-
Wen Congyang