SimpleCodeManager is functional but really not great. Due to the huge allocation granularity on Windows, it will cause considerable address space fragmentation when hooking multiple functions. This is a serious problem for us because, unlike the average 64-bit application, we actually need our code allocations to be near the code we're hooking.
We need two additional code managers:
[x] PageCodeManager: Allocates from the OS using the system allocation granularity. Hands out a full page for each code allocation. Enforces W^X.
[ ] BlockCodeManager: Allocates from the OS using the system allocation granularity. Hands out tiny blocks of memory for each code allocation. Always RWX (no W^X support).
Maybe also rename SimpleCodeManager to something like SparseCodeManager. Or just nuke it. 🤷
SimpleCodeManager
is functional but really not great. Due to the huge allocation granularity on Windows, it will cause considerable address space fragmentation when hooking multiple functions. This is a serious problem for us because, unlike the average 64-bit application, we actually need our code allocations to be near the code we're hooking.We need two additional code managers:
PageCodeManager
: Allocates from the OS using the system allocation granularity. Hands out a full page for each code allocation. Enforces W^X.BlockCodeManager
: Allocates from the OS using the system allocation granularity. Hands out tiny blocks of memory for each code allocation. Always RWX (no W^X support).Maybe also rename
SimpleCodeManager
to something likeSparseCodeManager
. Or just nuke it. 🤷