Instantiating a wasm library duplicates a file descriptor for /dev/null 3 times to be used as input, output and error streams for the wasm sandboxed code. When a lot of sandboxes are created and destroyed, a lot of descriptors are duplicated and closed. While this should be fine, POSIX does not seem to happy with the opening and closing of many file descriptors --- this could perhaps be some strange interaction with Firefox's seccomp filters and cross-process file descriptor handling as it is difficult to repro this outside of firefox.
However, the simpler fix here was to just eliminate the duplication of /dev/null and return an error when input, output or error streams are accessed by wasm sandboxed code. This means calls to printf will fail, but no code I know off actually checks the int error code returned by printf and this change is certainly compatible with existing sandboxed components.
Differential Revision: https://phabricator.services.mozilla.com/D99160
Revendor Cranelift to 3b01b4b850bafb981a04383198c0b50d041dc5ef
from https://github.com/mozilla-spidermonkey/wasmtime branch firefox85.
The (only) purpose is to pull in this:
commit 31bac3eafbfda8f1ffb504cdeb75505d48537336
Merge: 93c199363 34d9931ed
Author: Nick Fitzgerald <fitzgen@gmail.com>
Date: Wed Nov 25 13:09:05 2020 -0800
Merge pull request #2450 from bytecodealliance/cfallin/fix-wasm-reachable
Fix Wasm translator bug: end of toplevel frame is branched-to only for fallthrough returns.
Differential Revision: https://phabricator.services.mozilla.com/D99204
On a very parallel debug build, I see a long time just waiting for
bindgen / style compilation / geckoservo.
Turns out that a bunch of this is just proc macros / build scripts.
Optimizing it saves between 10 and 17 seconds of my debug build. We
might want to consider running bindgen much like cbindgen rather than
rebuilding it all the time, which should help a lot more, but my guess
is that this should still help with the pretty hot custom derives that
the style crate runs.
This needs rust 1.41, so the requirement for tools/crashreporter needs
to be bumped as a consequence. To make things simpler, it was bumped
to 1.47 while we're at it.
Differential Revision: https://phabricator.services.mozilla.com/D98366
This updates the relevant CL and wasmparser versions:
* wasmparser 0.67
* Cranelift/wasmtime to dcc52ba3f69d3de7cdbd787b936825d9c61e3c27
on branch firefox85 at https://github.com/mozilla-spidermonkey/wasmtime
It also includes the following changes needed to track CL/wasmparser ABI changes:
* test suite: track improvements to validation-failure expected outputs.
* wasm/cranelift/src/bindings/mod.rs, ModuleEnvironment::signature: track
CL-side changes towards module-linking support.
* wasm/cranelift/src/wasm2clif.rs: FuncEnvironment::translate_memory_copy:
track CL-side changes for supporting multiple memories.
Differential Revision: https://phabricator.services.mozilla.com/D97587
This PR updates wgpu to the latest and changes the way we pass object descriptors to the GPU process.
Instead of trying to convert them between DOM-CPP-IPDL-FFI-Rust, we now do DOM-FFI-Rust
and serialize them by serde into ipc::ByteBuf objects.
Differential Revision: https://phabricator.services.mozilla.com/D94908
This PR updates wgpu to the latest and changes the way we pass object descriptors to the GPU process.
Instead of trying to convert them between DOM-CPP-IPDL-FFI-Rust, we now do DOM-FFI-Rust
and serialize them by serde into ipc::ByteBuf objects.
Differential Revision: https://phabricator.services.mozilla.com/D94908
This patch pulls in an updated Cranelift with a new validation strategy,
introduced by bytecodealliance/wasmtime#2059. This new design validates
the Wasm module as it parses the function bodies. A subsequent patch
will adapt Baldrdash to work with this.
Differential Revision: https://phabricator.services.mozilla.com/D92503
This patch pulls in an updated Cranelift with a new validation strategy,
introduced by bytecodealliance/wasmtime#2059. This new design validates
the Wasm module as it parses the function bodies. A subsequent patch
will adapt Baldrdash to work with this.
Differential Revision: https://phabricator.services.mozilla.com/D92503
This patch pulls in an updated Cranelift with a new validation strategy,
introduced by bytecodealliance/wasmtime#2059. This new design validates
the Wasm module as it parses the function bodies. A subsequent patch
will adapt Baldrdash to work with this.
Differential Revision: https://phabricator.services.mozilla.com/D92503
This patch pulls in the latest version of Cranelift, which includes
necessary updates to support some recent work on the Wasm backend (e.g.,
support for the new ABI in PR #2223).
Differential Revision: https://phabricator.services.mozilla.com/D92000
This patch pulls in the latest version of Cranelift, which includes
necessary updates to support some recent work on the Wasm backend (e.g.,
support for the new ABI in PR #2223).
Differential Revision: https://phabricator.services.mozilla.com/D92000
This Cranelift update to revision 379aed8092cd1241ec7839e77d05557b1dceb234
includes its PRs #2197 and #2194, which fix two Wasm translation bugs, as well a
other miscellaneous updates and fixes.
Fixes both Bug 1664453 and Bug 1663861.
Differential Revision: https://phabricator.services.mozilla.com/D90306
This PR pulls in the latest version of Cranelift, which pulls in
regalloc.rs v0.0.30 and consequently includes some improvements in
memory allocation rate during compilation. No behavior changes expected.
Differential Revision: https://phabricator.services.mozilla.com/D87479
This patch vendors in the latest version of Cranelift, rev
026fb8d388964c7c1bace7019c4fe0d63c584560. This includes a fix for bug
1655848 (from GitHub PR #2081), as well as several other miscellaneous
changes.
Differential Revision: https://phabricator.services.mozilla.com/D85773
We need this bump for a couple of reasons:
1. It enables floating the libc crate version, which makes keeping up-to-date
with upstream changes easier.
2. It enables floating the getrandom crate version, which enables updating
getrandom to a version with less buggy behavior around the Linux
`getrandom` syscall on some architectures.
We also take this opportunity to sync up our vendored lucet with the lucet
that we use to build things in taskcluster.
Differential Revision: https://phabricator.services.mozilla.com/D85408
This lays out a Rust crate and statically links it into
`windows-default-agent.exe`. It declares a single-method API (which
will be invoked in the next commit).
Strings cross the C/C++ <-> Rust FFI boundary as null-terminated
UTF-8. (This will matter more if and when we use ETag and
If-None-Match to get 304 results.)
Errors are reported as Windows result codes, with the "customer" bit
set to encode certain classes of failure.
The bulk of the work is in implementing a
[Viaduct](https://github.com/mozilla/application-services/tree/master/components/viaduct)
backend built on top of `wininet.dll`. The motivation is that if and
when this Remote Settings Rust client grows features (say,
Content-Signature: verification), then by using Viaduct there is a
smooth path to consume the client inside Firefox itself, because
Viaduct already has a backend on top of Necko. That makes this
abstraction relatively low friction: it exists, is in-tree already,
and has a path to use in Gecko proper.
It is expected that the layer above this will handle "gracefully
failing", either open or closed; and will mirror Remote Settings
configuration to the registry so that testers can use prod/stage/dev
easily.
For follow-up:
- Configure logging to use the Windows event logger. See [Bug
1648617](https://bugzilla.mozilla.org/show_bug.cgi?id=1648617).
- Consider propagating errors into the Telemetry we send.
Differential Revision: https://phabricator.services.mozilla.com/D78579
This patch pulls in revision 1b3b2dbfd00492161032760992a8699d19b640ca of
Cranelift. This includes PR bytecodealliance/wasmtime#2042, which fixes
bug 1653502 by properly masking the shift amount in a shift incorporated
into an aarch64 arithmetic instruction.
This patch also includes various other miscellaneous Cranelift
improvements that have been merged since the last version-bump,
including some aarch64 codegen improvements.
Differential Revision: https://phabricator.services.mozilla.com/D84101
This patch updates the vendored version of Cranelift, pulling in the
reference-types support recently merged in Cranelift's PR
bytecodealliance/wasmtime#1852. Usage of this update to support reftypes
in SpiderMonkey on aarch64 is added in the subsequent commit.
Differential Revision: https://phabricator.services.mozilla.com/D83582
This patch pulls in Cranelift revision
47a218f908e6bdeb7a0fb65ed74e58a0b608080d, which incorporates several
relevant changes:
- It includes the Spectre mitigation for explicit heap bounds checks
merged in PR bytecodealliance/wasmtime#1930, resolving Bug 1648885.
- It includes the fix for an out-of-bounds subtraction on large shift
amounts merged in PR bytecodealliance/wasmtime#1954, resolving Bug
1649432.
We need to temporarily disable the `wasm/limits.js` jit-test on
Cranelift configurations because it now needs shared memory to work, and
the Cranelift backend does not support this yet. Given that this should
be ready in the next month at most (requires atomics support on AArch64,
which is currently being examined), it seems simpler to temporarily
disable the test on aarch64 than to try to disentangle the bits that
depend on shared memories explicitly.
This patch also edits the `regexp/bug1445907.js` jit-test to run only if
Wasm debugging is supported. This is needed for the test not to fail
with `--wasm-compiler=cranelift` (which disables Baseline, the only Wasm
compiler that supports debugging).
Differential Revision: https://phabricator.services.mozilla.com/D81936