Emulating Windows system calls, take 2
Emulating Windows system calls, take 2
Posted Jul 20, 2020 20:03 UTC (Mon) by plugwash (subscriber, #29694)In reply to: Emulating Windows system calls, take 2 by tnemeth
Parent article: Emulating Windows system calls, take 2
This leads to the question that if a "personality" is going to be implemented in userland should it be implemented in the same process as the foreign code or a separate process.
There are pros to both approaches.
Pros of same process:
* The performance cost of switching context between processes is avoided.
* The emulation code can easily access data belonging to the foreign code through pointers
* For a foreign platform (like windows) where the "normal" interface is defined as a library ABI, not a syscall ABI most calls don't have to go through the emulation process at all.
Pros of separate process
* The foreign code cannot deliberately or accidentally mess with the emulation code.
* The foreign code can use the address space however it needs (wine has to use some fairly dirty tricks to allow non-relocatable windows binaries to be loaded in the required location)
* There is no need for a special mechanism to switch back and forth between regular syscall mode and foreign syscall mode.
* The system could potentially be used for security sandboxing as well as foreign code support.
