4 ms·
Dynamic patching of return addresses is a very cool trick. I don't think I've seen this before. Have you run into any situations where this crashes programs or
by felixge 2y ago
Dynamic patching of return addresses is a very cool trick. I don't think I've seen this before. Have you run into any situations where this crashes programs or otherwise interferes with their execution?
- peterfirefly 2y agoTurbo Pascal used it for the overlay implementation (for DOS) -- overlays = virtual memory at home. TP 5.0 from 1988 was the first version that had it. The idea was to make sure the code the CPU returned to would actually be in memory. I'm pretty sure Windows 1.0 did something very similar.
- tdullien 2y agoIt's going to play poorly when C++ exceptions are thrown/caught.
- felixge 2y agoLooking at the code [1] it seems like the library is actively trying to handle this problem. [1] https://github.com/koute/not-perf/blob/master/nwind/src/local_unwinding.rs https://github.com/koute/not-perf/blob/master/nwind/src/loca...
- kouteiheika 2y agoIt should support C++ exceptions. The trampolines have exception landing pads included to catch and rethrow any exceptions which are thrown through them.
- kouteiheika 2y agoIf the program's already doing weird stuff with the stack/control flow/etc., yes, but that should be relatively rare and for the majority of the programs it should work fine.
- felixge 2y agoThanks for the reply. I ended up implementing this idea in Go and wrote a blog post about the results: https://blog.felixge.de/blazingly-fast-shadow-stacks-for-go/ https://blog.felixge.de/blazingly-fast-shadow-stacks-for-go/ I'm curious if you've done any benchmarking for your implementation as well?
- kouteiheika 2y ago> Thanks for the reply. I ended up implementing this idea in Go and wrote a blog post about the results: https://blog.felixge.de/blazingly-fast-shadow-stacks-for-go/ https://blog.felixge.de/blazingly-fast-shadow-stacks-for-go/ Nice! > I'm curious if you've done any benchmarking for your implementation as well? Not in any detail; I just checked that it's significantly faster than doing it naively and left it at that since it was fast enough for my use case.