Repository navigation
feat(kernel): Publish the kernel's GPL source - #8
Conversation
|
@claude-fleet review |
|
Review task queued. Task: 4994300c-8a80-4216-80d4-b2a9b2e20dc3 |
There was a problem hiding this comment.
Request changes: one should_fix.
The design holds up. I staged the source tree locally (stub docker, so only the host half ran) and confirmed build.tar.gz is self-sufficient: build-kernel.sh reads nothing from the repo except PINS, itself, kernel/keys and the EXTRA_* paths, and all four are staged. The $PWD in the rebuild command survives the heredoc literally, and the tarball bytes that ship are the ones already past the sha256 and gpgv gates.
Findings:
- should_fix, oci/push-bundle.sh:86 — the new required
KERNEL_SOURCEbreaksmake push, which the README documents - nit, .github/workflows/build-kernel.yml:205 —
-sourceis annotatedGPL-2.0-onlywhilebuild.tar.gzholds Apache-2.0 scripts - nit, README.md:279 —
make kernelwritesdist/<arch>/source/, notdist/source/ - nit, oci/push-bundle.sh:87 — the guard accepts an empty digest
- nit, kernel/build-kernel.sh:811 — a failed build leaves
$OUT/.source-treebehind
Verified:
build.tar.gzis complete for the rebuild command: the script's only repo inputs arePINS(build-kernel.sh:119), itself,kernel/keys(build-kernel.sh:567) and theEXTRA_*paths, all staged at build-kernel.sh:515-522- the shipped tarball and
.signare the verified bytes: thecpis after the sha256 check andgpgv(build-kernel.sh:609-629) - the example job's
grep -qxF ./kernel/build-kernel.shmatches what tar stores:-C /srctree -cf - .yields./-prefixed names (build-kernel.sh:790) SOURCE_DIGESTreaches the signing step throughGITHUB_ENV(build-kernel.yml:217, 264), and the source is resolved through the immutable-sourcetag, not a moving one- the pre-annotation kernel does not break main: build-kernel.sh is in the inputs hash (inputs-hash.sh:40), so the merge republishes both kernels, and until that lands a publishing
build-assetsrun skips rather than bundling (build-assets.yml:186-192). On a PR theminimal-$ARCHfallback (build-assets.yml:197-199) can yield an empty annotation, butPUBLISHis false there sopush-bundle.shnever runs (build-assets.yml:265) - README's
URUNIT_REFreference matches PINS:48
Checks run:
- staged the example variant with a stub
dockerandJOBS=1→dist/source/SOURCErenders the pinned sha256 andARCH=x86_64 PROFILE=minimal EXTRA_CONFIG=$PWD/extra/config/1-example.config EXTRA_SRC=$PWD/extra/src/example_hello, and.source-treecontainsPINS,kernel/{build-kernel.sh,inputs-hash.sh,keys},extra/{config,src} ./oci/push-bundle.sh linux-arm64 /tmp/dd 0.0.0withKERNEL_SOURCEunset → exit 1; with…guest-kernel:minimal-arm64→ exit 1; witha/b@sha256:→ passes the guard- the same run with no
KERNEL_SOURCEreproduces themake pushfailure
Smaller things:
- the
build.tar.gzfile list now lives in four places — build-kernel.sh:94-96, theSOURCEheredoc at build-kernel.sh:541-544, README.md:258 and the check at build-kernel.yml:316-317 — and two of them omitinputs-hash.sh, which the archive does contain. One list with pointers would keep them honest. - the kernel digest gets a
cosign verifyself-check right after signing (build-kernel.yml:269-273); the source digest only getscosign sign(build-kernel.yml:264). The README says all three are signed, which is true, but the source is the one whose identity nobody exercises here. SOURCEdoes not nameBUILDER_IMG, so a non-Rust rebuild resolvesdebian:bookworm-slimat whatever that tag points to then. Not a GPL concern, but it is the one input the rebuild command cannot pin.
Not checked:
shellcheckis not installed here, somake lintover the changed scripts did not run- no registry was reachable, so
oras push/oras resolve/oras manifest fetchand the annotation round-trip are taken from the description's replay against a local registry - no kernel was compiled: the container half of build-kernel.sh (the
cpinto/out/source,cp .config /out/source/config, thetar | gzip) was read, not executed
Not checked:
make lint/ shellcheck over the changed scripts: shellcheck is not installed in this environment- the registry round-trip:
oras push,oras resolveandoras manifest fetchof the-sourcetag and thesh.brig.hull-kernel.sourceannotation lookup, taken from the description's local-registry replay - the container half of kernel/build-kernel.sh (the
cpof the tarball and.configinto /out/source, and thetar | gzipof /srctree) was read but not executed; no kernel was compiled - cosign signing and verification of the new
-sourcedigest
Task 4994300c-8a80-4216-80d4-b2a9b2e20dc3 on ravel-clickbench-ubuntu-2, model claude-opus-5, effort medium.
| if [ "${COSIGN_SIGN:-0}" = "1" ]; then | ||
| command -v cosign >/dev/null || { echo "ERROR: cosign is required when COSIGN_SIGN=1" >&2; exit 1; } | ||
| fi | ||
| case "${KERNEL_SOURCE:-}" in |
There was a problem hiding this comment.
should_fix: Making KERNEL_SOURCE required breaks make push, which the README documents, because the Makefile target never sets it and no documentation names the variable.
Failure: make push PLATFORM=darwin-arm64 (README.md:113) exits 1 with ERROR: KERNEL_SOURCE is '' before it looks at the dist directory, and the hint points at build-kernel.yml, which is not something a local publisher runs. This hits exactly the case README.md:279-282 invites: someone publishing a variant built from these scripts.
Evidence: Makefile:68-70 invokes oci/push-bundle.sh $(PLATFORM) $(DIST) $(VERSION) with no KERNEL_SOURCE in its environment; I ran ./oci/push-bundle.sh linux-arm64 /tmp/dd 0.0.0 with it unset and got that exit 1. The guard is also above the cd "$dist" at oci/push-bundle.sh:96 and above the already-published early exit at oci/push-bundle.sh:134-138, so a re-run of a commit that is already published now fails instead of being a no-op.
Fix: pass it through in the Makefile (KERNEL_SOURCE="$(KERNEL_SOURCE)") with a #? flag line, and name it in the README's publish step.
| "$REGISTRY/$KERNEL_REPO:$TAG-source" \ | ||
| --artifact-type application/vnd.nofire.hull-kernel.source.v1 \ | ||
| --annotation "org.opencontainers.image.source=https://github.com/brig-sh/boot-assets" \ | ||
| --annotation "org.opencontainers.image.licenses=GPL-2.0-only" \ |
There was a problem hiding this comment.
nit: The -source artifact is annotated org.opencontainers.image.licenses=GPL-2.0-only, but it carries Apache-2.0 files too.
Failure: a consumer reading the annotation on guest-kernel:<tag>-source is told the whole artifact is GPL-2.0-only, while build.tar.gz contains kernel/build-kernel.sh, kernel/inputs-hash.sh and PINS, which LICENSE and README.md:244-245 put under Apache-2.0. The bundle push got a compound expression for the same reason (oci/push-bundle.sh:154); this push did not.
Evidence: kernel/build-kernel.sh:515-517 stages the Apache-2.0 scripts into the archive; .github/workflows/build-kernel.yml:205 annotates the artifact that contains it.
Fix: GPL-2.0-only AND Apache-2.0.
| cat kernel-source/SOURCE | ||
| ``` | ||
|
|
||
| `make kernel` writes the same files to `dist/source/`. Whoever publishes a |
There was a problem hiding this comment.
nit: make kernel does not write dist/source/.
Failure: a reader following this line looks in dist/source/ and finds nothing; the files are in dist/<arch>/source/.
Evidence: Makefile:28 sets DIST ?= $(CURDIR)/dist/$(ARCH) and Makefile:43 passes OUT=$(DIST), and build-kernel.sh writes $OUT/source.
| command -v cosign >/dev/null || { echo "ERROR: cosign is required when COSIGN_SIGN=1" >&2; exit 1; } | ||
| fi | ||
| case "${KERNEL_SOURCE:-}" in | ||
| */*@sha256:*) ;; |
There was a problem hiding this comment.
nit: The */*@sha256:* pattern accepts a digest-less reference.
Failure: KERNEL_SOURCE=a/b@sha256: passes the guard and lands verbatim in bundle.json (oci/push-bundle.sh:116) and in sh.brig.hull-assets.kernel-source (oci/push-bundle.sh:156), so the bundle advertises a source location nothing can resolve. I ran that value and the script proceeded past the guard to the dist-file check. Today the value comes from an annotation this repo wrote, so this is narrow and the failure direction is safe; it just does not catch what the error message claims to.
Fix: */*@sha256:[0-9a-f][0-9a-f]*) with a length check, or validate against the 64-hex form.
| ls -l "/out/$KERNEL_OUT" | ||
| ' | ||
|
|
||
| rm -rf "$src_tree" |
There was a problem hiding this comment.
nit: rm -rf "$src_tree" runs only after a successful container build, so a failed build leaves the staging tree in the output directory.
Failure: with set -e, a non-zero docker run exits before this line and $OUT/.source-tree stays behind. I reproduced it with a stub docker that exits 7: /tmp/d1/.source-tree was still fully populated afterwards. Harmless on CI (the uploads and oras push both name files explicitly, and the next run's rm -rf at kernel/build-kernel.sh:513 cleans it), but it is a 40KB surprise in a local dist/ after every failed build.
Evidence: kernel/build-kernel.sh:512-513 creates it, kernel/build-kernel.sh:558 is the command that can fail, kernel/build-kernel.sh:811 is the cleanup.
Fix: a trap 'rm -rf "$src_tree"' EXIT after the mkdir.
3bb92a1 to
9dec10f
Compare
|
@claude-fleet review |
|
Review task queued. Task: ef383fd6-1104-4b2b-9e9d-02d5dcd3bf70 |
There was a problem hiding this comment.
Previous round at 3bb92a1: 5 findings.
| Previous finding | Classification | Cited line |
|---|---|---|
oci/push-bundle.sh:86 (should_fix): Making KERNEL_SOURCE required breaks make push, which the README documents, because the Makefile target never sets it and no documentation names the variable. Failure: make push PLATFORM=darwin-arm64 (README.md:113) exits 1 with ERROR: KERNEL_SOURCE is '' before it looks at the dist directory, and the hint points at build-kernel.yml, which is not something a local publisher runs. This hits exactly the case README.md:279-282 invites: someone publishing a variant built from these scripts. Evidence: Makefile:68-70 invokes oci/push-bundle.sh $(PLATFORM) $(DIST) $(VERSION) with no KERNEL_SOURCE in its environment; I ran ./oci/push-bundle.sh linux-arm64 /tmp/dd 0.0.0 with it unset and got that exit 1. The guard is also above the cd "$dist" at oci/push-bundle.sh:96 and above the already-published early exit at oci/push-bundle.sh:134-138, so a re-run of a commit that is already published now fails instead of being a no-op. Fix: pass it through in the Makefile (KERNEL_SOURCE="$(KERNEL_SOURCE)") with a #? flag line, and name it in the README's publish step. |
fixed | oci/push-bundle.sh:134 |
.github/workflows/build-kernel.yml:205 (nit): The -source artifact is annotated org.opencontainers.image.licenses=GPL-2.0-only, but it carries Apache-2.0 files too. Failure: a consumer reading the annotation on guest-kernel:<tag>-source is told the whole artifact is GPL-2.0-only, while build.tar.gz contains kernel/build-kernel.sh, kernel/inputs-hash.sh and PINS, which LICENSE and README.md:244-245 put under Apache-2.0. The bundle push got a compound expression for the same reason (oci/push-bundle.sh:154); this push did not. Evidence: kernel/build-kernel.sh:515-517 stages the Apache-2.0 scripts into the archive; .github/workflows/build-kernel.yml:205 annotates the artifact that contains it. Fix: GPL-2.0-only AND Apache-2.0. |
fixed | .github/workflows/build-kernel.yml:205 |
README.md:279 (nit): make kernel does not write dist/source/. Failure: a reader following this line looks in dist/source/ and finds nothing; the files are in dist/<arch>/source/. Evidence: Makefile:28 sets DIST ?= $(CURDIR)/dist/$(ARCH) and Makefile:43 passes OUT=$(DIST), and build-kernel.sh writes $OUT/source. |
fixed | README.md:283 |
oci/push-bundle.sh:87 (nit): The */*@sha256:* pattern accepts a digest-less reference. Failure: KERNEL_SOURCE=a/b@sha256: passes the guard and lands verbatim in bundle.json (oci/push-bundle.sh:116) and in sh.brig.hull-assets.kernel-source (oci/push-bundle.sh:156), so the bundle advertises a source location nothing can resolve. I ran that value and the script proceeded past the guard to the dist-file check. Today the value comes from an annotation this repo wrote, so this is narrow and the failure direction is safe; it just does not catch what the error message claims to. Fix: */*@sha256:[0-9a-f][0-9a-f]*) with a length check, or validate against the 64-hex form. |
fixed | oci/push-bundle.sh:134 |
kernel/build-kernel.sh:811 (nit): rm -rf "$src_tree" runs only after a successful container build, so a failed build leaves the staging tree in the output directory. Failure: with set -e, a non-zero docker run exits before this line and $OUT/.source-tree stays behind. I reproduced it with a stub docker that exits 7: /tmp/d1/.source-tree was still fully populated afterwards. Harmless on CI (the uploads and oras push both name files explicitly, and the next run's rm -rf at kernel/build-kernel.sh:513 cleans it), but it is a 40KB surprise in a local dist/ after every failed build. Evidence: kernel/build-kernel.sh:512-513 creates it, kernel/build-kernel.sh:558 is the command that can fail, kernel/build-kernel.sh:811 is the cleanup. Fix: a trap 'rm -rf "$src_tree"' EXIT after the mkdir. |
fixed | kernel/build-kernel.sh:515 |
All five findings from the last round are fixed. One new one, in the same license-compliance area.
Request changes: one should_fix finding.
Findings:
- should_fix, kernel/build-kernel.sh:517 —
build.tar.gzdeclares Apache-2.0 but ships no copy of the Apache license
Previous round:
- 1 (KERNEL_SOURCE breaks
make push) — fixed. Makefile:72 passes it through, Makefile:25-26 declares it with a#?line, README.md:113 and README.md:286-290 name it. The guard also moved to oci/push-bundle.sh:134, belowcd "$dist"(91), the dist-file loop (92-94) and the already-published early exit (129-133), so an already-published re-run is a no-op again. - 2 (
-sourcelicense annotation) — fixed, .github/workflows/build-kernel.yml:205 is nowGPL-2.0-only AND Apache-2.0, and README.md:268-269 says why. - 3 (
dist/source/) — fixed, README.md:283. - 4 (digest-less reference accepted) — fixed, the 64-hex regex at oci/push-bundle.sh:134 rejects
a/b@sha256:. - 5 (staging tree left after a failed build) — fixed,
trapat kernel/build-kernel.sh:515.
Verified:
- The source push runs before the kernel push and under its own tag, and both the push and the sign/verify steps carry the same
exists != 'true'condition, soSOURCE_DIGESTis never read unset — build-kernel.yml:177, 207-215, 251-258. build.tar.gzis self-contained for the rebuild inSOURCE: build-kernel.sh reads only$repo_root/PINS(line 119) and$here/keys, both staged at build-kernel.sh:516-518.ARCHis normalized (build-kernel.sh:145-161) before the rebuild line is composed at build-kernel.sh:519, so the command inSOURCEuses an accepted value.$extra_dir/configand$extra_dir/srcalways exist (build-kernel.sh:495), so thecp -Rat build-kernel.sh:523 cannot fail for a config-only variant.kernel/build-kernel.shis in the inputs hash (kernel/inputs-hash.sh:40), so merging does produce new kernel tags that carry the annotation.push-bundle.shhas no other caller than Makefile:72 and build-assets.yml:284.
Checks run:
- Regex at oci/push-bundle.sh:134 against six values: rejects ``,
a/b@sha256:, a 63-hex digest, `ghcr.io/x/y:tag`, and a trailing-garbage form; accepts the 64-hex form. oci/push-bundle.sh linux-arm64 /tmp/dd 0.0.0withKERNEL_SOURCEunset, stuboras, populated dist: reaches the guard only after writingbundle.json, i.e. past the dist checks. Previously it exited before them.OUT=/tmp/d1 ARCH=x86_64 kernel/build-kernel.shwith a stubdockerexiting 7: exit 7, and/tmp/d1/.source-treeis gone.
Smaller things:
- A failed guard at oci/push-bundle.sh:134 leaves
bundle.jsonin the dist directory with"source": ""(written at line 98-117). Nothing publishes it and the next run overwrites it, but moving the guard above the heredoc would cost nothing. grep -Eqat oci/push-bundle.sh:134 matches per line, so aKERNEL_SOURCEwith an embedded newline whose first line is well-formed passes and the rest lands in the annotation at line 157. The value comes from an annotation this repo wrote, so this is narrow.$OUT/.extra(build-kernel.sh:493) has no equivalent of the newtrapand still survives a failed build. Pre-existing, outside this diff.
Not checked:
- No registry,
orasorcosignin this workspace, so the pushes,oras resolve, the annotation lookup at build-assets.yml:222-223 and the cosign loop were read, not run. - No kernel build was run, so
dist/source/contents, thetar -tzfpaths the example job greps for (build-kernel.yml:317-320), and the rebuild frombuild.tar.gzare taken from the PR description's test report.
Not checked:
- The oras/cosign pushes,
oras resolve, thesh.brig.hull-kernel.sourceannotation lookup at .github/workflows/build-assets.yml:222-223 and the cosign verify loop: no registry, oras or cosign in this workspace, so these were read rather than run. - The actual contents of dist/source/ and build.tar.gz, the tar entry paths the example job greps for (.github/workflows/build-kernel.yml:317-320), and the rebuild-from-build.tar.gz claim: no kernel build was run, so these rest on the PR description's test report.
Task ef383fd6-1104-4b2b-9e9d-02d5dcd3bf70 on pimox5, model claude-opus-5, effort medium.
| mkdir -p "$src_tree/kernel" "$OUT/source" | ||
| trap 'rm -rf "$src_tree"' EXIT | ||
| cp "$repo_root/PINS" "$src_tree/" | ||
| cp "$here/build-kernel.sh" "$here/inputs-hash.sh" "$src_tree/kernel/" |
There was a problem hiding this comment.
should_fix: build.tar.gz is distributed as Apache-2.0 but contains no copy of the Apache license.
Failure: a consumer pulls guest-kernel:<tag>-source, reads org.opencontainers.image.licenses=GPL-2.0-only AND Apache-2.0 (.github/workflows/build-kernel.yml:205), unpacks build.tar.gz, and gets kernel/build-kernel.sh, kernel/inputs-hash.sh and PINS with no license text and no attribution notice. Apache-2.0 section 4(a) requires a copy of the License to go with the Work; SOURCE does not mention Apache-2.0 either, it says only "The kernel is licensed GPL-2.0-only" (kernel/build-kernel.sh:533). This is the one piece of the licensing story the PR declares and does not ship.
Evidence: the staging tree is built at kernel/build-kernel.sh:514-523 from PINS, kernel/build-kernel.sh, kernel/inputs-hash.sh, kernel/keys and extra/ only; the repo's LICENSE (Apache-2.0, repo root) is not among them, and tar -C /srctree -cf - at kernel/build-kernel.sh:793-794 packs exactly that tree. README.md:245 puts those scripts under Apache-2.0.
Fix: cp "$repo_root/LICENSE" "$src_tree/" beside line 516, and a line in the build.tar.gz block of SOURCE saying the build scripts are Apache-2.0 and LICENSE is their license.
|
@claude-fleet review |
9dec10f to
37c34ac
Compare
|
Review task queued. Task: 5a78057a-ba0f-41fc-81c5-b1187ef68f57 |
There was a problem hiding this comment.
Previous round at 9dec10f: 6 findings.
| Previous finding | Classification | Cited line |
|---|---|---|
oci/push-bundle.sh:134 (should_fix): Making KERNEL_SOURCE required breaks make push, which the README documents, because the Makefile target never sets it and no documentation names the variable. Failure: make push PLATFORM=darwin-arm64 (README.md:113) exits 1 with ERROR: KERNEL_SOURCE is '' before it looks at the dist directory, and the hint points at build-kernel.yml, which is not something a local publisher runs. This hits exactly the case README.md:279-282 invites: someone publishing a variant built from these scripts. Evidence: Makefile:68-70 invokes oci/push-bundle.sh $(PLATFORM) $(DIST) $(VERSION) with no KERNEL_SOURCE in its environment; I ran ./oci/push-bundle.sh linux-arm64 /tmp/dd 0.0.0 with it unset and got that exit 1. The guard is also above the cd "$dist" at oci/push-bundle.sh:96 and above the already-published early exit at oci/push-bundle.sh:134-138, so a re-run of a commit that is already published now fails instead of being a no-op. Fix: pass it through in the Makefile (KERNEL_SOURCE="$(KERNEL_SOURCE)") with a #? flag line, and name it in the README's publish step. |
fixed | Makefile:72 |
.github/workflows/build-kernel.yml:205 (nit): The -source artifact is annotated org.opencontainers.image.licenses=GPL-2.0-only, but it carries Apache-2.0 files too. Failure: a consumer reading the annotation on guest-kernel:<tag>-source is told the whole artifact is GPL-2.0-only, while build.tar.gz contains kernel/build-kernel.sh, kernel/inputs-hash.sh and PINS, which LICENSE and README.md:244-245 put under Apache-2.0. The bundle push got a compound expression for the same reason (oci/push-bundle.sh:154); this push did not. Evidence: kernel/build-kernel.sh:515-517 stages the Apache-2.0 scripts into the archive; .github/workflows/build-kernel.yml:205 annotates the artifact that contains it. Fix: GPL-2.0-only AND Apache-2.0. |
fixed | .github/workflows/build-kernel.yml:205 |
README.md:283 (nit): make kernel does not write dist/source/. Failure: a reader following this line looks in dist/source/ and finds nothing; the files are in dist/<arch>/source/. Evidence: Makefile:28 sets DIST ?= $(CURDIR)/dist/$(ARCH) and Makefile:43 passes OUT=$(DIST), and build-kernel.sh writes $OUT/source. |
fixed | README.md:283 |
oci/push-bundle.sh:134 (nit): The */*@sha256:* pattern accepts a digest-less reference. Failure: KERNEL_SOURCE=a/b@sha256: passes the guard and lands verbatim in bundle.json (oci/push-bundle.sh:116) and in sh.brig.hull-assets.kernel-source (oci/push-bundle.sh:156), so the bundle advertises a source location nothing can resolve. I ran that value and the script proceeded past the guard to the dist-file check. Today the value comes from an annotation this repo wrote, so this is narrow and the failure direction is safe; it just does not catch what the error message claims to. Fix: */*@sha256:[0-9a-f][0-9a-f]*) with a length check, or validate against the 64-hex form. |
fixed | oci/push-bundle.sh:134 |
kernel/build-kernel.sh:515 (nit): rm -rf "$src_tree" runs only after a successful container build, so a failed build leaves the staging tree in the output directory. Failure: with set -e, a non-zero docker run exits before this line and $OUT/.source-tree stays behind. I reproduced it with a stub docker that exits 7: /tmp/d1/.source-tree was still fully populated afterwards. Harmless on CI (the uploads and oras push both name files explicitly, and the next run's rm -rf at kernel/build-kernel.sh:513 cleans it), but it is a 40KB surprise in a local dist/ after every failed build. Evidence: kernel/build-kernel.sh:512-513 creates it, kernel/build-kernel.sh:558 is the command that can fail, kernel/build-kernel.sh:811 is the cleanup. Fix: a trap 'rm -rf "$src_tree"' EXIT after the mkdir. |
fixed | kernel/build-kernel.sh:516 |
kernel/build-kernel.sh:517 (should_fix): build.tar.gz is distributed as Apache-2.0 but contains no copy of the Apache license. Failure: a consumer pulls guest-kernel:<tag>-source, reads org.opencontainers.image.licenses=GPL-2.0-only AND Apache-2.0 (.github/workflows/build-kernel.yml:205), unpacks build.tar.gz, and gets kernel/build-kernel.sh, kernel/inputs-hash.sh and PINS with no license text and no attribution notice. Apache-2.0 section 4(a) requires a copy of the License to go with the Work; SOURCE does not mention Apache-2.0 either, it says only "The kernel is licensed GPL-2.0-only" (kernel/build-kernel.sh:533). This is the one piece of the licensing story the PR declares and does not ship. Evidence: the staging tree is built at kernel/build-kernel.sh:514-523 from PINS, kernel/build-kernel.sh, kernel/inputs-hash.sh, kernel/keys and extra/ only; the repo's LICENSE (Apache-2.0, repo root) is not among them, and tar -C /srctree -cf - at kernel/build-kernel.sh:793-794 packs exactly that tree. README.md:245 puts those scripts under Apache-2.0. Fix: cp "$repo_root/LICENSE" "$src_tree/" beside line 516, and a line in the build.tar.gz block of SOURCE saying the build scripts are Apache-2.0 and LICENSE is their license. |
fixed | kernel/build-kernel.sh:517 |
No longer carried to the next round, settled in rounds 2 and 3:
- oci/push-bundle.sh:134 (should_fix): Making
KERNEL_SOURCErequired breaksmake push, which the README documents, because the Makefile target never sets it and no documentation names the variable. Failure:make push PLATFORM=darwin-arm64(README.md:113) exits 1 withERROR: KERNEL_SOURCE is ''before it looks at the dist directory, and the hint points at build-kernel.yml, which is not something a local publisher runs. This hits exactly the case README.md:279-282 invites: someone publishing a variant built from these scripts. Evidence: Makefile:68-70 invokesoci/push-bundle.sh $(PLATFORM) $(DIST) $(VERSION)with noKERNEL_SOURCEin its environment; I ran./oci/push-bundle.sh linux-arm64 /tmp/dd 0.0.0with it unset and got that exit 1. The guard is also above thecd "$dist"at oci/push-bundle.sh:96 and above the already-published early exit at oci/push-bundle.sh:134-138, so a re-run of a commit that is already published now fails instead of being a no-op. Fix: pass it through in the Makefile (KERNEL_SOURCE="$(KERNEL_SOURCE)") with a#?flag line, and name it in the README's publish step. - .github/workflows/build-kernel.yml:205 (nit): The
-sourceartifact is annotatedorg.opencontainers.image.licenses=GPL-2.0-only, but it carries Apache-2.0 files too. Failure: a consumer reading the annotation onguest-kernel:<tag>-sourceis told the whole artifact is GPL-2.0-only, whilebuild.tar.gzcontainskernel/build-kernel.sh,kernel/inputs-hash.shandPINS, which LICENSE and README.md:244-245 put under Apache-2.0. The bundle push got a compound expression for the same reason (oci/push-bundle.sh:154); this push did not. Evidence: kernel/build-kernel.sh:515-517 stages the Apache-2.0 scripts into the archive; .github/workflows/build-kernel.yml:205 annotates the artifact that contains it. Fix:GPL-2.0-only AND Apache-2.0. - README.md:283 (nit):
make kerneldoes not writedist/source/. Failure: a reader following this line looks indist/source/and finds nothing; the files are indist/<arch>/source/. Evidence: Makefile:28 setsDIST ?= $(CURDIR)/dist/$(ARCH)and Makefile:43 passesOUT=$(DIST), and build-kernel.sh writes$OUT/source. - oci/push-bundle.sh:134 (nit): The
*/*@sha256:*pattern accepts a digest-less reference. Failure:KERNEL_SOURCE=a/b@sha256:passes the guard and lands verbatim inbundle.json(oci/push-bundle.sh:116) and insh.brig.hull-assets.kernel-source(oci/push-bundle.sh:156), so the bundle advertises a source location nothing can resolve. I ran that value and the script proceeded past the guard to the dist-file check. Today the value comes from an annotation this repo wrote, so this is narrow and the failure direction is safe; it just does not catch what the error message claims to. Fix:*/*@sha256:[0-9a-f][0-9a-f]*)with a length check, or validate against the 64-hex form. - kernel/build-kernel.sh:515 (nit):
rm -rf "$src_tree"runs only after a successful container build, so a failed build leaves the staging tree in the output directory. Failure: withset -e, a non-zerodocker runexits before this line and$OUT/.source-treestays behind. I reproduced it with a stubdockerthat exits 7:/tmp/d1/.source-treewas still fully populated afterwards. Harmless on CI (the uploads andoras pushboth name files explicitly, and the next run'srm -rfat kernel/build-kernel.sh:513 cleans it), but it is a 40KB surprise in a localdist/after every failed build. Evidence: kernel/build-kernel.sh:512-513 creates it, kernel/build-kernel.sh:558 is the command that can fail, kernel/build-kernel.sh:811 is the cleanup. Fix: atrap 'rm -rf "$src_tree"' EXITafter the mkdir.
All six previous findings are fixed. Two nits left, both narrow.
Findings:
- nit, kernel/build-kernel.sh:552 — the documented rebuild re-downloads the tarball it ships
- nit, oci/push-bundle.sh:111 —
bundle.jsonis written before theKERNEL_SOURCEguard
Verified:
- Finding 1:
Makefile:72passesKERNEL_SOURCEthrough,Makefile:25-26declares it with a#?line,README.md:110-112,286-291name it, and the guard now sits atoci/push-bundle.sh:134, below thecd "$dist"and below the already-published early exit atoci/push-bundle.sh:128-133, so a re-run of a published commit is a no-op again. - Finding 2: the
-sourcepush is annotatedGPL-2.0-only AND Apache-2.0—.github/workflows/build-kernel.yml:205; the kernel artifact keeps the bareGPL-2.0-onlyat:233, which is right, it carries no Apache files. - Finding 3:
README.md:283saysdist/<arch>/source/. - Finding 4: regex is
^[^@[:space:]]+/[^@[:space:]]+@sha256:[0-9a-f]{64}$—oci/push-bundle.sh:134. Ran it against"",a/b@sha256:,ghcr.io/o/r:tag(all rejected) and a 64-hex ref (accepted). - Finding 5:
trap 'rm -rf "$src_tree"' EXITatkernel/build-kernel.sh:516, right after themkdir -p, so it covers the container run at:571and every path to it. - Finding 6:
kernel/build-kernel.sh:517copiesLICENSEinto the staging tree,:548names it inSOURCE,README.md:260lists it, and.github/workflows/build-kernel.yml:318makes the example job fail if./LICENSEis not inbuild.tar.gz. The CI check is better than the fix I proposed: it keeps the staging list and the claim from drifting apart. - The bundle's
GPL-2.0-only AND Apache-2.0 AND MITis complete for what the bundle layers hold: kernel,container-initrd,bundle.json,KVER(oci/push-bundle.sh:160-164), and the initrd is urunit alone, no BusyBox and no second binary (initrd/build-container-initrd.sh:24-27). SOURCE_DIGESTis only read where it is set: the push step writes it to$GITHUB_ENV(.github/workflows/build-kernel.yml:214) and the sign step carries the sameif:guard as the push (:251,257), so anexists=truerun never reaches it underset -u.- The tarball and signature go into
source/only after both the sha256 and the gpgv check (kernel/build-kernel.sh:615-631, copy at:635). KERNEL_SOURCEreachespush-bundle.sh: the annotation lookup and the push are in the samebuildjob (.github/workflows/build-assets.yml:129,220-231,264-285), and the push step'senv:block does not shadow it.- Fragment order in
build.tar.gzdoes not affect a rebuild:extra_y/extra_offare unions and a symbol set both ways is a hard error (kernel/build-kernel.sh:427-433), so theLC_ALL=C sortat:525cannot change the resulting.config.
Checks run:
bashregex probe of theKERNEL_SOURCEguard against four values → rejects empty, digest-less and tag refs, accepts a 64-hex digest ref.
Smaller things:
SOURCEnames the builder image (kernel/build-kernel.sh:550) but the rebuild command does not setBUILDER_IMG, so a minimal-profile rebuild uses whateverdebian:bookworm-slimresolves to that day. Rust builds are pinned by digest throughPINS, which ships, so this only affects the non-Rust path and only the toolchain, not the.config.SOURCEsaysLICENSEcovers "the build scripts and PINS";kernel/keysis also in the archive and is kernel.org's public keys, not Apache-2.0 material. Not worth a line unless you want the archive's own manifest to be exhaustive.
Not checked:
- The claims in the PR description about an end-to-end run on nofire: the GHCR push, the annotation lookup against a real registry, the rebuild from build.tar.gz producing an identical .config and the 7 example_hello symbols. No registry, docker or kernel build is reachable here; I checked the scripts and workflow logic that would produce those results.
- Whether cdn.kernel.org retains superseded stable tarballs indefinitely. The nit on kernel/build-kernel.sh:552 is written to not depend on it.
Task 5a78057a-ba0f-41fc-81c5-b1187ef68f57 on ravel-fleet-amd64-1, model claude-opus-5, effort medium.
|
|
||
| The build ran in the $BUILDER_IMG container. | ||
|
|
||
| To rebuild (needs docker; the script fetches the same tarball and checks |
There was a problem hiding this comment.
nit: The rebuild command in SOURCE cannot use the linux-$KVER.tar.xz shipped beside it; it always re-downloads the same bytes from cdn.kernel.org.
Failure: a recipient of guest-kernel:<tag>-source who has the artifact but no route to cdn.kernel.org (air-gapped mirror, a CDN path that fails, a tarball that moved) cannot rebuild, even though the corresponding source is on disk. The build dies at the wget with the container's bare exit, not at a message about the tarball it already has.
Evidence: kernel/build-kernel.sh:606-607 fetches linux-$KVER.tar.xz and .tar.sign unconditionally inside the container and there is no env var or path that feeds it a local copy; the rebuild recipe at kernel/build-kernel.sh:552-557 unpacks only build.tar.gz, which does not contain the tarball. The line is honest about what it does, so this is a gap in the recipe, not a wrong claim.
Fix: accept a KERNEL_TARBALL dir mounted into the container and skip the wget when the two files are already there (the sha256 and gpgv checks at :615-631 stay, so nothing is trusted that is not verified), and say in SOURCE that the shipped tarball can be used that way.
| "inputs": "${KERNEL_INPUTS:-}" | ||
| "inputs": "${KERNEL_INPUTS:-}", | ||
| "license": "GPL-2.0-only", | ||
| "source": "$KERNEL_SOURCE" |
There was a problem hiding this comment.
nit: bundle.json is written with "source": "$KERNEL_SOURCE" before the guard that validates KERNEL_SOURCE, so a rejected run still leaves a rewritten bundle.json in the dist directory.
Failure: make push PLATFORM=linux-arm64 with no (or a malformed) KERNEL_SOURCE exits 1 at oci/push-bundle.sh:134, and dist/<arch>/bundle.json now records "source": "" where it previously held the value from the last successful push. The same happens on the already-published early exit at oci/push-bundle.sh:128-133, which returns 0 after the rewrite and before the guard: the on-disk bundle.json then disagrees with the published one. Nothing is pushed in either case and the next successful run rewrites the file, so this is cosmetic.
Evidence: oci/push-bundle.sh:98-115 writes the file, oci/push-bundle.sh:128-133 is the early exit, oci/push-bundle.sh:134-139 is the guard.
Fix: move the guard above the cat > bundle.json heredoc. It would also then fire before the registry round-trip, which is the faster failure for a local publisher.
- build-kernel.sh writes dist/source: the verified upstream tarball and signature, the .config, and build.tar.gz with the scripts, PINS, keys, LICENSE and a variant's fragments and driver sources. KERNEL_TARBALL_DIR rebuilds from a local tarball, under the same checks. - build-kernel.yml pushes it as guest-kernel:<tag>-source, signs and verifies it, and names it by digest in sh.brig.hull-kernel.source. - Bundles record that source in bundle.json and an annotation, with org.opencontainers.image.licenses. push-bundle.sh, and make push via KERNEL_SOURCE, refuse to publish a new bundle without a source digest. - README: License section. Signed-off-by: Anastassios Nanos <ananos@nofire.ai>
37c34ac to
40f8c40
Compare
The kernel we publish is GPL-2.0-only, so its corresponding source has to be available from the place the binary is offered. Until now we pointed at kernel.org. This publishes the source next to every kernel in the same GHCR package, and marks the licenses on the artifacts.
kernel/build-kernel.shwritesdist/source/: the upstream tarball and signature it verified, the.config,build.tar.gz(the script,PINS,kernel/keys, and a variant's fragments and driver directories underextra/), andSOURCE, which lists them and gives the rebuild command.build-kernel.ymlpushes it asguest-kernel:<tag>-source, signs it, and names it by digest in the kernel'ssh.brig.hull-kernel.source. The kernel getsorg.opencontainers.image.licenses=GPL-2.0-only. The example variant job checks that the driver source is inbuild.tar.gz.build-assets.ymlreads that annotation, andpush-bundle.shrecords it inbundle.jsonandsh.brig.hull-assets.kernel-source, withlicenses=GPL-2.0-only AND Apache-2.0 AND MIT. It refuses to publish a bundle without a source digest.-sourcetag in the registry layout.Tested on nofire (x86_64, the example Rust variant): the build writes
dist/source/with the tarball at the pinned sha256 and aconfigidentical to the kernel's. Rebuilding frombuild.tar.gzalone, with the command inSOURCE, gives an identical.configand the 7example_hellosymbols. The push and annotation lookup, replayed against a local registry, resolve and pull the source.push-bundle.shexits 1 with noKERNEL_SOURCEor with a tag in place of a digest.build-kernel.shis in the inputs hash, so merging this republishes both kernels with their source, then the bundles. Kernels already published do not have it; those need a backfill.