How can I find the mapped file when it's not s

2019-08-14 14:38发布

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条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-08-14 15:15

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.

查看更多
登录 后发表回答