MCPcopy Create free account
hub / github.com/PLSysSec/wave / setup

Function setup

waverunner/src/waverunner.rs:32–60  ·  view source on GitHub ↗

Setup has 3 steps 1. load the AOT-compiled Wasm module via DlOpen 2. MMap and mprotect the linear memory 3. Setup signals (maybe?) It then returns a wave_runtime object with all these things set up

(config: &WaveConfig)

Source from the content-addressed store, hash-verified

30// 3. Setup signals (maybe?)
31// It then returns a wave_runtime object with all these things set up
32fn setup(config: &WaveConfig) -> WaveSandbox {
33 // 1. Load AOT-compiled Wasm module
34 let module: Container<Wasm2cBinary> = unsafe {
35 Container::load(config.module_path.as_str()) // wrapper around dlopen
36 }
37 .unwrap();
38
39 // 2. MMap and mprotect the linear memory
40 let linmem = wave_alloc_linmem() as *mut u8;
41
42 // 3. Setup signals
43 wave_setup_signals();
44
45 let vmctx = create_ctx(
46 linmem,
47 &config.homedir,
48 config.args.clone(),
49 config.argc,
50 config.env.clone(),
51 config.envc,
52 config.netlist,
53 );
54
55 WaveSandbox {
56 module,
57 vmctx,
58 linmem,
59 }
60}
61
62// The execute stage simply consists of calling the __start function
63// returns the result code of executing the sandbox

Callers 1

runFunction · 0.85

Calls 3

wave_alloc_linmemFunction · 0.85
wave_setup_signalsFunction · 0.85
create_ctxFunction · 0.85

Tested by

no test coverage detected