Skip to content

Commit 4b24669

Browse files
[43.0.0] Backport fixes, refactorings, and updates to wasip3 limits (#12769)
* Enable multiple concurrent sync host calls from different threads in the same task (#12735) * Move sync call set to thread state * Add test * Cleanup * Cleanup * Fix caller context on fused component<->component returns (#12737) In #12718 I added a test for more cases but forgot to update the `*.wast` to actually execute the test. Turns out all the cases were failing, and so this commit properly enables the tests and then fixes them. * wasip3: Limit random number generation by default (#12745) This commit extends the random-related fixes of #12652 to WASIp3's implementation of randomness-related interfaces. cc #12674 * Fix lost wakeups with stdin and wasip3 (#12711) I've been running some tests with wasip3 recently and I was running into a situation where a program would read stdin, get some data, and then stdin would be closed. The second read of stdin wouldn't get a wakeup and would get stuck forever despite stdin being closed. I'm not 100% sure what was happening but I'm highly suspect of the `Notify`-based synchronization here as I know historically that's a tricky primitive to work with. This applies a hammer and moves some lock scopes up a bit further to avoid dealing with trickiness and instead ensure everything proceeds in lockstep. * Refactor WASIp2 `wasi:http` implementation (#12748) * Sequester WASIp2 in `wasmtime-wasi-http` to a module This mirrors the `wasmtime-wasi` crate's organization where there's a `p2` module and a `p3` module at the top level. * Refactor WASIp2 `wasi:http` implementation This commit reorganizes and refactors the WASIp2 implementation of `wasi:http` to look more like other `wasmtime-wasi`-style interfaces. Specifically the old `WasiHttpImpl<T>` structure is removed in favor of as `WasiHttpCtxView<'_>` type that is used to implement bindgen-generated `Host` traits. This necessitated reorganizing the methods of the previous `WasiHttpView` trait like so: * The `WasiHttpView` trait is renamed to `WasiHttpHooks` to make space for a new `WasiHttpView` which behaves like `WasiView`, for example. * The `ctx` and `table` methods of `WasiHttpHooks` were removed since they'll be fields in `WasiHttpCtxView`. * Helper methods for WASIp2 were moved to methods on `WasiHttpCtxView` instead of default methods on `WasiHttpHooks`. With these changes in place the WASIp3 organization was also updated slightly as well. Notably WASIp3 now contains a reference to the crate's `WasiHttpCtx` structure (which has field limits for example). WASIp3's previous `WasiHttpCtx` trait is now renamed to `WasiHttpHooks` as well. This means that there are two `WasiHttpHooks` traits right now, one for WASIp2 and one for WASIp3. In the future I would like to unify these two but that will require some more work around the default `send_request`. A final note here is that the `WasiHttpHooks` trait previously, and continues to be, optional for embedders to implement. Default functions are provided as `wasmtime_wasi_http::{p2, p3}::default_hooks`. Additionally there's a `Default for &mut dyn WasiHttpHooks` implementation, too. With all that outlined: the motivation for this change is to bring the WASIp2 and WASIp3 implementations of `wasi:http` closer together. This is inspired by refactorings I was doing for #12674 to apply the same header limitations for WASIp3 as is done for WASIp2. Prior to this change there were a number of differences such as WASIp3 not having `crate::WasiHttpCtx` around, WASIp2 having a different organization of structures/borrows, etc. The goal is to bring the two implementations closer in line with each other to make refactoring across them more consistent and easier. * Make `WasiHttp` in WASIp2 public * Fix some conditional build * Fix some doctests * Fix configured build * Fixup documentation * Refactor `wasi:http` headers' host representation (#12754) * Refactor `wasi:http` headers' host representation This commit is a follow-on/extension of #12748 and extends the changes made for WASIp2 headers in #12652 to the WASIp3 implementation as well. This is done through a number of refactorings to make the WASIp2 and WASIp3 implementations more similar in terms of how they represent headers. Changes here are: * `FieldMap` now has its own dedicated module at the crate root instead of intermingling with other WASIp2 types. * `FieldMap` is now internally-`Arc`'d and is cheaply clonable. `FieldMap` itself now tracks whether it's mutable or immutable (WASI semantics) and doesn't need different wrappers in WASIp2 and WASIp3. * Creation of an immutable `FieldMap` can be done without needing a size limit. Flagging a `FieldMap` as mutable, however, requires a size limit. * `FieldMap::set` was added to be a bit more efficient w.r.t. clones. * `FieldMapError` is a new error type that covers all of the possible error modes of operating with a `FieldMap`. Conversions from this to WASIp{2,3} `header-error` types are now implemented as well. * WASIp2 now flags `header-error` as a trappable-error-type, allowing the use of `?` in implementing header functions (like WASIp3). * Much of WASIp2's header implementation was refactored with `?`, moving methods around, shuffling where headers are made vs `FieldMap`, some minor idioms, etc. * WASIp3 no longer uses `MaybeMutable` for headers and instead uses `FieldMap` directly. cc #12674 * Clippy warnings * Set current thread before lowering stream/future reads (#12736) * Set thread before lowering stream/future reads * Restore thread * Make CurrentThread pub(crate) * fmt * Remove with_thread * Remove DS_Store * Add test * Check return values * Move string data * Update some github actions versions (#12762) CI is warning us about these, so try updating. * Enable limiting wasip3 resource limits (#12761) * Enable limiting wasip3 resource limits This commit adds a new `Store::concurrent_resource_table` method which enables getting a handle to the underlying `ResourceTable` used by the concurrent implementation of component-model-async. This can in turn be used to set the max capacity on the table and limit the guest usage of the table. Closes #11552 * Adjust features * Fix imports * Consume hostcall fuel when buffering stream data in the host (#12767) For guest-to-guest communication stream reads/writes rendezvousing together will currently copy data through `Val`. This is expected to become more optimized in the future, but for now this needs to consume the concept of "hostcall fuel" introduced in #12652 to ensure that the guest can't exhaust memory in the host. This additionally tweaks some hostcall fuel calculations to more accurately reflect the size of values on the host, notably by using `size_of::<Thing>()` on the host rather than the size in the guest. Closes #12674 --------- Co-authored-by: Sy Brand <sy.brand@fastly.com>
1 parent dc7a322 commit 4b24669

54 files changed

Lines changed: 3038 additions & 2054 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/install-cargo-vet/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ inputs:
1010
runs:
1111
using: composite
1212
steps:
13-
- uses: actions/cache@v4
13+
- uses: actions/cache@v5
1414
with:
1515
path: ${{ runner.tool_cache }}/cargo-vet
1616
key: cargo-vet-bin-${{ inputs.version }}

.github/workflows/cargo-audit.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ jobs:
88
env:
99
CARGO_AUDIT_VERSION: 0.22.1
1010
steps:
11-
- uses: actions/checkout@v4
11+
- uses: actions/checkout@v6
1212
with:
1313
submodules: true
14-
- uses: actions/cache@v4
14+
- uses: actions/cache@v5
1515
with:
1616
path: ${{ runner.tool_cache }}/cargo-audit
1717
key: cargo-audit-${{ env.CARGO_AUDIT_VERSION }}

.github/workflows/ci-cron-trigger.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
name: Trigger release branch CI
3333
runs-on: ubuntu-latest
3434
steps:
35-
- uses: actions/checkout@v4
35+
- uses: actions/checkout@v6
3636
with:
3737
submodules: true
3838
fetch-depth: 0

.github/workflows/main.yml

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
name: Rustfmt
4141
runs-on: ubuntu-latest
4242
steps:
43-
- uses: actions/checkout@v4
43+
- uses: actions/checkout@v6
4444
with:
4545
submodules: true
4646
- uses: ./.github/actions/install-rust
@@ -53,7 +53,7 @@ jobs:
5353
name: Check JS
5454
runs-on: ubuntu-latest
5555
steps:
56-
- uses: actions/checkout@v4
56+
- uses: actions/checkout@v6
5757
- run: npm install
5858
working-directory: ./crates/explorer
5959
- run: npm run lint
@@ -68,7 +68,7 @@ jobs:
6868
name: Clang format
6969
runs-on: ubuntu-24.04
7070
steps:
71-
- uses: actions/checkout@v4
71+
- uses: actions/checkout@v6
7272
with:
7373
submodules: true
7474
- run: |
@@ -89,7 +89,7 @@ jobs:
8989
if: needs.determine.outputs.audit
9090
runs-on: ubuntu-latest
9191
steps:
92-
- uses: actions/checkout@v4
92+
- uses: actions/checkout@v6
9393
with:
9494
submodules: true
9595
- uses: ./.github/actions/install-rust
@@ -118,7 +118,7 @@ jobs:
118118
outputs:
119119
outcome: ${{ steps.vet.outcome }}
120120
steps:
121-
- uses: actions/checkout@v4
121+
- uses: actions/checkout@v6
122122
with:
123123
submodules: true
124124
- uses: ./.github/actions/install-rust
@@ -179,7 +179,7 @@ jobs:
179179
run-dwarf: ${{ steps.calculate.outputs.run-dwarf }}
180180
platform-checks: ${{ steps.calculate.outputs.platform-checks }}
181181
steps:
182-
- uses: actions/checkout@v4
182+
- uses: actions/checkout@v6
183183
- id: calculate
184184
env:
185185
GH_TOKEN: ${{ github.token }}
@@ -264,7 +264,7 @@ jobs:
264264
RUSTDOCFLAGS: -Dwarnings --cfg docsrs
265265
OPENVINO_SKIP_LINKING: 1
266266
steps:
267-
- uses: actions/checkout@v4
267+
- uses: actions/checkout@v6
268268
with:
269269
submodules: true
270270
- uses: ./.github/actions/install-rust
@@ -281,7 +281,7 @@ jobs:
281281
- run: cmake --build target/c-api --target doc
282282

283283
# install mdbook, build the docs, and test the docs
284-
- uses: actions/cache@v4
284+
- uses: actions/cache@v5
285285
with:
286286
path: ${{ runner.tool_cache }}/mdbook
287287
key: cargo-mdbook-${{ env.MDBOOK_VERSION }}-langtabs-${{ env.MDBOOK_LANGTABS_VERSION }}
@@ -313,7 +313,7 @@ jobs:
313313
mv crates/c-api/html gh-pages/c-api
314314
mv target/doc gh-pages/api
315315
tar czf gh-pages.tar.gz gh-pages
316-
- uses: actions/upload-artifact@v4
316+
- uses: actions/upload-artifact@v6
317317
with:
318318
name: gh-pages
319319
path: gh-pages.tar.gz
@@ -413,6 +413,7 @@ jobs:
413413
- name: wasmtime-wasi-http
414414
checks: |
415415
-p wasmtime-wasi-http --no-default-features
416+
-p wasmtime-wasi-http --no-default-features --features p2
416417
-p wasmtime-wasi-http --no-default-features --features p3
417418
-p wasmtime-wasi-http --no-default-features --features p3 --all-targets
418419
@@ -434,7 +435,7 @@ jobs:
434435
-p wasmtime-wizer --no-default-features --all-features
435436
runs-on: ubuntu-latest
436437
steps:
437-
- uses: actions/checkout@v4
438+
- uses: actions/checkout@v6
438439
with:
439440
submodules: true
440441
- uses: ./.github/actions/install-rust
@@ -453,7 +454,7 @@ jobs:
453454
needs: determine
454455
if: needs.determine.outputs.run-full
455456
steps:
456-
- uses: actions/checkout@v4
457+
- uses: actions/checkout@v6
457458
with:
458459
submodules: true
459460
- uses: ./.github/actions/install-rust
@@ -467,7 +468,7 @@ jobs:
467468
env:
468469
CARGO_NDK_VERSION: 2.12.2
469470
steps:
470-
- uses: actions/checkout@v4
471+
- uses: actions/checkout@v6
471472
with:
472473
submodules: true
473474
- uses: ./.github/actions/install-rust
@@ -484,7 +485,7 @@ jobs:
484485
env:
485486
CARGO_NDK_VERSION: 2.12.2
486487
steps:
487-
- uses: actions/checkout@v4
488+
- uses: actions/checkout@v6
488489
with:
489490
submodules: true
490491
- uses: ./.github/actions/install-rust
@@ -588,7 +589,7 @@ jobs:
588589
test: cargo check -p wasmtime --no-default-features --features runtime,gc,component-model,async
589590
env: ${{ matrix.env || fromJSON('{}') }}
590591
steps:
591-
- uses: actions/checkout@v4
592+
- uses: actions/checkout@v6
592593
with:
593594
submodules: true
594595
- uses: ./.github/actions/install-rust
@@ -612,7 +613,7 @@ jobs:
612613
name: Nightly tests
613614
runs-on: ubuntu-latest
614615
steps:
615-
- uses: actions/checkout@v4
616+
- uses: actions/checkout@v6
616617
with:
617618
submodules: true
618619
- uses: ./.github/actions/install-rust
@@ -693,7 +694,7 @@ jobs:
693694
flags: -DCMAKE_C_FLAGS=-fsanitize=address -DCMAKE_CXX_FLAGS=-fsanitize=address -DBUILD_SHARED_LIBS=ON -DBUILD_TESTS=ON
694695
name: Linux (ASAN)
695696
steps:
696-
- uses: actions/checkout@v4
697+
- uses: actions/checkout@v6
697698
with:
698699
submodules: true
699700
- uses: ./.github/actions/install-rust
@@ -730,7 +731,7 @@ jobs:
730731
fail-fast: ${{ github.event_name != 'pull_request' }}
731732
matrix: ${{ fromJson(needs.determine.outputs.test-matrix) }}
732733
steps:
733-
- uses: actions/checkout@v4
734+
- uses: actions/checkout@v6
734735
with:
735736
submodules: true
736737
- uses: ./.github/actions/install-rust
@@ -768,13 +769,13 @@ jobs:
768769
echo CARGO_TARGET_${upcase}_LINKER=${{ matrix.gcc }} >> $GITHUB_ENV
769770
if: matrix.gcc != ''
770771

771-
- uses: actions/cache@v4
772+
- uses: actions/cache@v5
772773
with:
773774
path: ${{ runner.tool_cache }}/qemu
774775
key: qemu-${{ matrix.target }}-${{ env.QEMU_BUILD_VERSION }}-patchcpuinfo
775776
if: matrix.qemu != ''
776777

777-
- uses: actions/cache@v4
778+
- uses: actions/cache@v5
778779
with:
779780
path: ${{ runner.tool_cache }}/sde
780781
key: sde-${{ env.SDE_BUILD_VERSION }}
@@ -917,7 +918,7 @@ jobs:
917918
needs: determine
918919
if: needs.determine.outputs.run-full
919920
steps:
920-
- uses: actions/checkout@v4
921+
- uses: actions/checkout@v6
921922
with:
922923
submodules: true
923924
- uses: ./.github/actions/install-rust
@@ -959,7 +960,7 @@ jobs:
959960
matrix:
960961
os: [ubuntu-latest, windows-latest, macos-latest]
961962
steps:
962-
- uses: actions/checkout@v4
963+
- uses: actions/checkout@v6
963964
with:
964965
submodules: true
965966
- uses: ./.github/actions/install-rust
@@ -987,7 +988,7 @@ jobs:
987988
name: Test wasmtime-fuzzing
988989
runs-on: 'ubuntu-latest'
989990
steps:
990-
- uses: actions/checkout@v4
991+
- uses: actions/checkout@v6
991992
with:
992993
submodules: true
993994
- uses: ./.github/actions/install-rust
@@ -1003,7 +1004,7 @@ jobs:
10031004
name: Test DWARF debugging
10041005
runs-on: ubuntu-24.04
10051006
steps:
1006-
- uses: actions/checkout@v4
1007+
- uses: actions/checkout@v6
10071008
with:
10081009
submodules: true
10091010
- uses: ./.github/actions/install-rust
@@ -1033,7 +1034,7 @@ jobs:
10331034
deployments: write
10341035
contents: write
10351036
steps:
1036-
- uses: actions/checkout@v4
1037+
- uses: actions/checkout@v6
10371038
with:
10381039
submodules: true
10391040
- uses: ./.github/actions/install-rust
@@ -1050,7 +1051,7 @@ jobs:
10501051
env:
10511052
VERSION: ${{ github.sha }}
10521053

1053-
- uses: actions/upload-artifact@v4
1054+
- uses: actions/upload-artifact@v6
10541055
with:
10551056
name: bins-wasi-preview1-component-adapter
10561057
path: target/wasm32-unknown-unknown/release/wasi_snapshot_preview1.*.wasm
@@ -1060,7 +1061,7 @@ jobs:
10601061
needs: build-preview1-component-adapter
10611062
runs-on: ubuntu-latest
10621063
steps:
1063-
- uses: actions/checkout@v4
1064+
- uses: actions/checkout@v6
10641065
with:
10651066
submodules: true
10661067
- uses: ./.github/actions/install-rust
@@ -1075,7 +1076,7 @@ jobs:
10751076
if: needs.determine.outputs.run-full
10761077
runs-on: ubuntu-latest
10771078
steps:
1078-
- uses: actions/checkout@v4
1079+
- uses: actions/checkout@v6
10791080
with:
10801081
submodules: true
10811082
- uses: ./.github/actions/install-rust
@@ -1102,7 +1103,7 @@ jobs:
11021103
MIN_PLATFORM_TEST_DISABLE_WASI: 1
11031104

11041105
# Add the `wasmtime-platform.h` file as a release artifact
1105-
- uses: actions/upload-artifact@v4
1106+
- uses: actions/upload-artifact@v6
11061107
with:
11071108
name: wasmtime-platform-header
11081109
path: examples/min-platform/embedding/wasmtime-platform.h
@@ -1113,7 +1114,7 @@ jobs:
11131114
name: Run benchmarks
11141115
runs-on: ubuntu-latest
11151116
steps:
1116-
- uses: actions/checkout@v4
1117+
- uses: actions/checkout@v6
11171118
with:
11181119
submodules: true
11191120
- uses: ./.github/actions/install-rust
@@ -1127,7 +1128,7 @@ jobs:
11271128
name: Meta deterministic check
11281129
runs-on: ubuntu-latest
11291130
steps:
1130-
- uses: actions/checkout@v4
1131+
- uses: actions/checkout@v6
11311132
with:
11321133
submodules: true
11331134
- uses: ./.github/actions/install-rust
@@ -1139,7 +1140,7 @@ jobs:
11391140
if: github.repository == 'bytecodealliance/wasmtime' && needs.determine.outputs.run-full
11401141
runs-on: ubuntu-latest
11411142
steps:
1142-
- uses: actions/checkout@v4
1143+
- uses: actions/checkout@v6
11431144
with:
11441145
submodules: true
11451146
- uses: ./.github/actions/install-rust
@@ -1186,14 +1187,14 @@ jobs:
11861187
CARGO_NEXTEST_VERSION: 0.9.88
11871188
MIRIFLAGS: -Zmiri-permissive-provenance
11881189
steps:
1189-
- uses: actions/checkout@v4
1190+
- uses: actions/checkout@v6
11901191
with:
11911192
submodules: true
11921193
- uses: ./.github/actions/install-rust
11931194
with:
11941195
toolchain: wasmtime-ci-pinned-nightly
11951196
- run: rustup component add rust-src miri
1196-
- uses: actions/cache@v4
1197+
- uses: actions/cache@v5
11971198
with:
11981199
path: ${{ runner.tool_cache }}/cargo-nextest
11991200
key: cargo-nextest-bin-${{ env.CARGO_NEXTEST_VERSION }}
@@ -1220,7 +1221,7 @@ jobs:
12201221
matrix: ${{ fromJson(needs.determine.outputs.build-matrix) }}
12211222
env: ${{ matrix.env || fromJSON('{}') }}
12221223
steps:
1223-
- uses: actions/checkout@v4
1224+
- uses: actions/checkout@v6
12241225
with:
12251226
submodules: true
12261227

@@ -1248,7 +1249,7 @@ jobs:
12481249
# unconditionally to this workflow's files so we have a copy of them.
12491250
- run: ./ci/build-tarballs.sh "${{ matrix.build }}" "${{ matrix.target }}"
12501251

1251-
- uses: actions/upload-artifact@v4
1252+
- uses: actions/upload-artifact@v6
12521253
with:
12531254
name: bins-${{ matrix.build }}
12541255
path: dist
@@ -1334,7 +1335,7 @@ jobs:
13341335
&& startsWith(github.ref, 'refs/heads/release-')
13351336
&& github.repository == 'bytecodealliance/wasmtime'
13361337
steps:
1337-
- uses: actions/checkout@v4
1338+
- uses: actions/checkout@v6
13381339
with:
13391340
submodules: true
13401341
fetch-depth: 0

.github/workflows/performance.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
cargo build --release
7575
7676
- name: Checkout patch from bytecodealliance/wasmtime (pushed and triggering on this perf repo)
77-
uses: actions/checkout@v4
77+
uses: actions/checkout@v6
7878
with:
7979
submodules: true
8080
path: wasmtime_commit
@@ -89,7 +89,7 @@ jobs:
8989
cp target/release/libwasmtime_bench_api.so /tmp/wasmtime_commit.so
9090
9191
- name: Checkout main from bytecodealliance/wasmtime
92-
uses: actions/checkout@v4
92+
uses: actions/checkout@v6
9393
with:
9494
ref: 'main'
9595
repository: 'bytecodealliance/wasmtime'

.github/workflows/publish-artifacts.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
if: github.repository == 'bytecodealliance/wasmtime'
1717
steps:
18-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@v6
1919
- uses: ./.github/actions/fetch-run-id
2020
- run: |
2121
gh run download ${COMMIT_RUN_ID}

.github/workflows/publish-to-cratesio.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919
environment: publish
2020
steps:
21-
- uses: actions/checkout@v4
21+
- uses: actions/checkout@v6
2222
with:
2323
submodules: true
2424
- run: rustup update stable && rustup default stable

0 commit comments

Comments
 (0)