You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[soundness] hy-check(closures): update_pre_defer_peers and update_post_defer_watch ignore field/index store assignments, allowing defer to race with task move (HYB-E3003) #4368
On main (7cf29833), update_pre_defer_peers and update_post_defer_watch in compiler/crates/hy-check/src/closures.rs only match PlaceKind::Ident(target) in their Stmt::Assign arms and ignore field/index store assignments (PlaceKind::Field / PlaceKind::Index, such as b.m = m or b["k"] = m).
Because defer report(m) evaluates m eagerly at the defer statement, storing m into b.m (before or after defer report(m)), rebinding m = map[string]int{"k": 2} (which severs m from st.may_share["b"]), and moving b into task worker(move b) causes inspect_later_defer_fate to miss that b carries the deferred map storage. hyb check accepts with 0 diagnostics, resulting in a concurrent map write between the background task and the deferred report(m) at function exit (GUARANTEES.md Rows 1 & 5, HYB-E3003).
Minimal .hy Reproducer (Commit 7cf29833)
package main
struct box {
m map[string]int
}
fn worker(b box) {
b.m["k"] = 99
}
fn report(m map[string]int) {
m["k"] = 1
}
fn main() {
m := map[string]int{"k": 0}
b := box{m: map[string]int{}}
defer report(m)
b.m = m
m = map[string]int{"k": 2}
task worker(move b)
}
Expected vs Actual
Expected: Verdict::Reject with HYB-E3003 (A1b).
Actual on 7cf29833: hyb check accepts with 0 diagnostics (Verdict::Accept).
Activity
fix(hy-check): track field and index store assignments in defer peer …
fix(hy-check): track field and index store assignments in defer peer …
fix(hy-check): track field and index store assignments in defer peer …
fix(hy-check): track field and index store assignments in defer peer …
fix(hy-check): track field/index stores in defer peer/watch (fixes li…
fix(hy-check): track field/index stores in defer peer/watch (fixes li…
fix(hy-check): track field/index stores in defer peer/watch (fixes li…
fix(hy-check): track field and index store assignments in defer peer …
fix(hy-check): track field/index stores in defer peer/watch (fixes li…