qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Stefan Weil <sw@weilnetz.de>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/5] vdi: don't override libuuid symbols
Date: Thu, 22 Nov 2012 08:33:00 +0100	[thread overview]
Message-ID: <20121122073300.GA7398@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <50AD2AA4.1070106@weilnetz.de>

On Wed, Nov 21, 2012 at 08:25:24PM +0100, Stefan Weil wrote:
> Am 21.11.2012 11:12, schrieb Stefan Hajnoczi:
> >It's poor symbol hygiene to provide a global symbols that collide with a
> >common library like libuuid.  If QEMU links against a shared library
> >that depends on uuid_generate() it can end up calling our stub version
> >of the function.
> >
> >This exact scenario happened with GlusterFS libgfapi.so, which depends
> >on libglusterfs.so's uuid_generate().
> >
> >Scope the uuid stubs for vdi.c only and avoid affecting other shared
> >objects.
> >
> >Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> >Reviewed-by: Kevin Wolf <kwolf@redhat.com>
> >---
> >  block/vdi.c | 9 +++------
> >  1 file changed, 3 insertions(+), 6 deletions(-)
> >
> 
> 
> Hi Stefan,
> 
> I'm not opposed to this patch but would like to better understand
> the problem which you had with the old solution.
> 
> Does libglusterfs.so really have a uuid_generate? Why does it not
> take the implementation from libuuid.so? Then QEMU could also
> use libuuid.so, and there would be no problem at all.
> 
> I tried to reproduce the problem but could not find a libgfapi.so
> in the Debian or Ubuntu package archives.

libgfapi.so is only in glusterfs.git/master.  It has not yet been
available in a release.

The problem occurs when QEMU and GlusterFS are built on a system without
the libuuid.h development header.

QEMU's behavior in this situation is to build our own libuuid stubs in
block/vdi.c.  The symbols are global.

GlusterFS's behavior in this situation is to build with its own libuuid
implementation.  The symbols are global in libglusterfs.so.  The
libgfapi.so shared object links against libglusterfs.so and expects its
uuid_generate() symbol to be resolved.

The fun happens when using QEMU block/gluster.c and it calls into
libgfapi.so.  It seems QEMU's block/vdi.c libuuid stubs are bound and
GlusterFS is now calling QEMU's dummy code - uuid_generate() always
returns the zero UUID!

Both QEMU and GlusterFS should not provide global symbols for a common
library.

Stefan

  reply	other threads:[~2012-11-22  7:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-21 10:12 [Qemu-devel] [PULL 1.3-rc1 0/5] Block patches for QEMU 1.3-rc1 Stefan Hajnoczi
2012-11-21 10:12 ` [Qemu-devel] [PATCH 1/5] block: add bdrv_reopen() support for raw hdev, floppy, and cdrom Stefan Hajnoczi
2012-11-21 10:12 ` [Qemu-devel] [PATCH 2/5] vdi: don't override libuuid symbols Stefan Hajnoczi
2012-11-21 19:25   ` Stefan Weil
2012-11-22  7:33     ` Stefan Hajnoczi [this message]
2012-11-21 10:12 ` [Qemu-devel] [PATCH 3/5] use int64_t for return values from rbd instead of int Stefan Hajnoczi
2012-11-21 10:12 ` [Qemu-devel] [PATCH 4/5] ide: Fix crash with too long PRD Stefan Hajnoczi
2012-11-21 10:12 ` [Qemu-devel] [PATCH 5/5] ide: Fix status register after short PRDs Stefan Hajnoczi
2012-11-26 15:34 ` [Qemu-devel] [PULL 1.3-rc1 0/5] Block patches for QEMU 1.3-rc1 Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121122073300.GA7398@stefanha-thinkpad.redhat.com \
    --to=stefanha@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sw@weilnetz.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).