Expand description
Cross-language FFI reachability analysis.
Build a cross-language reach Program:
use weir::cross_language::cross_language;
let program = cross_language(
4, "source", "sink", "post_cross",
"current", "next", "changed", "seed", "out",
).unwrap();cross_language - forward reachability that requires the flow to cross
at least one cross-language FFI edge anywhere on the source-to-sink path.
The merged polyglot ProgramGraph (built upstream by
surge_frontend::pipeline::merge_polyglot) carries language-specific
CALL_ARG edges plus a small set of “FFI” edges that span
languages - Python ctypes → C symbol, JNI Java→C, N-API JS→C,
Rust bindgen Rust→C. The vanilla flows_to primitive treats
all edges identically and therefore fires on intra-language flows
that never cross a language boundary; this primitive constrains
the path to traverse at least one FFI edge so cross-language
detection is precise.
Lowering shape (composes existing Tier-2.5 primitives):
- Source-side reach. Run
bitset_fixpoint-driven BFS from the source over the full graph. This models intra-language setup before a boundary crossing. - Mandatory FFI bridge. Run
csr_forward_traversefrom the source-side reach set restricted to theEDGE_KIND_FFImask. The output (post_cross) is exactly the callee-side nodes reached through at least one cross-language edge. - Free-form continuation. Run
bitset_fixpoint-driven BFS frompost_crossover the full edge mask. The fixpoint output is the set of nodes the source can reach after crossing the language boundary. - Sink intersection. AND the reach with the sink bitset; the output is non-empty iff some source reaches some sink across a language boundary.
Soundness: MayOver. The
BFS over-approximates calls (we model every FFI edge as
reachable, even when feature flags / arch gates would prune the
call site). Rules that need precision must compose with a
sanitizer-dominator filter.
Structs§
- Cross
Language - Soundness marker for
cross_language.
Constants§
- EDGE_
KIND_ ALL - Edge-kind mask covering “everything” (post-crossing flow uses any
edge). The exact value mirrors
csr_forward_traverse’s “all” dispatch convention. - EDGE_
KIND_ FFI - Edge-kind mask reserved for FFI / cross-language CALL_ARG edges.
Aligns with the
vyre_primitives::predicate::edge_kindnamespace
Functions§
- cross_
language - Build the cross-language reach Program.