From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45749) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0AS5-0003t6-Bw for qemu-devel@nongnu.org; Thu, 26 Jun 2014 10:15:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X0ARx-0003yh-7Y for qemu-devel@nongnu.org; Thu, 26 Jun 2014 10:15:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47533) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0ARw-0003y6-Vt for qemu-devel@nongnu.org; Thu, 26 Jun 2014 10:14:53 -0400 Date: Thu, 26 Jun 2014 15:56:11 +0200 From: Kevin Wolf Message-ID: <20140626135611.GE3282@noname.redhat.com> References: <9ca16cc7ed58cd133ea2c8d86c29707b54005e1d.1403685480.git.mprivozn@redhat.com> <53AAD2B8.6010706@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="fdj2RfSjLxBAspz7" Content-Disposition: inline In-Reply-To: <53AAD2B8.6010706@redhat.com> Subject: Re: [Qemu-devel] [PATCH for 2.1] qemu_opts_append: Play nicely with QemuOptsList's head List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Michal Privoznik , qemu-devel@nongnu.org, Stefan Hajnoczi , Chunyan Liu --fdj2RfSjLxBAspz7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Am 25.06.2014 um 15:46 hat Eric Blake geschrieben: > On 06/25/2014 02:38 AM, Michal Privoznik wrote: > > When running a libvirt test suite I've noticed the qemu-img is > > crashing occasionally. Tracing the problem down led me to the > > following valgrind output: >=20 > Thanks for tracking this! It has been reported in other threads, but > yours is the first patch. >=20 > > The problem is apparently in the qemu_opts_append(). Well, if it > > gets called twice or more. On the first call, when @dst is NULL > > some initialization is done during which @dst->head list gets > > initialized. The list is initialized in a way, so that the list > > tail points at the list head. However, the next time > > qemu_opts_append() is called for new options to be added, > > g_realloc() may move @dst at new address making the old list tail >=20 > s/at new/to a new/ >=20 > > point at invalid address. If that's the case we must update the > > list pointers. > >=20 > > Signed-off-by: Michal Privoznik > > --- > > util/qemu-option.c | 11 ++++++++++- > > 1 file changed, 10 insertions(+), 1 deletion(-) >=20 > Reviewed-by: Eric Blake >=20 >=20 > > + need_head_update =3D true; > > + } else { > > + /* Moreover, even if dst is not NULL, the realloc may move it = at a >=20 > s/at/to/ Thanks, fixed the comments and applied to the block branch. Kevin --fdj2RfSjLxBAspz7 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJTrCZ7AAoJEH8JsnLIjy/WvCwQAKziS3Rpfp+m3To/oJP9v3ZW 0F6SpQxuPFNMV+EN80TlgiM18KAwKTgyZsUj8NonVGGFMRbFk0ZV/IdJsaaj+nMT 2B8nrv4hbB7hFz8gptkeP6hi+WL6AyBisfIZbp/3vDhEm3jPos23XVyHKqMgND0B VjfzhZL6EVc+ptIjfFby+hf1CBOy+029JwmBpWgA7afrqlmJ6clk1vhu9Dx+wixd 4xXOmH2EiIltuWz+nRLRrD7mJgjwN1eOHBLrxHEj5bLoQx9u8cjHb9+DQdxEKijg yPW+fg1mOX5TATcul/iDe9cO7nR6WHGKuEFMyHnlaexq8PDHtuRzGwtxIeAzVJRn aqcjgam6cLi1pw6SkZZn1fwB4VNydvzySBuNfiKJwWBzat30Jsq/hFAUTxnViP0n WfvWp3rotoI2HxCPiFW9orOzUZb+Rwqi9OvgrNWZM7466rLw7kkLpDdy25DNFknD x3hhvCcdvAqRe2rMB8F3TMoH4dOtIKh4f+8Sbufcq+t4SFHhDcDuTZe5RB7Pr2Um aXXb8t2h+KcL5zO3agzmKjREoFsrOQlrOZGBgJ0ah5k4Cr8gkvlo7goRvAOb4wN0 geD6xWp8cjWaqxMxuzl1remiYtLHSX8um39x4TSU+gcg/WEQ8ejsURZ+hgmL3VaC RY6ery4L3AZ5gBKY+xhU =tcmH -----END PGP SIGNATURE----- --fdj2RfSjLxBAspz7--