Description of problem: When the specified number of characters is short, this issue does not occur because the pointer of ret is same as buf.content. But when that is long (i.e. exceeds 4000 bytes), this issue occurs because the wrong pointer is returned. So, we fixed the return value to not abend because of an excess number of characters. Here is a sequence of these case. --------------------------------------------------------------------- the case of specifying short command line: +--------------------------+ ret = buf.content => l malloc(4000) l +--------------------------+ 0x10 (pointer to the allocated memory) return(ret) --------------------------------------------------------------------- the case of specifying long command line: +--------------------------+ ret = buf.content => l malloc(4000) l +--------------------------+ 0x10 (pointer to the allocated memory) ** When the allocated memory is lacking, the size of the memory is ** ** changed by realloc at virBufferVSprintf. ** ** So the area pointed to was moved. ** +--------------------------+ ret => l malloc(4000) l +--------------------------+ 0x10 (pointer to the previously allocated memory) +---------------------------------+ buf.content => l realloc(6000) l +---------------------------------+ 0x30 (pointer to the newly allocated memory.) return(ret) <-- return the wrong pointer. --------------------------------------------------------------------- Version-Release number of selected component (if applicable): libvirt-0.2.3-9.el5 How reproducible: Always Steps to Reproduce: Run a bug line like: 1. Run: # virt-install --name=test --ram=350 --file=/dev/sda5 --paravirt \ --location=ftp://10.131.236.20/rhel5.1b_ia64< /a> --vnc --network=bridge \ --network=bridge --network=bridge --network=bridge --network=bridge \ --network=bridge --network=bridge --network=bridge --network=bridge \ --network=bridge --network=bridge --network=bridge --network=bridge \ --network=bridge --network=bridge --network=bridge --network=bridge \ --network=bridge --network=bridge --network=bridge --network=bridge \ --network=bridge --network=bridge --network=bridge --network=bridge \ --network=bridge --network=bridge --network=bridge --network=bridge \ --network=bridge --network=bridge --network=bridge ... Actual results: Segfault Additional info: Patch submitted to upstream and applied: https://www.redhat.com/archives/libvir-list/2007-August/msg00220.html Backported patch to RHEL5 attached. This ticket comes from IT#130873 and is related to BZ#273421 too.
Created attachment 193581 [details] Backported patch from upstream
This request was evaluated by Red Hat Product Management for inclusion in a Red Hat Enterprise Linux maintenance release. Product Management has requested further review of this request by Red Hat Engineering, for potential inclusion in a Red Hat Enterprise Linux Update release for currently deployed products. This request is not yet committed for inclusion in an Update release.
The patch for this issue is actually in the current libvirt-0.3.3-4.el5 package being built for 5.2, Daniel
Setting dev ack as this is fixed as per comment #4.
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on the solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2008-0291.html