Possible duplicate:
Removing a Native Process Memory Card in OS X 10.5 / 10.6
In OS X, I can use mprotect() to request that a specific memory page be made by some combination of a readable, writable, or executable file.
I want to know how to determine the current level of protection. For example, on Linux, I can cat /proc/$$/maps find out the same information:
$ cat /proc/$$/maps 00400000-004db000 r-xp 00000000 fb:00 131145 /bin/bash 006da000-006db000 r--p 000da000 fb:00 131145 /bin/bash 006db000-006e4000 rw-p 000db000 fb:00 131145 /bin/bash 006e4000-006ea000 rw-p 00000000 00:00 0 00df4000-00e55000 rw-p 00000000 00:00 0 [heap] ...
Here I see that for the main executable file there are 5 ranges of memory ( bash ), one is read / execute, one is read-only, and the rest is read / write.
I looked through all the manual pages and the official APIs that I can find to get the same information about OS X and is still empty. The only thing I found was to close mincore() to find out if the page is in the kernel or not. But this is not enough; I also need the current permission set.
Is there any undocumented way to do this?
source share