keel
keel is a Rust implementation of the musl C library ABI and dynamic linker
for Linux. It runs unmodified musl-linked binaries on x86_64, aarch64, riscv64,
powerpc64le and loongarch64, and provides libc.a for static linking.
- musl 1.2.6 ABI with the full public symbol surface
libc.soas the ELF interpreter; no source changes or rebuildsno_stdlibc and dynamic linker (libc.so); the standalonekeelmapper usesstd
keel is the standalone mapper for static PIE and static ELF binaries;
dynamic binaries use libc.so as their interpreter.
Quick start
Build the loader and libc, then link a program against keel’s libc.so and
run it with the build directory as the runtime library path:
bash
cargo build --workspace
musl-gcc -fPIE -pie -I include \
-Wl,--dynamic-linker="$PWD/target/debug/libc.so" \
-L target/debug -Wl,--allow-shlib-undefined \
hello.c -lc -o hello
LD_LIBRARY_PATH=target/debug ./hello
Static PIE and static ELF binaries can be launched through the standalone mapper:
bash
./target/debug/keel ./hello-static
Status
keel is experimental (0.1.x), not a production-ready drop-in replacement
for musl. libc-test runs natively on x86_64 and aarch64, and through qemu
on riscv64, powerpc64le and loongarch64. LTP, the Alpine workload matrix, and
the CPython/Git/nginx upstream suites are recorded on x86_64. The three
non-native targets are also covered by cross-builds and the qemu smoke suites
(scripts/riscv-smoke.sh, scripts/cross-smoke.sh).
Workload validation
The real workload matrix runs thirteen stock Alpine
programs in two identical chroots: one with the stock musl loader and one
with keel’s libc.so. For each program the exit status and observable output
must match musl.
The current set is BusyBox, Bash, curl, Git, SQLite, nginx, Redis, CPython,
PHP, Ruby, Node.js, FFmpeg and PostgreSQL. It exercises dlopen, TLS and
threads, fork/exec, sockets, epoll, SysV IPC, regular expressions,
scandir, termios/job control and the dynamic loader’s dependency and
relocation paths.
The scripts live in scripts/workloads/. CI builds the Alpine rootfs in
parallel with build-and-test through
workloads-prepare.yml, then runs
one parallel job per program through
workloads-matrix.yml. A failure
in any program blocks ci-status and the release gate.
To run a workload locally:
bash
cargo build --release -p keel-libc --target x86_64-unknown-linux-gnu
sudo ./scripts/workloads/setup-rootfs.sh /tmp/keel-workload
sudo ./scripts/workloads/run-workload.sh php /tmp/keel-workload
setup-rootfs.sh pins Alpine 3.23.8 and verifies the minirootfs checksum.
Set ALPINE_MIRROR to use a mirror, and LIBC if the release libc.so is in
a different target directory.
Build
The toolchain is pinned to stable Rust by rust-toolchain.toml; Rust 1.99 or newer is required for stable C varargs. The
integration tests need musl-gcc, file and binutils; the static fixtures
also need the host musl CRT objects under /usr/lib/<arch>-linux-musl/.
bash
cargo build --workspace
cargo test --workspace
cargo test --workspace expects target/debug/libc.so from the build above.
Cross-compilation and packaging are in docs/packages.md;
release workflow details are in AGENTS.md.
Documentation
- Comparison with musl and other libcs
- Known limitations
- Real workload matrix
- Upstream workload suites
- LTP results
- Performance
- Security policy
- Security testing
- Alpine packages
keel is licensed under BSD-3-Clause. Parts ported from musl retain its MIT notice, reproduced in NOTICE.
