Skip to main content

Module simulate

Module simulate 

Source
Expand description

Tier 2: cargo libc test and cargo libc run execute each target binary through the libc-runner helper, which Cargo calls as its target runner.

The helper first applies the direct glibc check to the binary (a newer host glibc would otherwise hide a too-new requirement under the local runner), then runs it under the kernel simulation from kernel-abi-tools: the local seccomp filter (host userland, no root) or a container with the target’s userland. The selection travels from cargo libc to the helper in CARGO_LIBC_RUN_* environment variables.

Without a runner, and with the local runner, the program uses the host’s glibc. The helper then also compares the program’s GLIBC version requirements with what the host’s libraries define (the same test the loader makes) and refuses to start a program that cannot load there.

Functions§

run_program
The libc-runner entry point: libc-runner PROGRAM [ARGS...], Cargo’s target runner. Refuses a program that needs a newer glibc than the target, or one the host’s libraries cannot load when it runs on the host, then runs it under the selected kernel simulation, if any. Returns the program’s exit code, or 2 when it was refused.