To diagnose an error memory corruption error (memory gets accidentally overwritten), I thought about using Electric Fence + some mprotect user calls to ensure that damaged data structures are write-only when I want them to be written (and I get it right away SIGSEGV when they try to record them in).
Unfortunately, the above code is a Ruby C extension that forces it to run a performance nightmare under winfence since the entire ruby interpreter runs under libefence using
export LD_PRELOAD=libefence.so.0.0
So slow.
OTOH, linking the ruby extension to libefence directly (by passing -lefence to the linker) seems to have no effect, making it work without the libefence toolkit.
Is there a way to only run memory allocations that occur in a specific shared library through libefence and leaving other shared libraries and the main process?
source
share