bytecodealliance / lucet

Lucet, the Sandboxing WebAssembly Compiler.
Apache License 2.0
4.06k stars 165 forks source link

🎬 Encode the start function in ModuleData rather than the linker #525

Closed acfoltzer closed 4 years ago

acfoltzer commented 4 years ago

This long-overdue refactoring moves the metadata required to get a module's Wasm start function to the lucet-module types, rather than encoding it directly as a pointer-to-a-pointer in the shared object's symbols.

Of particular benefit is the fact that once a DlModule is created, we no longer use the underlying libloading::Library. Before the version bump in this patch, that library had a mutex around calls to dlerror to try preventing races between all threads in the process, which could lead to contention when threads attempted to concurrently use Lucet instances.

acfoltzer commented 4 years ago

We could definitely just use libc to call libdl functions directly, but I would probably want to write wrappers around them that would turn out very very similar to what libloading provides. But eventually just getting rid of it entirely would be :100: