4 ms·
You can have all the pointers you want. The way my code works is it uses MAP_FIXED so that memory is always allocated to the same addresses. Even if you have AS
by jart 4y ago
You can have all the pointers you want. The way my code works is it uses MAP_FIXED so that memory is always allocated to the same addresses. Even if you have ASLR it will be the same every time.
The issue is mainly stack-allocated memory. For example, our `model` object here needed to be allocated on the heap, rather than being declared as an automatic variable. Since automatic objects is really an optimization unique to low-level languages like C++, I doubt that's going to be an issue for something like Python, where everything is probably a heap object.
Oh! Also be careful about .data objects (i.e. static variables). Those could prove problematic too. Although my code could easily be updated to memcpy() the memory between _etext and _end into the file.
- beagle3 4y agoAh! That’s brilliant. Thanks!