Microsoft Engineer Proposes “Trampfd” for Improving Linux Security
phoronix.com
phoronix.com
A page fault is used as a way of executing the trampoline without the page having to be made executable/writable---the page fault handler recognises the page as a special trampoline page and handles the jump to the trampolines target address (which was previously registered using the new syscall).
Note that AFAICS this is unrelated to Spectre. The intended use is for constructing closures for use in FFI libraries such as libffi.
EDIT: I think I perhaps misunderstood your query---are you saying why not just make a system call where the kernel creates the page for you with the desired trampoline code and execute permissions?
edit: also, “spectre mitigations” was just a shot in the dark. It does feel like this mode of jmping (modifying saved registers and restoring them) would be more prone to interfering with speculative execution.
I'm guessing, the charitable version could be that the implementation on a major processor vendor works out to be just the right amount of security because the page fault handler wasn't optimized as heavily as the syscall interface. So, this might provide better security on a "slower" path, which turns out to actually be faster once the faster path is fully secured?
But the article is lazy and doesn't mention why it's important, so we're all going to infer something different about it.
[1] https://www.phoronix.com/scan.php?page=news_item&px=Intel-Bu...
[2] https://www.phoronix.com/scan.php?page=news_item&px=Google-Z...
[3] https://www.phoronix.com/scan.php?page=news_item&px=L1d-Cach...
For example, since Alyssa Rosenzweig writes full-length articles about her and others' work on Mesa drivers for Mali GPUs, she is mentioned in article titles or in main paragraphs, or Collabora is mentioned.
Michael also covers interesting hires and organizational changes, like Valve hiring another developer for RADV this week, Valve is prominent in the title because it is important social information.
If Microsoft is using the hours of the engineer’s workday for this purpose, it provides insight that does matter.
This was useful because it meant your threaded jumps required fewer steps in the pipeline (compared to indexing a jump table), while also not needing any conditional for the threaded branch (e.g. not even checking for a NULL address before entering the loop, to initialize or substitute address placeholders).
The performance benefits of the constructor hack (low double digits, IIRC, maybe single digit, for a contrived test) were greater prior to Haswell (perhaps returning with Spectre mitigations?), but definitely not worth the headache of maintaining such non-portable, GCC-specific code. It did drive home, however, not only the usefulness of computed gotos (which are widely supported, excepting Visual Studio, and provide a far greater performance impact themselves), but the usefulness, in terms of design possibilities, of the ability to resolve computed goto addresses outside the function, which isn't supported anywhere except with that hack, AFAIK.
while (next_fn_to_call != nullptr) {
next_fn_to_call = next_fn_to_call()
}
So each function potentially wants to call a new function once it's done, but you don't want to blow the stack (or maybe use a stack at all) so it returns that function (pointer) rather than calling it. Then you need a little loop to call the return value: that's your trampoline.The article is potentially a bit lower level given it's talking about things down at the CPU level, but I imagine its a vaguely connected idea.