This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


RE: [Xen-users] Why are shared libraries loaded multiple times in a gues

To: "Arun Babu" <arunbabu.n@xxxxxxxxx>, xen-users@xxxxxxxxxxxxxxxxxxx
Subject: RE: [Xen-users] Why are shared libraries loaded multiple times in a guest VM?
From: "Petersson, Mats" <Mats.Petersson@xxxxxxx>
Date: Tue, 27 Feb 2007 19:43:06 +0100
Delivery-date: Tue, 27 Feb 2007 10:42:53 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <ce060c4d0702271022s3b14a4dib595663567a8533d@xxxxxxxxxxxxxx>
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcdanIBI99S6/bjTRCOjtLbyvxMKmAAAXF0g
Thread-topic: [Xen-users] Why are shared libraries loaded multiple times in a guest VM?

> -----Original Message-----
> From: xen-users-bounces@xxxxxxxxxxxxxxxxxxx 
> [mailto:xen-users-bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of Arun Babu
> Sent: 27 February 2007 18:23
> To: xen-users@xxxxxxxxxxxxxxxxxxx
> Subject: [Xen-users] Why are shared libraries loaded multiple 
> times in a guest VM?
> Hi,
> I have xen 3.0.2-3 installed with linux guests 
> running on them.
> I have a simple test program to print the address of a 
> function in a shared library (say printf) using dlopen and 
> dlsym. I ran this test on DomO and running another instance 
> of the same program (to make sure the library is still 
> loaded). Both instances print the same address (as expected). 
> But when I do this experiment on a DomU, I get different 
> addresses for the same function. Further investigation of 
> /proc/<pid>/maps shows that the same shared library is loaded 
> in different places on those two machines. Why isn't the 
> different instances of the test program refer the same shared 
> library/ why is the library loaded multiple times? 

Do I get it right that your "complaint" is that the same shared library
is loaded at different places in Dom0 and DomU? Since DomU is a
different (albeit virtual) machine, I don't see what there is to
complain about. In a real system with two different machines, you would
not complain that the shared library is in the memory of both machines,
right? Just because DomU is in the same physical machine as Dom0, it
doesn't have ANY way to actually even know that Dom0 is in the same
machine (aside from some timing aspects of running a virtual machine)
[para-virtual kernels have been modified to do things slightly

Obviously, if that's not what you're complaining about, sorry for
misunderstanding the "complaint"... 

The fact that the same shared library is loaded at a different address
within the virtual address range is probably something to do with what
virtual addresses are available and it may also depend on what other
shared libraries have already been loaded prior to this shared library -
shared libraries are located at "random" addresses in memory to avoid
collisions, but sometimes you get collisions anyways, and the OS will
then pick a different (free) random address. You'd probably find the
same thing if you have two different machines with slightly different
configurations and perhaps different daemons running (xend for example
will drag in a whole heap of shared libraries, both those belonging to
the python language and those built by xen). 

> Can somebody help me reason out why this is happening in 
> guest vm? Is this because of some boot option or anything 
> specific to xen? 
> Thank you
> Arun
> -- 
> http://www4.ncsu.edu/~abnagara <http://www4.ncsu.edu/~abnagara>  

Xen-users mailing list

<Prev in Thread] Current Thread [Next in Thread>