[tor-bugs] #21549 [Applications/Tor Browser]: Investigate wasm for linkability/fingerprintability/disk avoidance issues
Tor Bug Tracker & Wiki
blackhole at torproject.org
Fri Oct 11 14:31:30 UTC 2019
#21549: Investigate wasm for linkability/fingerprintability/disk avoidance issues
-------------------------------------------------+-------------------------
Reporter: gk | Owner: tbb-
| team
Type: task | Status: new
Priority: Very High | Milestone:
Component: Applications/Tor Browser | Version:
Severity: Normal | Resolution:
Keywords: ff68-esr, tbb-9.0, | Actual Points:
TorBrowserTeam201910 |
Parent ID: | Points: 1
Reviewer: | Sponsor:
| Sponsor44-can
-------------------------------------------------+-------------------------
Comment (by sysrqb):
The WebAssembly API [https://developer.mozilla.org/en-US/docs/WebAssembly
consists] of:
- The [https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly WebAssembly]
Object:
- [https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/compile
WebAssembly.compile()]
- [https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/compileStreaming
WebAssembly.compileStreaming()]
- [https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiate
WebAssembly.instantiate()]
- [https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiateStreaming
WebAssembly.instantiateStreaming()]
- [https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/validate
WebAssembly.validate()]
- The [https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Global
WebAssembly.Global] Object:
- The [https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Module
WebAssembly.Module] Object:
- The [https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance
WebAssembly.Instance] Object:
- The [https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory
WebAssembly.Memory] Object:
- [https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory/buffer
WebAssembly.Memory().buffer()]
- The [https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Table
WebAssembly.Table] Object:
- The [https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/CompileError
WebAssembly.CompileError] Object:
- The [https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/LinkError
WebAssembly.LinkError] Object:
- The [https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/RuntimeError
WebAssembly.RuntimeError] Object:
These are [https://searchfox.org/mozilla-
esr68/source/js/src/wasm/WasmJS.cpp#3670 exported] and implemented:
[https://searchfox.org/mozilla-esr68/source/js/src/wasm/WasmJS.cpp#2997
WebAssembly.compile()]
[https://searchfox.org/mozilla-esr68/source/js/src/wasm/WasmJS.cpp#3618
WebAssembly.compileStreaming()]
[https://searchfox.org/mozilla-esr68/source/js/src/wasm/WasmJS.cpp#3046
WebAssembly.instantiate()]
[https://searchfox.org/mozilla-esr68/source/js/src/wasm/WasmJS.cpp#3641
WebAssembly.instantiateStreaming()]
[https://searchfox.org/mozilla-esr68/source/js/src/wasm/WasmJS.cpp#3091
WebAssembly.validate()]
[https://searchfox.org/mozilla-esr68/source/js/src/wasm/WasmJS.cpp#2342
WebAssembly.Global]
[https://searchfox.org/mozilla-esr68/source/js/src/wasm/WasmJS.cpp#1587
WebAssembly.Memory]
[https://searchfox.org/mozilla-esr68/source/js/src/wasm/WasmJS.cpp#657
WebAssembly.Module]
[https://searchfox.org/mozilla-esr68/source/js/src/wasm/WasmJS.cpp#1169
WebAssembly.Instance]
[https://searchfox.org/mozilla-esr68/source/js/src/wasm/WasmJS.cpp#1926
WebAssembly.Table]
- `WebAssembly.compile` is for ahead-of-time compiling a WASM module. It
takes in a buffer of WASM and returns a Promise of a `WebAssembly.Module`.
- `WebAssembly.compileStreaming` is similar to `compile()` except it takes
in a Response object or Promise for a wasm module (compared with a buffer
containing the module).
- `WebAssembly.instantiate` has two prototypes.
- The first takes in a buffer of WASM and returns a Promise of a tuple:
(`WebAssembly.Module`, `WebAssembly.Instance`). The `Module` is the
compiled WASM, and the `Instance` is an instantiation of that `Module`.
- The second takes in an existing `WebAssembly.Module` (already compiled
WASM) and returns an `Instance`.
- `WebAssembly.instantiateStreaming` takes in a a Response object or
Promise (like `compileStreaming`) and returns a Promise of a tuple:
(`WebAssembly.Module`, `WebAssembly.Instance`) like `instantiate()`.
- `WebAssembly.validate()` takes in a buffer of WASM binary code and
returns a boolean true if the buffer contained valid wasm, and false
otherwise.
- `WebAssembly.Global` is an object containing a WASM "global" variable.
Multiple `Global` instances may be passed into
`WebAssembly.instantiate()`, but these globals are only accessible by WASM
if they are explicitly "imported" by the WASM Module.
- `WebAssembly.Instance` is an instance of a `Module` initialized with
`Global` and/or `Memory` instances.
- `WebAssembly.Memory().buffer` is an ArrayBuffer representing the "heap"
memory available in the WASM module. This is readable and writable by both
JavaScript and WASM. From WASM, pointers are represented by an
[https://emscripten.org/docs/porting/emscripten-runtime-environment.html
#emscripten-memory-representation index] of the Memory ArrayBuffer.
- `WebAssembly.Table` is an "array-like" structure storing function-
references. In the future, Tables may store more than only function-
references. Tables allow calling arbitrary functions from WASM (after the
WASM module assigns a function-reference at an index in the table). It
seems like this provides a level of abstraction compared with exporting a
function from WASM into JavaScript, because function-references can be
added/deleted/modified in the Table at run-time.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/21549#comment:31>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list