3 ms·
Halfway through the article when he finds stat is the problem, I was surprised he didn't just solve it with a hastily coded LD_PRELOAD shim and move on with his
by chunkyks 6y ago
Halfway through the article when he finds stat is the problem, I was surprised he didn't just solve it with a hastily coded LD_PRELOAD shim and move on with his day. I'm routinely working with Fortran that predates my birth. If I find a convenient inflection point to inject a trivial solution, that's usually much easier and safer than trying to debug the code and later discover that it makes use of a computed goto or a longjmp that would cause an insidious bug
- neerajsi 6y agoDoes ld_preload work for static binaries?
- uselesscynicism 6y agohttps://stackoverflow.com/questions/60450102/why-does-ld-preload-work-with-syscalls https://stackoverflow.com/questions/60450102/why-does-ld-pre... > No, it doesn't. A static binary has no need to resolve any symbol dynamically, and therefore the dynamic loader is not invoked to resolve the usual library function symbols.
- chunkyks 6y agoAh, I missed that part. No, LD_PRELOAD isn't going to be able to overwrite statically linked functions
- touisteur 6y agoNot for fully static, but apart from go programs those are pretty rare, right? For everything-static-but-libc it's still OK.