News for hackers. Stuff that matters.
Re:On self-modifying executables in Rust by chubot on Friday January 28, 2022 @06:27PM (#30121929)
Surprisingly backtrace apparently uses self-modifying code in production for feature flags:

https://engineering.backtrace.io/2021-12-19-bounded-dynamici...

This is basically to make it zero cost (as far as I remember)

Google uses a similar system of feature flags, but as far as I know there's no self-modifying code. I guess Backtrace wants to put the flags in tight inner loops.

dtrace and I believe systemtap patch the executable at runtime, for similar performance reasons. But those are kernel features and not user applications.

Re:On self-modifying executables in Rust by sitkack on Sunday January 30, 2022 @09:36PM (#30143839)
You can do somethings like this using the .init and .fini sections in a dynamically loaded shared lib.

https://maskray.me/blog/2021-11-07-init-ctors-init-array