Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Environment:2akouwu Reverify Native Execution

From Leeroopedia
Knowledge Sources
Domains Infrastructure, Security, Verification
Last Updated 2026-10-24 12:00 GMT

Overview

Host environment with a C compiler and explicit `REVERIFY_ALLOW_NATIVE_EXEC=1` opt-in, enabling sandboxed compilation and execution of untrusted candidate code.

Description

This environment is required when reverify compiles and runs candidate code on the host (as opposed to emulating it with Unicorn). It is off by default: the adapter returns `inconclusive` unless the environment variable `REVERIFY_ALLOW_NATIVE_EXEC` is set to `1`. When enabled, both the compile and the run go through `reverify.sandbox` — wall-clock timeout, CPU/memory/file-size/process-count limits, output cap, scrubbed environment, and isolated working directory. A C compiler (`gcc` by default) must be on PATH. The sandbox is not a security boundary against a determined attacker; for hostile corpora, run it inside a container as well.

Usage

Use this environment for source-level differential testing: compiling candidate C programs and re-running them against recorded I/O pairs (ExeBench / re-executability), and for `functions_equiv_verify` which compiles and runs both a reference and a candidate implementation. It is the prerequisite for `compile_candidate`, `run_sandboxed`, and `functions_equiv_verify`.

System Requirements

Category Requirement Notes
OS Linux / macOS / Windows POSIX rlimits on Unix; Windows Job Object (best-effort)
Hardware Any CPU with C compiler toolchain 256MB+ RAM for candidate runs
Disk Temp directory writable Fresh temp dir per compile/run cycle

Dependencies

System Packages

  • `gcc` (or any C compiler: `clang`, `cl`/MSVC) — must be on PATH
  • Python >= 3.8

Python Packages

  • `reverify` (core package)
  • No additional pip packages required

Credentials

  • `REVERIFY_ALLOW_NATIVE_EXEC`: Must be set to `1` (or `true`/`yes`/`on`) to enable native execution. Without it, all native-exec adapters return `inconclusive`.

Quick Install

# Install reverify
pip install reverify

# Ensure a C compiler is available
gcc --version  # or: clang --version

# Enable native execution (opt-in)
export REVERIFY_ALLOW_NATIVE_EXEC=1

Code Evidence

Opt-in gate from `exebench.py:64-73`:

NATIVE_EXEC_ENV = "REVERIFY_ALLOW_NATIVE_EXEC"
NATIVE_EXEC_HINT = (
    f"running candidate code is off by default; set {NATIVE_EXEC_ENV}=1 to enable it "
    "(build and run are then confined by reverify.sandbox; for hostile inputs also use a container)"
)

def native_exec_allowed() -> bool:
    return os.environ.get(NATIVE_EXEC_ENV, "").strip().lower() in ("1", "true", "yes", "on")

Compiler detection from `exebench.py:76-78`:

def has_compiler(cc: str = "gcc") -> bool:
    return shutil.which(cc) is not None

Sandbox resource limits for candidate runs from `exebench.py:61-62`:

_RUN_LIMITS = SandboxLimits(cpu_seconds=5, memory_bytes=256 * _MB,
                            file_size_bytes=8 * _MB, max_processes=32, output_bytes=256 * 1024)

CI enabling native execution from `.github/workflows/ci.yml:104-105`:

env:
  REVERIFY_ALLOW_NATIVE_EXEC: "1"

Common Errors

Error Message Cause Solution
`inconclusive: running candidate code is off by default` `REVERIFY_ALLOW_NATIVE_EXEC` not set `export REVERIFY_ALLOW_NATIVE_EXEC=1`
`inconclusive: no C compiler 'gcc' available` No C compiler on PATH Install gcc/clang or set `cc="clang"` parameter
`inconclusive: candidate did not compile` Compile error or timeout Check candidate source syntax; compile limit is 30s

Compatibility Notes

  • Linux/macOS: Full POSIX sandbox with `setrlimit` (CPU, memory, file-size, process-count), `setsid`, and process-group kill.
  • Windows: Best-effort Job Object (memory cap + kill-on-close); if Job Object creation fails, timeout + output cap + cwd isolation still apply. MSVC developer environment is set up in CI.
  • Security caveat: The sandbox removes everyday foot-guns (infinite loops, memory blow-ups, fork bombs, disk flooding, env leakage) but is not a security boundary. For hostile inputs, use a container as well.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment