Repolode
pizlonator

pizlonator/fil-c

A memory-safe implementation of C and C++ that compiles existing code with few or no changes and turns memory errors into panics.

Stars
3,904
Forks
94
Open issues
79
Last commit
4 hours ago

What is it?

Fil-C is a memory-safe implementation of C and C++ built on clang 20.1.8, supporting C17 and C++20. Most software that targets C or C++ can be compiled with zero or minimal changes, and memory safety violations such as out-of-bounds access, use-after-free, and type confusion are caught as Fil-C panics rather than silently corrupting memory.

Fil-C uses a combination of concurrent garbage collection and invisible capabilities: each pointer has a corresponding capability, not visible to the C address space, that records what memory it may access and how. Every fundamental C operation is checked against that capability. Unlike tag-based tools such as AddressSanitizer, the design aims to prevent bugs from being exploited, not just flag them. The language has no `unsafe` escape hatch, and linking to unsafe code is restricted.

Fil-C runs natively on Linux x86_64 and ARM64. The project includes musl-based and glibc-based builds, a Peregrine variant that produces APE binaries for Linux, Darwin, and Windows on x86_64, and Pizlix, a memory-safe Linux userland. Packages such as OpenSSL, CPython, and SQLite are reported to work.

Key features

  • 01Compiles most C and C++ code with zero or minimal changes.
  • 02Catches out-of-bounds, use-after-free, and type confusion errors as panics.
  • 03Uses capability-based checks rather than tag-based detection.
  • 04Provides a POSIX-style libc with threads, signals, mmap, setjmp/longjmp, and C++ exceptions.
  • 05Runs on Linux x86_64 and ARM64, with a Peregrine variant for multiple platforms.

Use cases

  • Hardening existing C or C++ programs against memory-safety exploits.
  • Finding memory errors in C/C++ code with a runtime that stops at the faulty operation.
  • Building a memory-safe Linux userland from ported C software.

Quick start

  1. 1

    Download a binary distribution from the releases page (e.g. filc-0.687-linux-x86_64.tar.xz)

  2. 2

    Run the setup script from the extracted distribution

    ./setup.sh

Things to know

  • Native support is limited to Linux on X86_64 or ARM64; other platforms need the experimental Peregrine build, which requires a Linux/x86_64 host to build.
  • The project is built on a patched clang and has a custom runtime, so it is a heavy toolchain to build from source.
  • The license is not a single standard license; it depends on the component (LLVM, PAS, musl, cosmo, glibc and others), so review the terms before use.

In collections

Topics

FAQ

What is fil-c?
A memory-safe implementation of C and C++ that compiles existing code with few or no changes and turns memory errors into panics. Fil-C is a memory-safe implementation of C and C++ built on clang 20.1.8, supporting C17 and C++20. Most software that targets C or C++ can be compiled with zero or minimal changes, and memory safety violations such as out-of-bounds access, use-after-free, and type confusion are caught as Fil-C panics rather than silently corrupting memory.
Is fil-c free to use? What license does it have?
fil-c is open source under the Other license. Check the license terms before using it in commercial products.
Is fil-c still maintained?
Actively maintained. The last commit to fil-c was on Nov 7, 2026.
What can I use fil-c for?
Hardening existing C or C++ programs against memory-safety exploits. Finding memory errors in C/C++ code with a runtime that stops at the faulty operation. Building a memory-safe Linux userland from ported C software.
How do I install fil-c?
Download a binary distribution from the releases page (e.g. filc-0.687-linux-x86_64.tar.xz) Run the setup script from the extracted distribution: ./setup.sh
Where can I get fil-c?
The source code and installation instructions are on GitHub: https://github.com/pizlonator/fil-c

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects