Protected Shared Function Trampolines
Posted: Wed Oct 05, 2005 6:46 pm
I'd been planning (and writing) an "object model" for run-time linking of multiple execution contexts to use a single program, and after some browsing I came upon the attached research paper: "Protected Shared Libraries".
I have to say when reading this, it is a brilliant idea. The caller and callee contexts could be made into seperate protection domains, such that neither can access the other's data segment. Other than that there's a lot of stuff about where things are mapped, whether local copies are made or a single global copy kept... etc.
According to what I read, though, a trampoline function is used to perform the protection switches and jump/call to the actual protected shared function. The entry point to this trampoline is passed to the client code on linking, and this client code calls the function transparently, as though the trampoline didn't exist. I didn't see in the paper (direct me back if I wasn't reading thoroughly enough), but how does the trampoline know exactly which call was made and what protection domain it belongs to (so the switching can be done). You could invalidate the appropriate memory page and have the trampoline search as part of a page-fault handler through the list of protection domains and imported symbols to check for a valid reference, but the paper was claiming the protection switching was as efficient as a system call, and I don't see how an O(O(n)) search, where n is the number of protection domains and O(n) is the number of imported symbols from that domain, could do that.
I also just wanted to share a cool paper.
I have to say when reading this, it is a brilliant idea. The caller and callee contexts could be made into seperate protection domains, such that neither can access the other's data segment. Other than that there's a lot of stuff about where things are mapped, whether local copies are made or a single global copy kept... etc.
According to what I read, though, a trampoline function is used to perform the protection switches and jump/call to the actual protected shared function. The entry point to this trampoline is passed to the client code on linking, and this client code calls the function transparently, as though the trampoline didn't exist. I didn't see in the paper (direct me back if I wasn't reading thoroughly enough), but how does the trampoline know exactly which call was made and what protection domain it belongs to (so the switching can be done). You could invalidate the appropriate memory page and have the trampoline search as part of a page-fault handler through the list of protection domains and imported symbols to check for a valid reference, but the paper was claiming the protection switching was as efficient as a system call, and I don't see how an O(O(n)) search, where n is the number of protection domains and O(n) is the number of imported symbols from that domain, could do that.
I also just wanted to share a cool paper.