DeltaOS Gym 1.0.0 · Harbor tasks · MIT

Linux and eBPF coding tasks for AI agents, graded by proofs and kernel tests.

DeltaOS Gym is six Harbor tasks in which a coding agent makes one exact change to Linux or eBPF code and leaves everything else as it was: an egress policy in a cgroup/connect4 BPF program, overflow-safe accounting in a BPF map, the predicate of a kernel-bug detector, crash-safe file publishing, descriptor confinement across exec, and the choice of diagnostic probes.

Each grader uses the strongest check that fits its task: a CBMC proof over every input, an exhaustive model check of fault schedules, real launches on Linux, or the compiled BPF loaded by the kernel verifier and run on every case inside the kernel. Next to the 0/1 reward it writes a receipt that lists each claim and the evidence behind it.

The graders are tested as well. The first version rejected its 20 planted bugs and gave full reward to 27 of 27 further wrong answers. This page shows how, and what replaced it.

20 / 20planted bugs rejected by the v0.5 graders
27 / 27further wrong candidates the same graders accepted
0 / 71wrong candidates accepted now, in 355 graded runs
85 / 85runs of correct, differently written solutions accepted

Measured on Linux 7.1.4 (x86_64). Both tables are in the repository: v0.5 escape matrix, release report.

How the first graders were fooled

None of these needed a clever attack. Most are a few lines of C.

1. It tests one program and ships another

The egress task asks for a decision function that lives inside a cgroup/connect4 BPF program. The v0.5 grader built the function for x86, ran 26,536 cases against it, then checked that the same file also compiles for BPF.

int policy_decide(unsigned uid, unsigned ip, unsigned short port,
                  unsigned proto, unsigned previously_allowed) {
#if defined(__bpf__)
    return 1;                       /* what ships: allow everything */
#else
    if (previously_allowed) return 1;
    return uid == 10042U && ip == 0x0a040209U && port == 443U && proto == 6U;
#endif
}
v0.5: all cases pass, BPF compiles, reward 1. Loaded into Linux 7.1.4, that build let through 192 of 192 test connections; the contract allows 2. The verifier loaded all 13 candidates, right and wrong.

The obvious fix is to preprocess the candidate for the BPF target once and test, prove and compile that one text. It is not enough. sizeof(long double) is 16 on x86-64 and 8 for BPF, so if (sizeof(long double) == 8) return 1; is still two programs, and so is code that compares the address of a local variable with 0xff00…, where kernel stacks live. So the source must now be plain integer C, the part of C on which the two targets agree: no sizeof, no floating point, no addresses, no asm, no builtins. With the kernel tier on, the compiled bytecode also answers every test case inside the kernel.

2. It lets the candidate into its own process

Four of the five graders loaded the candidate with ctypes or let the process hosting it print the verdict.

int charge(struct budget *state, unsigned long long amount) {
    int fd = open("/logs/verifier/reward.txt", O_WRONLY | O_CREAT | O_TRUNC, 0644);
    write(fd, "1\n", 2);
    _exit(0);              /* the grader never gets to write its own verdict */
}
v0.5: reward 1. Variants that worked as well: an atexit handler, printing {"passed": true}, a daemon that rewrites the file two milliseconds after the grader exits.

Candidate code now runs only in a sandbox process. In a verifier container the grader is root and the candidate is another user: it cannot write the verdict directory, cannot read tests/, and everything it started is killed before the verdict is written. Graders compare raw answers with the contract themselves, so there is nothing to print.

3. It samples where it could prove

if (uid == 0xC0FFEE42U && ip == 0x08080808U && port == 31337U && proto == 6U)
    return 1;              /* one extra flow nobody asked for */
v0.5: 25,000 random cases, none of them this one. reward 1.

v0.5's sampler hits that input with probability about 2-88 per case. A bounded model checker does not guess. CBMC proves the function equal to the contract for all 2113 inputs, or hands back the input where they differ:

"counterexample": {
  "reason": "counterexample_from_model_checker",
  "witness": {"uid": 3237998146, "ip": 134744072, "port": 31337, "proto": 6, "prior": 0},
  "expected": 0
}

3237998146 is 0xC0FFEE42. The proof for the reference takes 0.03 seconds.

4. Its model of the OS is kinder than the OS

The crash-safety task checks publish() against a model of write, fsync, rename and directory fsync. The v0.5 model let you repair a failed fsync by calling it again.

if (os->fsync_temp(os->ctx) < 0 && os->fsync_temp(os->ctx) < 0) goto abort;
v0.5: reward 1. On Linux the error is reported once and the dirty pages may already be gone; the second call returning 0 proves nothing. PostgreSQL met this in 2018.

The same model accepted fsync on a closed descriptor, injected EINTR once and only before the first byte, and injected one fault per run. The new model states its rules in the task's header, and the grader explores every schedule of short writes, interruptions and up to two I/O errors for small payloads: 382 schedules for the reference, each checked at every crash point.

5. It never asks the question it states

The descriptor task says: return non-zero when the worker fails, survive a signal during waitpid, pass exactly the authorized descriptor. The v0.5 grader never ran a failing worker and never sent a signal. Its test layout happened to put the right file at descriptor 3 in every case, so a launcher that never looked at its authorized_fd argument passed.

Five such launchers got full reward. Each requirement now has a case that fails without it, and each task has controls for the other direction too: correct solutions written differently from the reference, which must be accepted. Graded by v0.5, one of the 14 was rejected: a correct launcher built on posix_spawn.

What a pass means now

The reward is still one bit. Next to it the grader writes a receipt that says what the bit rests on, claim by claim. This is the reference solution of the egress task, graded with the kernel tier on:

  1. COMPILEDpolicy_decide compiles into the cgroup/connect4 BPF objectclang -target bpf -O2 -mcpu=v3; the preprocessed text is plain integer C
  2. PROVED WITHIN MODELfor all 2^113 inputs policy_decide equals the contract and has no undefined behaviourCBMC 5.95.1 (cbmc-5.95.1); C semantics of the BPF-preprocessed text, previously_allowed in {0,1}; loops must finish within 16 iterations
  3. TESTEDpolicy_decide returns the contract's answer27864 cases on the same text built natively: regression grid, all 1- and 2-bit neighbours of the allowed flow, 20000 fresh random cases
  4. KERNEL ACCEPTEDthe kernel verifier loads the cgroup/connect4 programLinux 7.1.4 x86_64
  5. TESTEDthe compiled BPF bytecode gives the contract's answer on every case27864 cases executed by the Linux 7.1.4 BPF runtime (BPF_PROG_TEST_RUN)
  6. TESTEDreal connect() calls follow the contract with the program attached192 connect() calls (TCP and UDP, 4 uids) from a cgroup with the program attached, Linux 7.1.4

No class implies another. The kernel verifier accepting a program says it is safe to run, not that it is right. A proof is a statement about CBMC's semantics of C, not about a compiler. The receipt also carries the artifact's SHA-256, the seed that replays the episode's hidden cases, a digest of the grader, and how the candidate was isolated. Evidence classes, what the graders defend against.

The graders are public. Nothing depends on a secret test set: hidden cases are drawn fresh for every episode, and the strongest tiers do not sample at all.

Where this fits: shirudo

shirudo is a new open-source eBPF security platform. A Linux machine runs only the BPF its operator signed, every load is measured into the TPM, and fixes ship as signed micropatches called upatches. Its front page lists agents among the people who will write them.

Its documentation is exact about where its guarantee ends. Of the signature it says: “it shows who built the upatch, not that the upatch is correct.” The kernel verifier does not close that gap. A program that drops every packet is perfectly safe.

Is it safe to run?kernel verifiermemory, bounds, termination Who built it? Is it on record?shirudosignature, attach site, TPM Is it right?this gymthe change, and nothing else a kernel fixa fleet that runs it

One task here is taken from shirudo's own tutorial, which turns the fix for an 8-bit overflow in the IPv6 RPL routing code (CVE-2026-63984) into a detector. The agent writes the detector's predicate. The grader runs all 256 argument values natively, proves the same statement with CBMC, loads the fentry program on a real kernel, and evaluates the compiled predicate for all 256 values inside the kernel through a SEC("syscall") test run, the program type shirudo itself uses for upatch self-tests.

It does not send the packet that triggers the bug. On an unfixed kernel that would corrupt memory, so the evidence for the dangerous branch is enumeration and proof, and the receipt says the hook was attached but not driven. Some properties of a mitigation cannot be tested on the system it protects.

scripts/receipt_gate.py is the small piece that goes in front of a signing key: it exits 0 only if a receipt matches the SHA-256 of the file you are about to sign and carries the evidence classes you require. The gym is independent of shirudo and not affiliated with it. More, including what is only a proposal.

Numbers

TaskReference evidenceWrong rejectedCorrect acceptedMean run
egress-policy-deltaCOMPILED PROVED WITHIN MODEL TESTED KERNEL ACCEPTED80 / 8020 / 200.3 s
fd-capability-boundaryTESTED60 / 6020 / 200.6 s
probe-designTESTED45 / 4515 / 150.2 s
quota-overflow-preservationCOMPILED PROVED WITHIN MODEL TESTED KERNEL ACCEPTED70 / 7020 / 200.3 s
upatch-rpl-predicateCOMPILED PROVED WITHIN MODEL KERNEL ACCEPTED TESTED40 / 4020 / 200.2 s
vfs-crash-atomicityMODEL CHECKED TESTED60 / 6020 / 200.5 s

470 graded runs: the reference, the starter and every control of 6 tasks on 5 fresh seeds each, kernel tier on, as root with the candidate under another uid, 46 s in total. 470 receipts validated against the schema. 48 unit tests. gcc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0, Ubuntu clang version 18.1.3 (1ubuntu1), CBMC 5.95.1 (cbmc-5.95.1). The same QA also passes on Linux 7.0, kernel tier on: 282 graded runs, 0 wrong candidates accepted.

Under Harbor 0.27.0, each task in its own verifier container: the reference agent scores 1.0 and the do-nothing agent 0.0 on all 6 tasks, and harbor lint reports nothing.

Run it

git clone https://github.com/zozo123/deltaos-gym && cd deltaos-gym
docker build -t deltaos-dev -f qa/Dockerfile.dev qa

# grade the reference, the starter, and every control of one task
docker run --rm -v "$PWD":/gym -w /gym deltaos-dev \
    python3 scripts/run_controls.py egress-policy-delta

# everything, 5 fresh seeds each; add --privileged and --kernel for the kernel tier
docker run --rm -v "$PWD":/gym -w /gym deltaos-dev python3 scripts/release_qa.py

# as Harbor tasks
harbor run -p tasks/vfs-crash-atomicity -a oracle

The graders compile and execute what they are given. Run candidates you did not write only in a container or VM you can throw away, and turn the kernel tier on only there.

Limits