0

Possible Duplicate:
Is there a better way than parsing /proc/self/maps to figure out memory protection?

I have a pointer and I want to check if the referenced memory is readable, writeable and/or executable. How can I do this?

Community
  • 1
  • 1
Albert
  • 65,406
  • 61
  • 242
  • 386
  • I am voting to close, as any answers to this question are either in the other question or are valid answers to the other question. – David Thornley Aug 27 '10 at 15:36

1 Answers1

1

You will have to parse the file /proc/self/maps which contains memory mappings of your process, and check which of the mappings lie within the value of your pointer (if any). The /proc/self/maps file contains the memory protection (read/write/execute).

See this question for more info about the maps file.

Community
  • 1
  • 1
nos
  • 223,662
  • 58
  • 417
  • 506