开发者

how to get the memory access type in C/C++ in Linux [duplicate]

开发者 https://www.devze.com 2023-01-13 23:04 出处:网络
This question already has answers h开发者_StackOverflowere: Closed 9 years ago. Possible Duplicate: Is there a better way than parsing /proc/self/maps to figure out memory protection?
This question already has answers h开发者_StackOverflowere: Closed 9 years ago.

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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消