Commit 66a08fe
fix(fuse): gate the unsound shared+rebase auto path (#326)
`--memory auto` silently selected shared memory + address rebasing for
grow-free multi-memory inputs. That is UNSOUND (#326): `convert_memarg` only
rebases the static memarg offset (and bulk-memory ops); the dynamic address
operand of ordinary i32.load/i32.store is never rebased. Real components
address heap/shadow-stack via computed pointers, so shared fusion silently
overlaps their private memory — wrong results, no trap, no error. Confirmed in
`rewriter.rs` (convert_memarg; needs_rebase_locals gated to Memory{Copy,Fill,
Init}) and reproduced end-to-end.
Gate now (LS-D-1 — emit correct output or none, never plausible-but-wrong):
- `resolve_auto_memory_strategy` no longer selects shared+rebase; Auto always
resolves to multi-memory (sound). A `log::warn!` explains the gate.
- Explicit `--memory shared --address-rebase` remains an opt-in but now warns
loudly that it is unsound for computed-pointer access.
- Corrected the docstrings that claimed the shared path was "statically sound".
Tests:
- `auto_selects_shared_for_growfree_inputs` → `auto_gates_shared_for_growfree_
inputs_326` (asserts multi + 2 separate memories = the correctness #326
protects); `ls_m_7_auto_reprobes_after_add_component` re-probes via memory
count (2 → 3) since both resolutions are now multi.
- `test_304_identity_direct_adapter_is_inlined` now requests `SharedMemory`
explicitly — the #304 inlining feature runs on the shared path, which Auto no
longer selects; adapter inlining is orthogonal to the memory-access
unsoundness #326 gates.
Interim safety gate; correct runtime dynamic-address rebasing in rewriter.rs
(Tier-5) is the follow-up "fix properly" step. Safety docs (ADR-4,
loss-scenarios, safety-requirements) still describe the old auto→shared default
and should be reconciled in a traceability follow-up.
Refs #326.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent be66dc7 commit 66a08fe
3 files changed
Lines changed: 97 additions & 68 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
445 | 445 | | |
446 | 446 | | |
447 | 447 | | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
448 | 464 | | |
449 | 465 | | |
450 | 466 | | |
451 | 467 | | |
452 | 468 | | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
458 | 477 | | |
459 | 478 | | |
460 | 479 | | |
| |||
488 | 507 | | |
489 | 508 | | |
490 | 509 | | |
491 | | - | |
492 | | - | |
493 | | - | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
494 | 526 | | |
495 | | - | |
496 | | - | |
| 527 | + | |
| 528 | + | |
497 | 529 | | |
498 | 530 | | |
499 | 531 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | 24 | | |
26 | 25 | | |
27 | 26 | | |
| |||
178 | 177 | | |
179 | 178 | | |
180 | 179 | | |
181 | | - | |
182 | | - | |
183 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
184 | 187 | | |
185 | | - | |
| 188 | + | |
186 | 189 | | |
187 | 190 | | |
188 | 191 | | |
189 | 192 | | |
190 | 193 | | |
191 | | - | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
192 | 198 | | |
193 | 199 | | |
194 | | - | |
195 | | - | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
196 | 203 | | |
197 | 204 | | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
| 205 | + | |
| 206 | + | |
227 | 207 | | |
228 | 208 | | |
229 | 209 | | |
| |||
265 | 245 | | |
266 | 246 | | |
267 | 247 | | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
273 | 254 | | |
274 | 255 | | |
275 | 256 | | |
| |||
280 | 261 | | |
281 | 262 | | |
282 | 263 | | |
283 | | - | |
284 | | - | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
285 | 274 | | |
286 | 275 | | |
287 | 276 | | |
288 | 277 | | |
289 | 278 | | |
290 | 279 | | |
291 | | - | |
| 280 | + | |
| 281 | + | |
292 | 282 | | |
293 | | - | |
294 | | - | |
295 | | - | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
296 | 286 | | |
297 | | - | |
298 | 287 | | |
299 | 288 | | |
300 | 289 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
171 | 177 | | |
172 | 178 | | |
173 | 179 | | |
| 180 | + | |
| 181 | + | |
174 | 182 | | |
175 | 183 | | |
176 | 184 | | |
| |||
0 commit comments