Goal: Load .so/.bundle that has been verified to be signed (or verified against an arbitrary algorithm).
I want to be able to verify a .so/.bundle either using OSX's builtin binary signature tools or some custom algorithm and then load that .so/.bundle with dlopen...
The wrench in this is that there seems to be no programmatic way to check-then-load. One could check the file manually and then load it after.. however there is a window-of-opportunity within which someone could swap out that file for another.
Since filesystem locks are advisory in OSX, they are not so useful for this purpose.