Skip to content

eBPF-based security platform

skills: move the commit message rules into a commits skill

Daniel Borkmann68f46499d2d2
diff --git a/.agents/skills/coding/SKILL.md b/.agents/skills/coding/SKILL.md
index 5606a8f0..427efabc 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, when and where to split a function that grew too long, how to shape interfaces, resources, errors, types, shared state and hot paths so that a mistake has nowhere to hide, what to delete, 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.
+description: Write or change shirudo's C code, userspace or BPF, in the tree's style. Covers the kernel coding style it follows, when and where to split a function that grew too long, how to shape interfaces, resources, errors, types, shared state and hot paths so that a mistake has nowhere to hide, what to delete, 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; commit messages follow the commits skill.
---
# Coding
@@ -512,91 +512,7 @@ without a body.
## 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.
-- The length follows the reasoning, not the diff: a one-line fix can
- need three paragraphs, and deleting dead code one sentence.
-- When old code changes or goes, say why it once made sense and why
- that reason is gone, citing the commits that added it and that broke
- it.
-- State the scope: what the change deliberately leaves alone, whether
- it is the minimal fix and what the full one would be and why it waits,
- what was tested and what was not, and what would make it be undone.
-- Where a bug has a short reproducer, give it: the command or the small
- program, and what it printed.
-- Where an interface changes, show the old and the new call in a short
- snippet.
-- A mechanical change gives the exact command that made it, `git grep
- -l ... | xargs sed -i ...`, says how to review it, for instance with
- `git show -w`, and lists the cases fixed by hand.
-- A revert has the subject `Revert "<subject>"` and starts with `This
- reverts commit <hash> ("<subject>").`, then gives the symptom as
- reported, why it is reverted rather than fixed now, and what comes
- next. A partial revert says what it keeps.
-- A side note, such as advice for a backport or a nit outside the
- change, goes in a `[ ... ]` paragraph after the main text.
-
-### 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.
-```
+Load the `commits` skill before you write the commit message.
## Check
diff --git a/.agents/skills/commits/SKILL.md b/.agents/skills/commits/SKILL.md
new file mode 100644
index 00000000..178353fe
--- /dev/null
+++ b/.agents/skills/commits/SKILL.md
@@ -0,0 +1,169 @@
+---
+name: commits
+description: "Writes shirudo's commit messages and shapes a series of commits. Covers one logical change per commit, the subject `area: imperative summary` within 75 characters, a short body that says why the change is needed before what it does, charts for races and call chains, the Fixes:, Link:, Co-developed-by: and Signed-off-by: trailers, and the checks a message passes. Use before every git commit in shirudo, for code, documentation, tests, scripts and CI alike, and when rewording, splitting, reordering or squashing commits."
+---
+
+# Commits
+
+Load this skill before you commit anything.
+`Documentation/contribute/code/contributing.rst` is the reference for
+the message, the sign-off and the tags; this skill is how to apply it.
+A message is short, precise and says why the change is needed: the
+problem and its impact first, then what the change does about it. The
+diff shows what changed, so leave that out.
+
+## Before you commit
+
+1. One logical change per commit, and each commit builds and passes on
+ its own, so the history bisects. A refactor, a mechanical change and
+ a behavior change are separate commits, the refactor first. A copy
+ or a bug found along the way is fixed in a commit of its own before
+ the change that needed it.
+2. The same commit updates the pages, the skills and the proofs that
+ describe what it changes (AGENTS.md), and nothing else.
+3. Read `git log --format=%s -- <the files>` for the area prefix the
+ files take and how recent messages there read.
+4. Write the message as "The message" below says.
+5. Add the tags of "Tags". An agent never adds a `Signed-off-by:`, on
+ its own or anyone else's behalf: only a person can certify the
+ Developer's Certificate of Origin, and that line is left to the
+ human who reviews and submits the work.
+6. Check the commits, and reword until `check-style.sh` and the `awk`
+ line pass and `check-dco.sh` reports nothing but the missing
+ `Signed-off-by:`:
+
+ ```sh
+ git log --reverse --format='--- %h%n%B' origin/main..HEAD |
+ awk '/^--- /{c=$2; next} length > 75 && !/^ / && !/^[A-Z][a-z]+(-[a-z]+)*: / {print c": "$0}'
+ .github/scripts/check-style.sh origin/main..HEAD
+ .github/scripts/check-dco.sh origin/main..HEAD
+ ```
+
+ `check-style.sh` refuses a subject past 75 characters but not a long
+ body line, so the `awk` line is the only check of the body's width;
+ indented lines are quoted output and tags are never wrapped: both are
+ exempt. After editing a message by script, rewrap the whole
+ paragraph, not the line that changed. `check-dco.sh` fails until the
+ person who submits the series signs it off.
+
+## The message
+
+`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.
+
+- Where a chart explains the problem faster than prose, draw one.
+- The length follows the reasoning, not the diff: a one-line fix can
+ need three paragraphs, and deleting dead code one sentence.
+- When old code changes or goes, say why it once made sense and why
+ that reason is gone, citing the commits that added it and that broke
+ it.
+- State the scope: what the change deliberately leaves alone, whether
+ it is the minimal fix and what the full one would be and why it waits,
+ what was tested and what was not, and what would make it be undone.
+- Where a bug has a short reproducer, give it: the command or the small
+ program, and what it printed.
+- Where an interface changes, show the old and the new call in a short
+ snippet.
+- A mechanical change gives the exact command that made it, `git grep
+ -l ... | xargs sed -i ...`, says how to review it, for instance with
+ `git show -w`, and lists the cases fixed by hand.
+- A revert has the subject `Revert "<subject>"` and starts with `This
+ reverts commit <hash> ("<subject>").`, then gives the symptom as
+ reported, why it is reverted rather than fixed now, and what comes
+ next. A partial revert says what it keeps.
+- A side note, such as advice for a backport or a nit outside the
+ change, goes in a `[ ... ]` paragraph after the main text.
+
+## Tags
+
+The tags go in one block at the end, one per line, as
+`contributing.rst` defines them under "Tags".
+
+- `Fixes:` names the commit that brought the bug, by its first twelve
+ hash characters and its subject, both filled in by git, never typed:
+
+ ```sh
+ c=<commit>
+ git cat-file -e "$c" &&
+ printf 'Fixes: %s ("%s")\n' "$(git rev-parse --short=12 "$c")" \
+ "$(git log -1 --format=%s "$c")"
+ ```
+
+ Use it on every fix whose origin is known, documentation fixes
+ included. Before amending or folding a fix into an earlier commit,
+ check that the commit is not on `origin/main` yet
+ (`git merge-base --is-ancestor <commit> origin/main` exits 1): a
+ published commit gets the fix on top, with `Fixes:`.
+- `Link:` points at a report or a discussion; the message still makes
+ sense without following it. `Closes:` follows a `Reported-by:` when
+ the commit fixes the whole report.
+- `Co-developed-by:` is followed at once by that person's
+ `Signed-off-by:`, and the sign-offs keep the order of the work. A
+ contributor's commit taken over keeps its author, and a rework is
+ said in the message, not in a note between the sign-offs.
+- Every name in the author, a `Signed-off-by:` or a `Co-developed-by:`
+ is a person's full name, a given name and a surname, capitalized,
+ with an address the person answers at: `check-dco.sh` refuses a
+ handle, a given name alone, a name in lowercase, a noreply address
+ and anything called `[bot]`.
+- `Reported-by:`, `Suggested-by:` and `Cc:` may credit someone who
+ acted in public; every other tag needs that person's permission.
+
+## 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.
+```
diff --git a/AGENTS.md b/AGENTS.md
index e57d9dc3..a0d5fa55 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -9,13 +9,14 @@ not visible from the code.
Read `.agents/skills/coding/SKILL.md` and follow it before you write,
change or review any C in this tree, userspace, BPF, tests and tools
-alike, and before you write the commit message of such a change. It is
-how code here is written, with
+alike. It is how code here is written, with
`Documentation/contribute/code/coding-style.rst` that it builds on.
Claude Code loads it as the `coding` skill, Codex from `.agents/skills/`,
and an agent that does not load skills reads the file.
-Work another skill covers loads that skill as well:
+Load the `commits` skill before every commit, of code, documentation,
+tests, scripts and CI alike. Work another skill covers loads that skill
+as well:
- `testing` for tests
- `proofs` for proofs
@@ -66,7 +67,7 @@ change, and a check of whether a reported issue is real, follow the
| `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 (`reference/formats/`, including the `.upatch` container), the settings (`configuration.rst`), the eventlog, 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, 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. |
+| `.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/`, `commits` writes commit messages and shapes a series, `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
@@ -118,20 +119,21 @@ 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,
-the helpers to use and the commit message that carries a change:
-`.agents/skills/coding/SKILL.md` is the reference, and the "Before you
-write code" section above has you load and follow it.
+alike. The `coding` skill gives these conventions with their reasons
+and the helpers to use: `.agents/skills/coding/SKILL.md` is the
+reference, and the "Before you write code" section above has you load
+and follow it.
-Coding conventions, helpers, patterns, and commit message format belong
-in the `coding` skill, not here. This file documents architecture,
-invariants, and project policies; the skill documents how to write C.
+Coding conventions, helpers and patterns belong in the `coding` skill,
+the commit message format in the `commits` skill, not here. This file
+documents architecture, invariants, and project policies; the skills
+document how to write C and how to commit it.
## Commits
Every commit follows `Documentation/contribute/code/contributing.rst` and
-the commit message format in the `coding` skill. One logical change per
-commit, each one building and passing on its own.
+the `commits` skill, which an agent loads before it commits. One logical
+change per commit, each one building and passing on its own.
An agent never adds a `Signed-off-by:`, on its own or anyone else's
behalf: only a person can give one, and that line is left to the human