Commit fc78952
[48.0.0] Backport some changes from
* Observe all stores we replace in `LastStores`; keep track of who observed a store (#14080)
Fixes #14053
* update `WasiCtxBuilder::allow_{tcp,udp}` docs (#14089)
PR #13936 disabled these settings by default but did not update the docs to
match.
* mpk: restore protection keys after mmap'ing memory images (#14076)
* mpk: restore protection keys after mmap'ing memory images
A fresh `mmap` associates the pages it replaces with the default
protection key 0, and key 0 is accessible from every stripe (host code
needs it). `MemoryImageSlot` maps over pkey-colored pool slots in three
places, so any module with a `(data ...)` segment silently lost its
key. Because MPK striping deliberately shrinks the guard regions between
slots, a neighboring instance could then read and write that memory for
real. Note that `mprotect` preserves the key, so only `mmap` sites are
affected.
Fix this by re-applying the key with `pkey_mprotect` after each `mmap`:
add `ProtectionKey::reprotect`, give `MemoryImageSlot` the key its
stripe was colored with, and call the new `reapply_pkey` helper after
`map_at`, `remap_as_zeros_at`, and `erase_existing_mapping`.
Tables, stacks, and GC heaps are never pkey-colored, and decommit uses
`madvise(MADV_DONTNEED)` which preserves VMA flags, so `MemoryImageSlot`
was the only exposure.
Cost: one extra syscall per `mmap`, and `instantiate` only `mmap`s when
a slot is handed a different image than it already holds. Measured over
1000 instantiations, a module repeatedly instantiated into its affine
slot adds 8 calls total (one per slot, at first use) and is in the noise
end-to-end. A pool thrashing between more modules than it has slots
takes 2 extra calls per instantiation, ~+43% on instantiation. With MPK
disabled `ProtectionKey` is uninhabited and this all compiles away.
Fixes #13982
Fixes #7942
* prtest:full
* wasmtime: Clarify that component::Linker doesn't support intra-component linking yet (#14088)
* wasmtime: Clarify that component::Linker doesn't support intra-component linking yet
https://bytecodealliance.zulipchat.com/#narrow/channel/217126-wasmtime/topic/.E2.9C.94.20linking.20wasm.20components.20at.20runtime.3F/near/615012938
The current state tripped me up a bit, since the docs make it sound
like it's already there and working, while the API itself seems
nowhere to be found.
* Remove the mention of intra-component linking entirely
#14088 (review)
* Reflow the paragraph
* Remove preemption points in bulk operations (#14045)
* Remove preemption points in bulk operations
This commit updates the translation of bulk operations such as
`memory.grow` which were recently refactored to not have preemption
points within the operation itself. Preemption points within the
operation, while useful for very large operations, expose internal and
intermediate state to embedders and the rest of the runtime. For example
tables that are grown are initially filled with null, which may not be
valid for the table's type. These bulk operations didn't recompute
pointers/indices after a possible preemption meaning if memories were
grown/moved then it would cause faults. In general this is seen as too
risky of an operation to perform.
The fix in this commit is to move all preemption checks to the start of
the operation itself. This means that bulk operations continue to be
metered with a cost proportional to the size of the operation for fuel,
and they all contain an initial epoch check for epochs. Once the
operation is committed to, however, there's no cancelling it and it'll
continue to run. In practice this means that extremely large copies,
for example, can blow the epoch budget. To re-add preemption checks
within the operation, however, will require very careful reintroduction
to avoid these sorts of problems/faults.
* Fix miri
* Fix `named_imports` with a hyphen in interface names (#14105)
Closes #14090
---------
Co-authored-by: Nick Fitzgerald <fitzgen@gmail.com>
Co-authored-by: Joel Dice <joel.dice@fermyon.com>
Co-authored-by: Johnnie Birch <johnnie.l.birch.jr@intel.com>
Co-authored-by: Natalie Klestrup Röijezon <nat@nullable.se>main (#14106)1 parent 45af25f commit fc78952
24 files changed
Lines changed: 1357 additions & 849 deletions
File tree
- cranelift
- codegen/src
- filetests/filetests/alias
- crates
- component-macro/tests
- cranelift/src
- func_environ
- wasi/src
- wasmtime/src
- runtime
- component
- vm
- instance/allocator/pooling
- mpk
- wit-bindgen/src
- tests
- all
- disas
- gc
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
78 | 77 | | |
79 | 78 | | |
80 | | - | |
| 79 | + | |
81 | 80 | | |
82 | 81 | | |
83 | 82 | | |
| |||
144 | 143 | | |
145 | 144 | | |
146 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
147 | 188 | | |
148 | 189 | | |
149 | 190 | | |
| |||
176 | 217 | | |
177 | 218 | | |
178 | 219 | | |
179 | | - | |
180 | | - | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
181 | 227 | | |
182 | 228 | | |
183 | 229 | | |
184 | 230 | | |
185 | | - | |
186 | | - | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
187 | 237 | | |
188 | 238 | | |
189 | 239 | | |
| |||
193 | 243 | | |
194 | 244 | | |
195 | 245 | | |
196 | | - | |
| 246 | + | |
197 | 247 | | |
198 | 248 | | |
199 | 249 | | |
| |||
207 | 257 | | |
208 | 258 | | |
209 | 259 | | |
210 | | - | |
| 260 | + | |
211 | 261 | | |
212 | 262 | | |
213 | 263 | | |
| |||
216 | 266 | | |
217 | 267 | | |
218 | 268 | | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
| 269 | + | |
243 | 270 | | |
244 | 271 | | |
245 | 272 | | |
| |||
282 | 309 | | |
283 | 310 | | |
284 | 311 | | |
285 | | - | |
| 312 | + | |
286 | 313 | | |
287 | | - | |
| 314 | + | |
288 | 315 | | |
289 | 316 | | |
290 | 317 | | |
| |||
303 | 330 | | |
304 | 331 | | |
305 | 332 | | |
306 | | - | |
| 333 | + | |
307 | 334 | | |
308 | | - | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
309 | 341 | | |
310 | 342 | | |
311 | 343 | | |
312 | | - | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
313 | 348 | | |
314 | | - | |
315 | 349 | | |
316 | 350 | | |
317 | 351 | | |
| |||
322 | 356 | | |
323 | 357 | | |
324 | 358 | | |
325 | | - | |
| 359 | + | |
326 | 360 | | |
| 361 | + | |
327 | 362 | | |
328 | 363 | | |
329 | 364 | | |
330 | | - | |
| 365 | + | |
331 | 366 | | |
332 | 367 | | |
333 | | - | |
| 368 | + | |
334 | 369 | | |
335 | 370 | | |
336 | 371 | | |
337 | 372 | | |
338 | 373 | | |
339 | 374 | | |
340 | 375 | | |
341 | | - | |
| 376 | + | |
342 | 377 | | |
| 378 | + | |
343 | 379 | | |
344 | 380 | | |
345 | 381 | | |
| |||
349 | 385 | | |
350 | 386 | | |
351 | 387 | | |
352 | | - | |
| 388 | + | |
353 | 389 | | |
354 | 390 | | |
355 | 391 | | |
356 | 392 | | |
357 | | - | |
| 393 | + | |
358 | 394 | | |
359 | 395 | | |
360 | 396 | | |
361 | 397 | | |
362 | | - | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
363 | 404 | | |
364 | 405 | | |
365 | 406 | | |
366 | | - | |
| 407 | + | |
367 | 408 | | |
368 | 409 | | |
369 | 410 | | |
| |||
409 | 450 | | |
410 | 451 | | |
411 | 452 | | |
412 | | - | |
| 453 | + | |
413 | 454 | | |
414 | 455 | | |
415 | 456 | | |
| |||
418 | 459 | | |
419 | 460 | | |
420 | 461 | | |
421 | | - | |
| 462 | + | |
422 | 463 | | |
423 | 464 | | |
424 | 465 | | |
| |||
433 | 474 | | |
434 | 475 | | |
435 | 476 | | |
436 | | - | |
437 | | - | |
| 477 | + | |
| 478 | + | |
438 | 479 | | |
439 | 480 | | |
440 | 481 | | |
| |||
527 | 568 | | |
528 | 569 | | |
529 | 570 | | |
530 | | - | |
| 571 | + | |
531 | 572 | | |
532 | 573 | | |
533 | 574 | | |
| |||
543 | 584 | | |
544 | 585 | | |
545 | 586 | | |
546 | | - | |
| 587 | + | |
547 | 588 | | |
548 | 589 | | |
549 | 590 | | |
550 | 591 | | |
551 | | - | |
| 592 | + | |
552 | 593 | | |
553 | 594 | | |
554 | 595 | | |
| |||
604 | 645 | | |
605 | 646 | | |
606 | 647 | | |
607 | | - | |
608 | | - | |
609 | | - | |
610 | | - | |
611 | | - | |
| 648 | + | |
| 649 | + | |
612 | 650 | | |
613 | 651 | | |
| 652 | + | |
614 | 653 | | |
615 | | - | |
| 654 | + | |
616 | 655 | | |
617 | 656 | | |
618 | 657 | | |
| |||
635 | 674 | | |
636 | 675 | | |
637 | 676 | | |
| 677 | + | |
| 678 | + | |
638 | 679 | | |
639 | 680 | | |
640 | 681 | | |
| |||
673 | 714 | | |
674 | 715 | | |
675 | 716 | | |
676 | | - | |
677 | | - | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
678 | 720 | | |
679 | 721 | | |
680 | 722 | | |
| |||
742 | 784 | | |
743 | 785 | | |
744 | 786 | | |
745 | | - | |
746 | | - | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
747 | 794 | | |
748 | 795 | | |
749 | 796 | | |
| |||
0 commit comments