|
Home > Archive > Unix Programming > April 2004 > chroot() and dlopen()
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
chroot() and dlopen()
|
|
| phil-news-nospam@ipal.net 2004-04-29, 6:34 am |
| Should dlopen() be able to work when chroot() into another directory,
even if the library being loaded only has references to symbols that
are already loaded in the process. I'm wondering if the references
to specific libraries within the library being loaded are made using
the given filesystem paths, which will no longer be valid under the
chroot directory.
The executable will be dynamically linked with libc and other libraries
that will be needed when it starts. Then calls chroot(), then later
calls dlopen(). The library being dlopen'd is in the chroot directory,
and is being referenced in a way it can be found.
--
-----------------------------------------------------------------------------
| Phil Howard KA9WGN | http://linuxhomepage.com/ http://ham.org/ |
| (first name) at ipal.net | http://phil.ipal.org/ http://ka9wgn.ham.org/ |
-----------------------------------------------------------------------------
| |
| Måns Rullgård 2004-04-29, 7:34 am |
| phil-news-nospam@ipal.net writes:
> Should dlopen() be able to work when chroot() into another directory,
> even if the library being loaded only has references to symbols that
> are already loaded in the process.
That sounds like something that could very well be implementation
specific. I wouldn't expect any portable behavior there.
> I'm wondering if the references to specific libraries within the
> library being loaded are made using the given filesystem paths,
> which will no longer be valid under the chroot directory.
That would be the case. Maybe you could get away with placing dummy
libraries inside the chroot.
--
Måns Rullgård
mru@kth.se
| |
| David Schwartz 2004-04-29, 6:34 pm |
|
<phil-news-nospam@ipal.net> wrote in message
news:c6qhmv0499@news1.newsguy.com...
> Should dlopen() be able to work when chroot() into another directory,
> even if the library being loaded only has references to symbols that
> are already loaded in the process. I'm wondering if the references
> to specific libraries within the library being loaded are made using
> the given filesystem paths, which will no longer be valid under the
> chroot directory.
If 'dlopen' requires opening a file outside of the 'chroot', it had
better not work.
> The executable will be dynamically linked with libc and other libraries
> that will be needed when it starts. Then calls chroot(), then later
> calls dlopen(). The library being dlopen'd is in the chroot directory,
> and is being referenced in a way it can be found.
It depends upon when the file is opened, which I would imagine might be
implementation specific.
DS
|
|
|
|
|