This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [PATCH] Restore dlsym(RTLD_NEXT, ...) behaviour (take 2)


On Wed, May 16, 2001 at 10:48:21PM -0700, Ulrich Drepper wrote:
> Jakub Jelinek <jakub@redhat.com> writes:
> 
> > Ok, here are two variants of the patch.
> 
> Finally managed to look at the patches... and don't like them.  Code like
> 
> 
> +             if (! _dl_loaded
> +                 || _dl_loaded->l_addr != 0
> +                 || caller < _dl_loaded->l_map_start)
> 
> 
> makes certain assumptions about the memory layout and load addresses.
> This should not happen.  There is no reason why the application code
> should always be below all dynamically loaded code.  In fact, isn't
> the x86 emulation on IA-64 doing something funny like this?

It actually does not make any assumptions about the memory layout.
The check just comes from the fact that main program has l_map_start valid,
but l_map_end -1UL. The first two checks correspond to the code above it,
basically if ! _dl_loaded, we for sure aren't called from dynamically linked
main program, if _dl_loaded->l_addr != 0, then _dl_loaded had valid
l_map_start and l_map_end and was already checked, if caller <
_dl_loaded->l_map_start, then it cannot be from main.
One of the patches tries to check the other direction, but as l_map_end is
not exact for main program, the check is not exact either. The only thing it
can say is if some DSO is above main binary and caller is above its
l_map_start, then it cannot come from main program.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]