One small step towards removing dangerous accessors...
Maksim, please take a first look. I'll then add the needed owners in a second step.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
lgtm % nits, thanks!
weak_native_module = module_object->native_module().as_shared_ptr();nit: This can be derived from `native_module` now.
auto native_module = module_object->native_module();nit: For clarity, seeing the full type instead of "auto" would help a lot.
Ditto in other places.
const WasmModule* module_a = instance_a->trusted_data(v8_isolate)->module();nit: `instance_data_a->`
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Thanks for the review!
+Jakob for src/debug and src/execution.
weak_native_module = module_object->native_module().as_shared_ptr();nit: This can be derived from `native_module` now.
Done
nit: For clarity, seeing the full type instead of "auto" would help a lot.
Ditto in other places.
Done
const WasmModule* module_a = instance_a->trusted_data(v8_isolate)->module();Clemens Backesnit: `instance_data_a->`
Done
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[wasm] Remove insecure WasmInstanceObject::module()
This CL hardens the Wasm subsystem by removing the insecure module()
accessor from WasmInstanceObject and adding V8_LIFETIME_BOUND
annotations to NativeModule and WasmCode.
The link from an untrusted WasmInstanceObject to its WasmModule could be
corrupted by an attacker. If this link is traversed and used to obtain a
raw pointer to the WasmModule or its components (like the NativeModule),
a subsequent GC could collect the module, leading to Use-After-Free
(UAF) vulnerabilities.
To mitigate this, we:
1. Remove WasmInstanceObject::module(). All call sites now use the
trusted path via WasmTrustedInstanceData.
2. Add V8_LIFETIME_BOUND to NativeModule and WasmCode methods that
return internal pointers or references. This allows the compiler to
statically catch cases where these pointers outlive their owning
objects.
3. Update debug proxies and runtime functions to safely manage the
lifetimes of obtained module pointers, often by keeping the
Managed<NativeModule>::Ptr alive in a local variable.
In locations where metadata access still originates from an untrusted
instance object, a TODO(clemensb) has been added to mark these for
future hardening. This was intentionally not done for debugging-only
code and for test-only code which is less security-critical.
R=em...@google.com
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |