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.


On Wed, Jul 23, 2008 at 4:06 PM,  <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 ?
>
> My current technique is to create a new thread, then access the memory
> from that thread.  Then if it did not segfault i know the address was
> valid.
>
> Is there a better way to do this ?

Portably? No.

Unportable? Yes. Use ptrace and PTRACE_PEEK?

Cheers,
Carlos.


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