Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/interplane-forge/blob/main/infra/test/seccomp-table.py # interplane-forge INTERPLANE Forge Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `interplane-forge / infra / test / seccomp-table.py` 120 lines ยท 5409 bytes Raw Blame History 1 #!/usr/bin/env python3 2 """Run forged-seccomp.bpf, as data, over a table of system calls and compare each result. 3 4 Usage: seccomp-table.py FILTER.bpf 5 This is an interpreter for the classic BPF subset the filter uses (LD W ABS, JEQ K, RET K). It 6 does not trust forged-seccomp.om's notes: every row says what the sandbox needs, and the program 7 must give exactly that. Exit 0 when every row matches, 1 on a mismatch, 2 on a malformed program. 8 The kernel is the real judge; infra/test/listener-poison.py and leakprobe check the installed 9 filter. This table catches a wrong jump count or a missing rule before anything runs. 10 """ 11 import struct 12 import sys 13 14 AARCH64 = 0xC00000B7 15 ALLOW, EPERM, KILL = 0x7FFF0000, 0x00050001, 0x80000000 16 NAMES = {ALLOW: "allow", EPERM: "EPERM", KILL: "kill"} 17 18 19 def load(path): 20 raw = open(path, "rb").read() 21 if not raw or len(raw) % 8: 22 sys.exit(f"seccomp-table: {path}: {len(raw)} bytes is not a whole program") 23 return [struct.unpack(" 4096: 33 sys.exit("seccomp-table: loop") 34 code, jt, jf, k = prog[pc] 35 if code == 0x20: # BPF_LD | BPF_W | BPF_ABS 36 acc = struct.unpack_from("