I have a small program that mmaps potentially dangerous executable code (with PROT_EXEC), calls prctl(PR_SET_SECCOMP, 1) , and then executes this mmap'd code. All this is good and good, and allows me to “save” the evaluation state by synchronizing the mmap'd area on the disk and restarting it later (most likely, on another machine for load balancing). However, this method does not always work - because this code could make changes to the program that are not in the mmap'd area, and this information will be lost.
So, what I would like to do is to do absolutely everything (except for this mmap'd region) read-only before calling the code. Thus, I have a guarantee that the executable code cannot change the state of anything other than the mmap'd area, which I can serialize / deserialize as desired.
By the way, this is Linux on x86_64
thanks
source share