RETRACE is a native Linux process recorder and fault-injection tool. Its goal is to show important process-boundary behavior and then recreate selected failure conditions deliberately.
A program failed under unusual conditions. What happened, and can those conditions be recreated?
RETRACE is pre-alpha but has a working process-recording and inspection slice:
retrace runlaunches a command and preserves its arguments;run --working-directory PATHselects and records the target directory;- each target leads a process group, and received
SIGINT/SIGTERMsignals are forwarded to that group and recorded; - normal exits and signal termination are returned to the caller;
- launch failure is distinguished from a target that exits with status 127;
- stdout and stderr are collected concurrently through separate pipes and forwarded to the caller;
run --output TRACEwrites an exclusive, user-only v1.0 trace containing command metadata, lifecycle events, and captured stream chunks;retrace inspect TRACErenders a bounded, escaped timeline, including valid unknown event types;retrace validate TRACEchecks the v1.0 structure without loading the whole event stream into memory; and- each ordinary run locates and loads
libretrace_runtime.sowithLD_PRELOAD, preserves caller preload entries, validates its bounded Unix-domain channel, and recordsruntime.handshake;--no-runtimedisables this path; - the loaded runtime interposes
open,open64,openat,openat64, andclose, and each observed call becomes afile.openorfile.closetrace event carrying its path, descriptor, result,errno, and duration; - operations the bounded runtime channel dropped are counted and reported, so an incomplete recording is never presented as a complete one; and
- dependency-free tests exercise the CLI, process and trace layers, plus C stream, file, and runtime fixtures.
Socket and read/write instrumentation, time limits, trace export, and fault injection are not implemented yet. Static, setuid, or otherwise loader-restricted targets cannot be instrumented; RETRACE reports a missing required handshake after preserving their observed lifecycle evidence. A successful validation means that the bytes are structurally valid v1.0; because v1.0 has no footer or checksum, it does not prove that a run was finalized or that its contents are authentic.
RETRACE is open source under the MIT License.
The current runner can execute a target:
./build/dev/bin/retrace run -- /bin/echo "hello from RETRACE"
./build/dev/bin/retrace run -- python3 -c 'print("hello from Python")'
./build/dev/bin/retrace run --output /tmp/example.rtc -- /bin/echo recorded
./build/dev/bin/retrace run --working-directory /tmp -- /bin/pwd
./build/dev/bin/retrace run --no-runtime -- /bin/echo recorder-onlyRecorded traces can be inspected or structurally validated:
./build/dev/bin/retrace inspect /tmp/example.rtc
./build/dev/bin/retrace validate /tmp/example.rtcThe v0.1 process-recorder slice is implemented. The v0.2 work now includes a standalone C17 library, versioned handshake, a supervisor-owned channel that automatically loads the runtime into supported dynamic targets, and recorded file operations observed inside the target:
./build/dev/bin/retrace run --output /tmp/files.rtc -- /bin/cat /etc/hostname
./build/dev/bin/retrace inspect /tmp/files.rtc 0.594 ms file.open pid=68278 tid=68278 fd=3 path="/etc/hostname" ...
0.598 ms file.close pid=68278 tid=68278 fd=3 ...
Socket and read/write operations are the remaining v0.2 slice; v0.3 will control them with bounded fault rules:
# Planned for v0.3; not implemented yet.
retrace run \
--fail 'open:/tmp/cache/*:EACCES' \
--delay 'connect:127.0.0.1:5432:500ms' \
-- ./example-serverRETRACE will not claim deterministic replay, complete syscall visibility, or debugger-level control. When recording and fault injection ship, it will recreate selected conditions and record only what it actually observed or injected.
Requirements:
- Linux
- CMake 3.25 or newer
- Ninja
- A C17 and C++20 compiler (GCC or Clang)
cmake --preset dev
cmake --build --preset dev
ctest --preset dev
./build/dev/bin/retrace version
./build/dev/bin/retrace run -- /bin/echo helloNo third-party runtime or test dependencies are used at this stage.
- Documentation map
- Architecture
- Product goals and scope
- Development design
- CLI design
- Trace format
- Recorder examples
- Fault rules
- Security model
- Roadmap
- v0.1 release checklist
- C and C++ learning guide
- Contributing
Trace data may contain command arguments, working directories, the paths of
files the target opened, standard output, and standard error. Any of those can contain secrets. Recording currently requires an
explicit --output path; review every trace before sharing it. See
docs/security.md for the full safety model.
RETRACE is Linux-first and does not initially aim to provide kernel modules, eBPF instrumentation, source-level debugging, profiling, container isolation, distributed tracing, or multi-host coordination. Small useful releases take priority over speculative infrastructure.
RETRACE is available under the MIT License.