ethan@plaxo.com wrote:Why not just run emulation regardless? I'm assuming that the emulation mode is relatively secure. Is their overhead involved with it enabled?
there is indeed an overhead because emulation requires a user/kernel transition which on i386 is quite expensive (several hundreds of cycles). but that's not the reason for its not being automatic. as Brad already said, emulation (be that gcc trampolines or something else) implies that an attacker can make use of it as well. depending on how much 'state' the code in question changes, it may or may not help the attack. the gcc trampolines allow one to load a register with arbitrary value and jump to an arbitrary location. while the latter gains nothing for an attack, the former does (or may at least) and hence i decided to be on the safe side and not allow automatic emulation.
i made only one exception in the past: EMUSIGRT which allows one to use a libc that doesn't supply its own signal restorer (like uClibc back then), and i don't plan to make more. nevertheless, the change to do automatic gcc trampoline emulation is very simple, one just has to ignore the EMUTRAMP flag in pax_handle_fetch_fault(), everyone who really wants it can just remove that check (or alternatively use the ACL system and the G subject flag).