Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Jan 1998 22:57:33 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        hasty@rah.star-gate.com (Amancio Hasty)
Cc:        dap@damon.com, hasty@rah.star-gate.com, freebsd-hackers@FreeBSD.ORG, nate@mt.sri.com, tlambert@primenet.com
Subject:   Re: dladdr hax
Message-ID:  <199801092257.PAA00886@usr04.primenet.com>
In-Reply-To: <199801082328.PAA04229@rah.star-gate.com> from "Amancio Hasty" at Jan 8, 98 03:28:24 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> Well, the exec part is component the other is that dladdr is used
> to locate where a library was loaded from. Again, for the command path
> argv[0] clearly tells you where the command got executed from.

Yes.  This is pretty much never used, at least in java.  The argv[0]
is what is returned.  The information is the information known to the
crt0 and/or the ld.so.1 (Sun versions their ld.so becuase they are
smarter than we are.  8-) 8-)).

> If I am not mistaken the command execution portion should be also
> in the U area or some clever location for the ps to be able to 
> display it.

No kernel work is really needed.


> My wild guess is that ld.so should keep an internal table of 
> start - end  address plus path of library . The dladdr should
> be a simple exercise to locate the address range where a variable
> lies in. If we don't want to implement dladdr if the table
> is accessible to the program we can do the library lookup 8)

Yes.  The actual thing it does is dlsym the address to get the symbol
before the address.  Actually, for multiple shared libraries, if there
were no start/end symbols spanning the full library address space, it
would "erroneously" report the last symbol of the previously
contiguous address space (either the library before, or the program
address space, or 0, if the page containing the address wasn't mapped).

Heh.  This is fun...


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199801092257.PAA00886>