GDB can't access mmap()'d kernel allocated memory?

和自甴很熟 提交于 2019-12-01 18:51:00

About why gdb cannot access the memory you want, I believe Linux does not make I/O memory accessible via ptrace().

According to cmemk.c (which I found in linuxutils_2_25.tar.gz), mmap() does indeed set the VM_IO flag on the memory in question.

To access this memory from gdb, add a function to your program that reads this memory and have gdb call this function.

lipnitsk

See examining-mmaped-addresses-using-gdb discussion in another thread and especially the answer here. You should be able to add a custom vm_operations_struct to your VMA in the module's mmap implementation.

Also see mm/memory.c in the Linux kernel. When get_user_pages() fails the code will try to call the custom vma->vm_ops->access implementation in your driver to access the memory.

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