I have a 64bit process using the /proc filesystem to control a 64bit target process. The target process has a shared library called libxxx.so linked to it containing function xxx(). If libxxx.so is loaded in 'shared library text' space then my controlling process can write a break instruction at the address of function xxx() to the /proc/<pid>/as file. That puts a breakpoint in function xxx() which I'll hit when I continue the target process.
However, I can modify the permissions on libxxx.so to force the shared library to be loaded privately using 'chmod o-rx libxxx.so'. If libxxx.so is loaded in 'private load text', then the write of the breakpoint to the /proc/<pid>/as file fails with EIO.
Why does the write to the address space in the privately loaded shared library fail ? Is there a way around this or do I need to use hardware breakpoint registers ?