eBPF-based security platform
agents: write commit messages and charts by the coding skill
Daniel Borkmann672fdd43587f
diff --git a/.agents/skills/coding/SKILL.md b/.agents/skills/coding/SKILL.mdindex 704b95c3..cbc664c7 100644--- a/.agents/skills/coding/SKILL.md+++ b/.agents/skills/coding/SKILL.md@@ -1,6 +1,6 @@---name: coding-description: Write or change shirudo's C code, userspace or BPF, in the tree's style. Covers the kernel coding style it follows, where a comment belongs and where it is clutter, the helpers in util/ and include/shirudo/ to use instead of libc or open code, moving code two places need into util/, memory, secrets, JSON and logging, and the checks a change passes. Use whenever writing, changing or reviewing C in shirudo.+description: Write or change shirudo's C code, userspace or BPF, in the tree's style. Covers the kernel coding style it follows, where a comment belongs and where it is clutter, the helpers in util/ and include/shirudo/ to use instead of libc or open code, moving code two places need into util/, memory, secrets, JSON and logging, the commit message that carries the change, with a chart where one explains it faster, and the checks a change passes. Use whenever writing, changing or reviewing C in shirudo.---# Coding@@ -55,13 +55,19 @@ Code says what it does; a comment is for what it cannot say.the copyright, `Copyright (c) 2026 Authors of shirudo`, and at mostfive lines on what the file holds. Nothing more at the top.- In a function, almost never. Write one only for the why a reader- cannot get from the code: an invariant kept elsewhere, a kernel or- library quirk ("zlib 1.3.2 reads past the end of a member"), the- reason the obvious way is wrong here. One or two sentences, before the- code it explains.+ cannot get from the code: an invariant kept elsewhere, a locking rule+ or an order two steps must keep, a kernel or library quirk ("zlib+ 1.3.2 reads past the end of a member"), the reason the obvious way is+ wrong here. Before the code it explains, as short as it can be+ without cutting the reasoning: usually a sentence or two, and what a+ lock or a race needs to be understood, however many that takes.- Never what the code does, what a name already says, or what a message- prints; never history ("added for", "was", "used by"), which goes in- the commit message; never code commented out.+ prints; never history or narration of the change ("added for",+ "was", "used by", "fix for", "new helper to"), which goes in the+ commit message; never code commented out.+- Drop a comment that carries nothing only in the lines the change adds+ or touches. Leave the comments of code the change does not touch+ alone, even where you would write them shorter.- A function's contract goes above its declaration in the header, andonly when the prototype does not tell it: what it returns on whichfailure, what it owns or frees, what it refuses.@@ -174,6 +180,73 @@ code, signing and the package builder, stays out of the core binary.- BPF code is CO-RE, built for `-mcpu=v4`; upatch code follows the`upatch` and `bpf-concurrency` skills.+## Commit messages++`Documentation/contribute/code/contributing.rst` sets the form: the+subject `area: imperative summary`, specific ("seal: refuse the+runtime to a task that shares its file system context", not "seal:+fixes") and at most 75 characters; the body wrapped at 75 columns, the+problem and its impact before the change. Write it for a reviewer who+reads it once:++- Short, plain sentences, one idea each. No filler and no long+ background; drop any sentence the reviewer does not need to+ understand the problem or the fix.+- Plain paragraphs for a simple bug. `[BUG]`, `[CAUSE]` and `[FIX]`+ headings only where the symptom, the cause and the fix each take+ several paragraphs.+- Quote what a program printed, an error, a log line or a call trace,+ as it printed it: quoted text has no column limit and is never+ folded.+- Read `git log -- <the files>` for the recent messages of the area+ before writing one.+- Where a chart explains the problem faster than prose, draw one.++### Charts++An ASCII chart earns its place for:++- a race: show the window, side by side, rather than describe it;+- an error path seen from several callers, where one cleans up what+ another already did;+- a call chain across layers where the bug shows on one path only;+- the order of steps, as in a load's pins, archive and extend, or+ `init`'s phases.++Function names only, no file paths or line numbers, and only the+functions that matter. A state or an outcome goes in plain words under+the function name. A race takes one column per racing context: a+command, root, a CPU, a kworker.++A race, a load that root stops between its pins and its extend:++```+ shirudo upatch load root+ upatch_load()+ |-upatch_apply()+ | \-attach_and_pin_progs()+ | The links are attached+ | kill -9 <pid>+ | The load ends here+ \-upatch_chain_event_locked()+ Never runs: pins without a record in the register.+```++A call chain where the bug shows on one path, an exec that fails past+its point of no return:++```+ load_elf_binary()+ |-begin_new_exec()+ | \-security_bprm_committed_creds()+ | The task now holds runtime authority+ |+ \-create_elf_tables()+ Fails: SIGSEGV, and the core dump runs as the task+ \-coredump_file()+ Unlinks the core_pattern path with that authority.+```+## CheckA warning fails the build, so fix it rather than silence it. Build withdiff --git a/AGENTS.md b/AGENTS.mdindex ce064e0e..2be6cbfb 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -47,7 +47,7 @@ Before changing security-relevant code, read| `Documentation/upatches/` | Authoring and shipping upatches: attach kinds, maps and serializers, decoders, the Beefile, publishing, debugging a failed load. || `Documentation/reference/` | Every command (`reference/cli/`), the formats and settings (`reference/formats/`, including the `.upatch` container), failure categories and exit status, files, units, environment variables, the cheat sheet. || `Documentation/contribute/` | Developer guide, test tiers and the test VM (read `testing.rst` before adding or moving a test), test coverage, the kernel coding style, commits and sign-off (read `contributing.rst` before crafting a commit), and the documentation style guide `writing-docs.rst`. |-| `.agents/skills/` | Skills for coding agents in the `SKILL.md` format of agentskills.io, which Codex reads there and Claude Code through the `.claude/skills` link: `coding` writes C in the tree's style and grows `util/`, `testing` runs the test tiers and the test VM, `pre-submit` the checks CI runs on a series, `upatch` writes for the target's preemption model and a low cost, builds, packages and publishes an upatch, `bpf-concurrency` checks upatch code whose runs share state, `bpf-coccinelle` runs and extends the Coccinelle rules for it, `docs` finds and checks the pages a change touches, `fuzz-target` adds a libFuzzer target for a parser, `proofs` runs and writes the CBMC and Lean 4 proofs, `security-audit` audits the tree against the threat model, and the threat model and the proofs against the tree. |+| `.agents/skills/` | Skills for coding agents in the `SKILL.md` format of agentskills.io, which Codex reads there and Claude Code through the `.claude/skills` link: `coding` writes C in the tree's style, grows `util/` and writes its commit messages, `testing` runs the test tiers and the test VM, `pre-submit` the checks CI runs on a series, `upatch` writes for the target's preemption model and a low cost, builds, packages and publishes an upatch, `bpf-concurrency` checks upatch code whose runs share state, `bpf-coccinelle` runs and extends the Coccinelle rules for it, `docs` finds and checks the pages a change touches, `fuzz-target` adds a libFuzzer target for a parser, `proofs` runs and writes the CBMC and Lean 4 proofs, `security-audit` audits the tree against the threat model, and the threat model and the proofs against the tree. |The kernel side of the signing design is the kernel's own`Documentation/bpf/signing.rst`; `bpf_prog_verify_signature()` runs@@ -93,8 +93,10 @@ package for `bpm info`.C follows the kernel coding style,`Documentation/contribute/code/coding-style.rst`, in userspace and BPF-alike; the `coding` skill gives these conventions with their reasons and-the helpers to use.+alike; the `coding` skill gives these conventions with their reasons,+the helpers to use and the commit message that carries a change. Load+it before writing, changing or reviewing C, and before writing the+commit message of a change to C.- Plain C, no C++. Zero-initialise with `= {}`. Integers are `__u8` to`__u64` and `__s8` to `__s64`; a system header that uses `uint8_t` and