Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/heimdall

examples/graph-pure/README.md

graph-pure: a graph filter from the graph alone, on a std-only Rust program

EXPERIMENT (lane f-lane, 2026-11-13). Heimdall is a defensive sandbox.

src/main.rs uses std only (no C and no asm of its own): two threads, a unix socket (bind, listen, accept, connect, shutdown), and a file write and read back. e2e.sh runs the whole chain:

  1. cargo mimir make --with-c --root 'graph-pure[bin=graph_pure]@0.1.0::main'
  2. heimdall graph filter --libc glibc WITHOUT --allow-open
  3. heimdall profile enforce on the built program

Result on build-1 (evidence/):

step result
make 62 possible system calls
graph filter 63 rules = 62 graph calls + restart_syscall (kernel-issued, no call site); 0 open items, 0 open call sites; implied set kernel-issued
enforce exit 0, prints hello graph
negative control (the closed fixture's graph filter) SIGSYS at syscall 21 (access, in the dynamic loader), exit 159

The Mímir tools (cargo-mimir, mimir-bin, mimir-exec) were built from nornir c-lane/train-2b ed1aedf9: main with g-lane/c-hidden-rows and f-lane/libc-gen-exits-2 c98767a0. The driver and c-mimir-dump come from the g-lane tools. With the libc-gen-exits rows, the libc rows hold rt_sigreturn (the restorer that sigaction installs), exit (the thread end) and the fatal-error exits. With the tools from main before them, the same graph has two gaps, exit and rt_sigreturn, and graph mode refuses.

x86_64-unknown-linux-musl (static-pie): REFUSED

evidence/musl-refused/ (the same tools plus nornir f-lane/libc-gen-exits-3 620ceb9c, the cancel fix; make with -- --target x86_64-unknown-linux-musl):

step result
make 53 possible system calls; exit, exit_group and rt_sigreturn are in the graph
graph filter REFUSED: 1 open item, 0 open call sites: <start-up and exit functions> = sub_6020, sub_6028, sub_6030

The reason: the three are the .plt.got stubs (jmp *GOT) that crtbegin's __do_init and __do_fini reach behind cmpq $0,slot (if (__cxa_finalize) ...). Their symbols are weak and undefined. The static link dropped them from symtab, and their GOT slots hold 0 with no relocation, so the stubs never run. Mímir's binary half does not report that fact yet (nornir 0.6.1, mimir-bin), so Heimdall's start-up walk (heimdall-graph binary.rs runtime()) opens them. This turns green when 0.6.1 and Heimdall's C0 (Heimdall reads "open" from Mímir) land. Mímir's exec rows alone have 0 open items for this program.

Not covered: the program links glibc dynamically, so the libc half is the generated libc map, not this binary's own libc code. The filter has no argument rules (all 62 calls are bare). One run on one host: the test proves only that this run's calls are in the graph.