mprotect返回ENOMEM以获取solib中的地址空间,任何变通方法?

时间:2012-05-24 06:28:06

标签: c linux shared-libraries

我试图通过dlopen调用对动态加载的共享库中的特定地址空间进行写访问。这样做有什么限制吗?我知道它可以完成,因为可以使用gdb调试solib。 Gdb使用mprotect来获取对solib的写访问权以插入和清除断点。

作为返回,我得到-1作为返回,29作为错误编号,perror给出ENOMEM Cannot allocate memory

ENOMEM  
The application has requested Single UNIX Specification, Version 2 compliant behavior, but addresses in the range are not valid for the address space of the process, or the addresses specify one or more pages that are not attached to the user's address space by a previous mmap or shmat subroutine call.

0 个答案:

没有答案