mmap on /proc/pid/mem

和自甴很熟 提交于 2020-01-19 06:01:49

问题


Has anybody succeeded in mmap'ing a /proc/pid/mem file with Linux kernel 2.6? I am getting an ENODEV (No such device) error. My call looks like this:

char * map = mmap(NULL, PAGE_SIZE, PROT_READ, MAP_SHARED, mem_fd, offset);

And I have verified by looking at the /proc/pid/maps file while debugging that, when execution reaches this call, offset has the value of the top of the stack minus PAGE_SIZE. I have also verified with ptrace that mmap is setting errno to ENODEV.


回答1:


See proc_mem_operations in /usr/src/linux/fs/proc/base.c: /proc/.../mem does not support mmap.



来源:https://stackoverflow.com/questions/5216326/mmap-on-proc-pid-mem

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