4 ms·
That seems hard to enforce. I mean, you can block the kernel level execve, but perhaps user space can be hacked to do a user-level execve. Just unmap and re-ma
by kazinator 6y ago
That seems hard to enforce.
I mean, you can block the kernel level execve, but perhaps user space can be hacked to do a user-level execve. Just unmap and re-map the right pieces of memory, close the right file descriptors, do the right stuff with signal handlers and whatever not. No?
Look, Cygwin is able to simulate fork and exec on Windows, both of which are completely missing.
One thing that would put a damper on things would be disallowing executable mapping at all. But you can't just do that since it breaks shared libs. A mechanism that allows shared libs to be mapped executable and then drops the map-execute privilege wouldn't be secure. It would be annoying, but possible to bypass.
The only way it would work is if the entire process setup logic shared libs were moved into the kernel, so that the very first instruction that runs in a process is in a context that can no longer map any pages executable. Or else, it's still in user space, but the dynamic loader is specially privileged, and before dispatching the very first instruction in the loaded executable, it drops that privilege. Either way, so much for trampolines, JIT and other techniques). dlopen could not work either, unless it's moved into the kernel, and allows only "blessed" plugins.