This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Determining if an address is valid prior to using it.


jimmie.davis@l-3com.com wrote:

> Given an arbitrary address, is it possible to test and see if it is in
> the process's address space ?

You could use /proc/self/maps to determine whether the address is
contained within a mapped page.  glibc itself uses this in some
obscure cases to determine whether printf format strings are writable.

This might not give the behaviour you want for the stack, because I
think /proc/self/maps reports what has been used rather than what
could be used.

I hesitate to recommend /proc/self/maps because it is hard to
implement in Plash, but that is really my problem rather than your
problem. :-)

Regards
Mark


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