WARNING - OLD ARCHIVES

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/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-users

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

To: "Petersson, Mats" <Mats.Petersson@xxxxxxx>
Subject: Re: [Xen-users] Why are shared libraries loaded multiple times in a guest VM?
From: "Arun Babu" <arunbabu.n@xxxxxxxxx>
Date: Tue, 27 Feb 2007 17:03:32 -0500
Cc: xen-users@xxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 27 Feb 2007 14:02:48 -0800
Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=joXYQ65YEqG7nKnRRwHU46JrxgrungKU8nr+h+r95stPxPT/1LmMZLz1ifO1EKeVb8v0ye8ur02NH0GvYeDToKo4gPCi+bhMEanTPYov+jAbHaocW7PgZO6VdjW0VbI/E/mEypXqE6LzJ/Lpn1zqEmZuoQ7lWcnRF7sN0yEwgwc=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=bE7Tu3R5bPSsDStrXfDtjLQXdbc0TZp+VI2q/GcwOjj0uLk/2ZB27PWEYshUaf/hglDgF/NYYU/xChafaiq8iM1IvJT3C1glac9Ri/YRJ6C1guTv0N3fMefDIwwEv/mHQ70YsgbgnGbzokXG8o9wnMGjXTuSsbFcCHycxJVR9fs=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <907625E08839C4409CE5768403633E0B018E19DA@xxxxxxxxxxxxxxxxx>
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>
References: <ce060c4d0702271022s3b14a4dib595663567a8533d@xxxxxxxxxxxxxx> <907625E08839C4409CE5768403633E0B018E19DA@xxxxxxxxxxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx


On 2/27/07, Petersson, Mats <Mats.Petersson@xxxxxxx> wrote:


> -----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 2.6.16.13 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
differently].

Thanks for your suggestions. But I think you got the issue wrongly.
What I am concerned is that how a library, which is already loaded in the
memory  is reloaded at a different place once again when another instance of the program
is started. (Please note that the 1st instance is still running on a busy loop while the second
instance is started.) Should'nt the second instance use the shared library which is available
in the memory?  This is all happening within a guest VM. I am not comparing
anything with Dom0.
(I do understand that we treat virtual machines as different physical ones and they are
not sharing pages!)

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).

--
Mats
>
> 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 >
>





--
"You just have to keep breathing. Because the sun will rise. And you never know what the tide will bring in" -- Chuck Noland :)
visit: http://www4.ncsu.edu/~abnagara
_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users
<Prev in Thread] Current Thread [Next in Thread>