How can I find the mapped file when it's not shown in proc maps?

戏子无情 提交于 2019-12-11 06:43:08

问题


I was trying to gdb a function, with it's callstack, the calling one falls into address a4734000-a4e93000, so I check the /proc//maps file and found there are:

a4734000-a4e93000 r-xp 00000000 00:00 0 
a4ee0000-a527c000 r-xp 00000000 00:00 0

This doesn't make sense to me, because normally it would show the target binary file that is mapped for the executable addresses. Does anyone know is this some sort of trick? Thanks a lot.


回答1:


Permission field r-xp contains p, so these mappings are private. Path field is empty, so these mappings are anonymous.

Thus, these are private anonymous mappings, created with MAP_ANON and MAP_PRIVATE flags. They probably were created by malloc(3):

When allocating blocks of memory larger than MMAP_THRESHOLD bytes, the glibc malloc() implementation allocates the memory as a private anonymous mapping using mmap(2).

See also this question and documentation.



来源:https://stackoverflow.com/questions/31512704/how-can-i-find-the-mapped-file-when-its-not-shown-in-proc-maps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!