返回资讯中心
外部精选
软件工程
#开发者实时流

DeltaOS Gym 发布:用形式化证明和内核测试评分的 Linux/eBPF 编码任务

来源标题:Show HN: DeltaOS Gym – Linux/eBPF coding tasks graded by proofs and kernel tests

DeltaOS Gym 1.0.0 发布,包含六个 Harbor 任务,要求编码代理对 Linux 或 eBPF 代码做精确的单点修改。每个任务采用最严格的验证方式评分,包括 CBMC 全输入证明、故障调度穷举模型检查、真实 Linux 运行以及内核验证器加载并逐例运行编译后的 BPF。评分器本身也经过测试:初版拒绝了 20 个预置 bug,并对另外 27 个错误答案全部给出满分,页面说明了改进方案。

Hacker News 最新zozo123-IB-IL22026/11/24 · 今天24 分钟阅读

以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。

DeltaOS Gym 1.0.0 · Harbor tasks · MIT

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.

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

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

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.

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.

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.

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.

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.

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:

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.

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.

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.

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.

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.

DeltaOS Gym 1.0.0 · by Yossi Eliaz · MIT · github.com/zozo123/deltaos-gym · generated from qa/reports/ on 2026-11-24.

shirudo is a project of its own authors (BSD-2-Clause). The CVE example and the detector's shape come from its tutorial From a kernel fix to a upatch.

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →