veryfiing a memory address

Peter J. Braam (braam@cs.cmu.edu)
Sat, 4 Jan 1997 12:16:16 -0800 (PST)


Happy new year!

Is there a way to verify if one can read/write an address in memory, other
than handling the segfault that would happen if it failed?

Under Mach one has a system call "vm_region" which returns such
information on a region.

We have "mprotect" which verifies, but also sets a flag. It would be great
if mprotect could be used as a checker without changing the flags on the
region.

For example we could do this by letting "mprot" change nothing but just
verify if the prot argument is negative.

Maybe something else is in place already?

- Peter -
braam@cs.cmu.edu