Commit bf1ece7
committed
refactor recursive reentrance checks
This commit makes a few changes related to recursive reentrance checks, instance
poisoning, etc.:
- Implements the more restrictive lift/lower rules described in WebAssembly/component-model#589 such that a component instance may not lower a function lifted by one of its ancestors, nor vice-versa. Any such lower will result in a fused adapter which traps unconditionally, preventing guest-to-guest recursive reentrance without requiring data flow analysis.
- Note that this required updating several WAST tests which were violating the new rule.
- This is handled entirely in the `fact` module now; I've removed the `AlwaysTrap` case previously handled by `wasmtime-cranelift`.
- Removes `FLAG_MAY_ENTER` from `InstanceFlags`. It is no longer needed for guest-to-guest calls due to the above, and for guest-to-host-to-guest calls we can rely on either `FLAG_NEEDS_POST_RETURN` for sync-lifted functions or the `GuestTask` call stack for async-lifted functions.
- Adds a `StoreOpaque::trapped` field which is set when _any_ instance belonging to that store traps, at which point the entire store is considered poisoned, meaning no instance belonging to it may be entered. This prevents indeterminant concurrent task state left over from the trapping instance from leaking into other instances.
Note that this does _not_ include code to push and pop `GuestTask` instances for
guest-to-guest sync-to-sync calls, nor for host-to-guest calls using e.g. the
synchronous `Func::call` API, so certain intrinsics which expect a `GuestTask`
to be present such as `backpressure.inc` will still fail in such cases. I'll
address that in a later PR.
Fixes bytecodealliance#121281 parent caf0f75 commit bf1ece7
File tree
36 files changed
+1187
-809
lines changed- crates
- cranelift/src
- compiler
- environ/src
- component
- translate
- fact
- misc/component-async-tests
- src
- tests/scenario
- wasmtime/src/runtime
- component
- func
- resources
- vm
- component
- wit-bindgen/src
- tests
- all/component_model
- misc_testsuite/component-model
- async
36 files changed
+1187
-809
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| |||
100 | 99 | | |
101 | 100 | | |
102 | 101 | | |
103 | | - | |
104 | 102 | | |
105 | 103 | | |
106 | 104 | | |
| |||
117 | 115 | | |
118 | 116 | | |
119 | 117 | | |
120 | | - | |
121 | 118 | | |
122 | 119 | | |
123 | 120 | | |
| |||
160 | 157 | | |
161 | 158 | | |
162 | 159 | | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | 160 | | |
179 | 161 | | |
180 | 162 | | |
| |||
1130 | 1112 | | |
1131 | 1113 | | |
1132 | 1114 | | |
1133 | | - | |
1134 | | - | |
1135 | | - | |
1136 | | - | |
1137 | | - | |
1138 | | - | |
1139 | | - | |
| 1115 | + | |
| 1116 | + | |
1140 | 1117 | | |
1141 | 1118 | | |
1142 | 1119 | | |
| |||
1184 | 1161 | | |
1185 | 1162 | | |
1186 | 1163 | | |
1187 | | - | |
1188 | | - | |
1189 | | - | |
1190 | | - | |
1191 | | - | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
1192 | 1169 | | |
1193 | 1170 | | |
1194 | | - | |
1195 | | - | |
1196 | | - | |
1197 | | - | |
1198 | | - | |
1199 | | - | |
1200 | | - | |
1201 | | - | |
1202 | | - | |
1203 | | - | |
1204 | | - | |
1205 | | - | |
1206 | 1171 | | |
1207 | 1172 | | |
1208 | 1173 | | |
| |||
1434 | 1399 | | |
1435 | 1400 | | |
1436 | 1401 | | |
1437 | | - | |
| 1402 | + | |
1438 | 1403 | | |
1439 | 1404 | | |
1440 | 1405 | | |
| |||
1466 | 1431 | | |
1467 | 1432 | | |
1468 | 1433 | | |
1469 | | - | |
1470 | | - | |
1471 | | - | |
1472 | | - | |
1473 | | - | |
1474 | | - | |
1475 | | - | |
1476 | | - | |
| 1434 | + | |
1477 | 1435 | | |
1478 | 1436 | | |
1479 | 1437 | | |
| |||
1512 | 1470 | | |
1513 | 1471 | | |
1514 | 1472 | | |
1515 | | - | |
| 1473 | + | |
1516 | 1474 | | |
1517 | 1475 | | |
1518 | 1476 | | |
| |||
1557 | 1515 | | |
1558 | 1516 | | |
1559 | 1517 | | |
1560 | | - | |
1561 | 1518 | | |
1562 | 1519 | | |
1563 | 1520 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | 51 | | |
56 | 52 | | |
57 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
329 | | - | |
330 | 329 | | |
331 | 330 | | |
332 | 331 | | |
| |||
945 | 944 | | |
946 | 945 | | |
947 | 946 | | |
948 | | - | |
949 | 947 | | |
950 | 948 | | |
951 | 949 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
734 | 734 | | |
735 | 735 | | |
736 | 736 | | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | 737 | | |
742 | 738 | | |
743 | 739 | | |
| |||
1199 | 1195 | | |
1200 | 1196 | | |
1201 | 1197 | | |
1202 | | - | |
1203 | 1198 | | |
1204 | 1199 | | |
1205 | 1200 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
169 | 172 | | |
170 | 173 | | |
171 | 174 | | |
| |||
0 commit comments