Urgent.News

What's breaking now, across thousands of outlets.

Tech

I want extern "fil-c"

The article discusses a new Rust-based solution called Fil-C that aims to provide compile-time memory safety for legacy C and C++ code. By recompiling C and C++ code with capabilities, runtime checks, and a concurrent garbage collector, Fil-C ensures that memory-safety violations will result in a panic, preventing exploits at runtime. This approach allows existing software to remain largely unchanged while paying for safety at runtime.

The first version of Fil-C would focus on scalar values, copied strings and slices, and opaque handles, generating safe Rust wrappers and compiling the complete C dependency graph with Fil-C. It would provide no escape hatch back to ordinary unsafe C. A shared memory feature is planned for later implementation, once the bridge can reliably revoke Fil-C's capabilities.

Fil-C is source-compatible with C but not ABI-compatible, and ordinary Rust extern C calls an ABI called Yolo-C. Building the bridge between Rust, Fil-C, and ordinary C requires teaching Rust, Fil-C, or generated stubs how to exchange values while preserving Fil-C's guarantees. Fil-C has the capability model and a working runtime, while Rust offers compile-time safety. Zig is also exploring a Fil-C-inspired ABI.

Nix and filnix can help by rebuilding and testing complete dependency graphs, creating a reproducible toolchain and package universe for Fil-C. The article suggests that a Rust bridge implementing Fil-C could provide an incentive to use C as the safe compatibility path, rather than the permanent fast path. The ultimate goal is to have "100% safe" memory across the whole supported boundary, acknowledging that logic bugs, deadlocks, and bad APIs still exist.

The author invites collaboration from experts in Rust, Fil-C, Zig, and Nix to build this solution together at OceanSprint next year in Lanzarote.

Written by urgent.news from Lobsters's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at domenkozar.com →

More in Tech

More from Thursday 13 August →