From: Jes Sorensen <Jes.Sorensen@redhat.com>
To: Gordan Bobic <gordan@bobich.net>
Cc: kvm@vger.kernel.org
Subject: Re: KSM For All Via LD_PRELOAD?
Date: Thu, 10 Jun 2010 13:27:09 +0200 [thread overview]
Message-ID: <4C10CC0D.70806@redhat.com> (raw)
In-Reply-To: <4C10ABBB.8070009@bobich.net>
On 06/10/10 11:09, Gordan Bobic wrote:
> On 06/10/2010 08:44 AM, Jes Sorensen wrote:
>> Not sure if it is worth it, but you might want to look at ElectricFence
>> which does malloc wrapping in a somewhat similar way. It might save you
>> some code :)
>
> I'll look into it, but I don't see this requiring more than maybe 50
> lines of code, including comments, headers and Makefile. I was planning
> to literally just intercept mmap()/brk()/malloc() and mark them with
> madvise() when the underlying call returns.
I suspect it will grow in complexity to catch corner cases, but see
where it takes you.
> Which brings me to another question:
>
> Would intercepting malloc() be completely redundant if mmap() is
> intercepted? Would I also need to do something with intercepting free()?
> Is three anything else I would need to intercept?
You need to have a look at glibc to see what it is doing. I am not sure
what the current malloc implementation is based on these days.
>> Whether or not you will run into problems if you run it system wise is
>> really hard to predict. Any other application that might be linked in a
>> special way or use preload itself might bark, but you can try it out and
>> see what explodes.
>
> Thanks for the heads up. Can you think of any such applications off the
> top of your head?
Sorry, nothing off hand. A normal Linux distro runs so many applications
just at bootup that it's very hard to keep track of what might cause
problems. You might end up having to create a blacklist in your library
to work around it, but you will only find out when you start trying the
boot.
Cheers,
Jes
prev parent reply other threads:[~2010-06-10 11:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-08 18:43 KSM For All Via LD_PRELOAD? Gordan Bobic
2010-06-09 8:33 ` Dor Laor
2010-06-09 8:56 ` Paolo Bonzini
2010-06-09 10:31 ` Gordan Bobic
2010-06-10 7:33 ` Dor Laor
2010-06-10 9:03 ` Gordan Bobic
2010-06-10 7:44 ` Jes Sorensen
2010-06-10 9:09 ` Gordan Bobic
2010-06-10 11:27 ` Jes Sorensen [this message]
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=4C10CC0D.70806@redhat.com \
--to=jes.sorensen@redhat.com \
--cc=gordan@bobich.net \
--cc=kvm@vger.kernel.org \
/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