Skip to content

deps: fix netstack shutdown hang with audited SBOMs (#151) - #1

Draft
ryjen wants to merge 8 commits into
mainfrom
fix/netstack-close-151
Draft

ryjen wants to merge 8 commits into
mainfrom
fix/netstack-close-151

Conversation

@ryjen

@ryjen ryjen commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

Purpose

Fix the Tailcat #151 netstack shutdown hang by upgrading tailscale.com to v1.105.0-pre.0.20261013225543-fb79793d99f5, which includes the merged fix in tailscale/tailscale#21668. Update Go 1.27.2, synchronized dependency versions, Nix hashes and release tags. No production Go source changes.

Dependency and supply-chain assessment

Detailed, reproducible findings: sbom/README.md.

  • Full Go module graph: 675 modules on both versions, 2 added, 2 removed, 31 upgraded. The newly selected graph entries are github.com/bradfitz/reco and github.com/tailscale/tb; the new explicit github.com/benbjohnson/immutable requirement already existed in the prior resolved graph. Their exact-version licenses were checked: BSD-3-Clause, BSD-3-Clause, and MIT.
  • All five GoReleaser executable targets, using CGO_ENABLED=0 and the 76 release build tags, contain zero new runtime Go modules. The only runtime upgrades are tailscale.com, github.com/tailscale/wireguard-go, and golang.org/x/net. The upstream Tailscale module upgrade is nevertheless broad (~76 commits/268 files), so CI and release qualification matter.
  • Five source-derived CycloneDX 1.6 JSON SBOMs include module versions/hashes/license evidence, target and build-tag constraints, and Go standard library [email protected] with documented manual BSD-3-Clause attribution. Linux targets have 39 dependency components each; Windows targets 36 each.
  • The tool/sbom/ standard-library-only Go generator normalizes the application identity using a SHA-256 digest of tracked Go sources, go.mod, go.sum, build tags and release config, avoiding stale Git pseudoversions from documentation-only changes. It regenerates cleanly from Git worktrees. Local generate and check passes are recorded, including a negative test that rejected a deliberately altered SBOM.
  • .github/workflows/supply-chain.yml uses pinned Go and a SHA-256-verified SBOM generator v1.12.0, checks all five inventories for freshness on PRs and main pushes, and repeats symbol-level govulncheck v1.9.0 for all five release configurations. Current head 8f2dccedb passed all three exact-head workflows: Supply-chain inventory, Test (all 8 jobs including browser regression), and Nix.

Security and regression evidence

  • go mod verify, full go test -p 2 -count=1 -timeout=120s ./..., go vet -p 2 ./..., go mod tidy -diff, git diff --check passed on the original dependency change.
  • 2026-10-19: local govulncheck v1.9.0 -scan=symbol passed on Linux amd64/arm64/armv7 and Windows amd64/arm64 with release tags, reporting zero reachable findings for the executable in the checked Go vulnerability DB snapshot. The pre-existing module-level GO-2026-5932 advisory relates to x/crypto/openpgp, which is not imported by this executable; the x/crypto module is unchanged.
  • The separate draft PR #2 contains the opt-in 550-short-TCP-session close regression. The same corrected harness completed 550 sessions and reproduced the old dependency close timeout in 2/2 runs; the upgraded dependency returned normally in 3/3. The test PR is not part of this PR.

Status, scope, and outstanding gates

The SBOM generation and source-level vulnerability review are locally validated; review threads for reproducibility, standard-library inventory, and five-target scans have been resolved. Still required before release: binary/package/container-derived SBOMs bound to the SHA-256 digests of final distributed assets. Existing source-derived SBOMs do not establish the contents of final binaries or container images. The release-attachment review thread intentionally remains open until implemented.

Submission: Open the upstream draft PR comparison; the connected GitHub integration cannot create a PR in tailscale/tailcat. Do not merge the fork PR directly into main. Issue tailscale#151 contains additional lifecycle proposals beyond this dependency update.

Go tooling migration (2026-10-19)

  • Replaced the Python SBOM helper with the standard-library-only Go command under tool/sbom/, consistent with the existing tool/updateflakes and tool/directtest directories; no new go.mod dependencies.
  • Regenerate: go run ./tool/sbom generate; verify: go run ./tool/sbom check. CI now invokes the Go verifier.
  • Unit tests and go vet ./tool/sbom passed locally; regenerated all five CycloneDX inventories, then reran the freshness check successfully. Intentionally tampering with an SBOM caused verification to fail, and the original inventory was restored.
  • Go migration commit: 0b64917a6; refreshed BOM commit: 3616b8632. The optional test-only PR test: opt-in 550-connection netstack shutdown regression (#151) #2 remains separate and contains only close_regression_151_test.go relative to the updated base.
  • Supply-chain CI, Test CI, Nix CI: all passed on 3616b863.

PR CI cache/performance correction (2026-10-19)

  • Commit dee5ed996 updates the Nix cache primary key to include **/*.go, go.mod, go.sum, flake.nix, flake.lock, flakehashes.json, and build-tags.txt; restore prefix and 4 GB garbage-collection limit are preserved. The prior unchanged primary key prevented saving freshly built outputs even when the source derivation changed. Source-aware immutable keys allow incremental revisions to save their new output after restoring an older toolchain cache. Cache usage is subject to GitHub retention and LRU eviction.
  • Nix, Test, and Supply-chain workflows now have PR-only superseded-run cancellation. Main runs receive unique concurrency groups and are neither cancelled nor serialized by these controls.
  • Fork PR test: opt-in 550-connection netstack shutdown regression (#151) #2 has been rebased via a non-rewriting merge onto the changed PR deps: fix netstack shutdown hang with audited SBOMs (#151) #1 base; its diff remains exactly one opt-in regression test file.
  • Nix cache CI, Test CI, Supply-chain CI on the current head validate workflow syntax and qualification. Compare the Nix cache log's primary miss, restore-prefix hit, and post-job cache save against the prior immutable-key behavior.

Browser-test startup race (2026-10-19)

  • On dee5ed996, the WebAssembly TestBrowserSends job failed because Chrome evaluated window.tcTest.sendDone before web/app.js initialized window.tcTest, producing TypeError: Cannot read properties of undefined (reading 'sendDone'). Other seven Test jobs passed.
  • Commit 881ca3806 uses window.tcTest && window.tcTest.sendDone === true in the browser poll, preserving real send completion while avoiding the initialization exception. No production JavaScript/Go code or timeouts changed.
  • The focused Go package test and vet passed locally (Chrome unavailable locally, so the real headless browser test is verified in hosted CI). All five SBOMs were regenerated and freshness-checked in 8f2dccedb, because the source fingerprint includes Go test files.
  • Test workflow, Nix, and Supply-chain all passed against the repaired head. TestBrowserSends passed in hosted Chrome in ~1.87s. PR test: opt-in 550-connection netstack shutdown regression (#151) #2 is synchronized and its diff remains one opt-in regression-test file.

@ryjen ryjen changed the title CI validation: Tailscale netstack shutdown fix (#151) deps: update tailscale.com to fix netstack shutdown deadlock (#151) Oct 18, 2026

@ryjen ryjen left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent review of the eight-file dependency upgrade at 3064e971bf46abc378b1bae9ccad83bcb374838d:

  • No code-level defect identified. tailscale.com v1.105.0-pre.0.20261013225543-fb79793d99f5 includes the merged netstack queue-saturation close fix; required Go toolchain bump, release build tags, go.mod/go.sum, and generated Nix metadata are kept in sync.
  • Direct regression evidence: 550 completed short-lived TCP sessions, server-first close; old dependency timed out on Server.Close() in 2/2 repeated runs, patched dependency returned in ~2 ms in 6/6 runs. See the independent opt-in test in draft PR #2.
  • Qualification still required before merge: Nix build and cross-platform CI are unverified; GitHub Actions has zero runs/checks on this fork. The manually run Go suite, vet, module and diff checks passed, but are not a substitute for those gates.
  • Scope: Keep the upstream submission dependency-only. The additional backend close-order and TIME_WAIT APIs in tailscale#151 warrant separate proposals. The optional integration test in PR #2 has a review finding and should not be bundled here.

The patch is suitable for an upstream draft PR, not yet approved for merge without CI evidence.

@ryjen ryjen changed the title deps: update tailscale.com to fix netstack shutdown deadlock (#151) deps: fix netstack shutdown hang and document SBOM/license review (#151) Oct 19, 2026

@ryjen ryjen left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent supply-chain review — PR #1 at 35b221f20

Validated: Five CycloneDX 1.6 application SBOMs parse correctly and match the five GoReleaser targets, all 76 release build tags, and Go 1.27.2. Dependency components carry selected versions and hash/license evidence; no local-machine paths or apparent secrets were embedded. Confirmed the two newly selected module-graph entries' licenses at their exact commits (bradfitz/reco and tailscale/tb: BSD-3-Clause; benbjohnson/immutable: MIT). Zero added runtime modules and three upgraded runtime modules per release target is accurately scoped. The module-level OpenPGP advisory is disclosed without asserting that the package is imported or reachable.

Review findings (before treating the SBOMs as an enforceable release control):

  1. No automated SBOM drift gate. .github/workflows/test.yml only checks make tidy, Go tests, and release cross-builds; it does not regenerate or compare CycloneDX inventories. A later dependency or build-tag change can leave committed SBOMs stale while CI remains green. Add a deterministic generation/validation target and an exact-head workflow check (or equivalent CI artifact+diff), ideally covering each release target.
  2. No SBOM publication alongside actual releases. .github/workflows/release.yml invokes GoReleaser; .goreleaser.yaml archives include only LICENSE and README.md. Five committed source SBOMs aren't currently released with the binaries, Debian/RPM packages, or containers. Implement artifact-linked SBOM generation, attachment and container-image scanning separately before shipping. This is not a reason to bundle more changes into the immediate netstack fix.
  3. Source revision/reproducibility mismatch. BOM main components identify 3064e97, while PR head is 35b221f. The README deliberately discloses this snapshot, so it is not an inaccurate description; however, regeneration at the current head changes pseudoversions even when Go inputs are identical. The documented command also needs mkdir -p sbom when checking out 3064e97, where sbom/ does not exist. cyclonedx-gomod app was previously observed failing to identify the Git version from the linked .worktrees/ checkout; document/use a full checkout or fix the tooling path. Define how exact-head attestations are created rather than depending on the previous code commit's pseudoversion.
  4. Compatibility impact larger than module count suggests. The tailscale.com upgrade spans 76 upstream commits across 268 changed files (including netstack/magicsock/DERP-related changes). The working 550-session regression supports the specific fix, but Nix, actual cross-builds, broad networking tests and upstream CI are still pending. The recorded vulnerability DB snapshot is from 2026-10-08; rescan at the final qualified head.
  5. Contribution scope: The source SBOMs add ~8,335 generated lines to a very small dependency patch. Consider keeping full machine-readable BOMs as separately linked CI artifacts/release assets, with a concise manifest and audit in the PR, if upstream maintainers prefer a narrow dependency-only contribution.

Verdict: Approve the factual dependency inventory and the approach of separating application SBOMs by target, not yet the completeness of the release-level supply-chain gate. The dependency change can be submitted as an upstream draft; a production release or claim of continuous SBOM compliance requires closing items 1–4.

Comment thread sbom/README.md Resolved
Comment thread sbom/README.md Resolved
Comment thread sbom/README.md Outdated
- `govulncheck v1.9.0` (Go vulnerability database last updated **2026-10-08**) found **no identified reachable symbol-level vulnerability** in the checked Tailcat application. One **module-level finding**, [GO-2026-5932](https://pkg.go.dev/vuln/GO-2026-5932), concerns the unmaintained `golang.org/x/crypto/openpgp` package. `golang.org/x/crypto` is unchanged at `v0.57.0`, and the OpenPGP package is not imported by the checked application. This is pre-existing risk, not introduced by the upgrade.
- A separate [550-session close regression](https://github.com/ryjen/tailcat/pull/2) reproduces the old shutdown hang and passes using the updated dependency.
- The BOMs describe selected Go source dependencies for the specified build settings. They **exclude OS packages, Docker image contents, build tool dependencies, and verification of exact final release binary contents**. Generated license matches need human review.
- **Nix qualification, cross-platform compilation and GitHub Actions remain unverified.** Publish separate binary-derived SBOMs alongside final release artifacts, and scan released container images independently.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This limitation is acknowledged, but the release workflow and GoReleaser config currently do not generate, attach or gate on these files. Add a follow-up release control to emit final binary/image SBOMs and keep source-derived SBOMs synchronized with go.mod/build-tags changes via CI.

@ryjen ryjen left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up independent supply-chain review at exact head 35b221f20b39d72cd8611443b8cf46eca8e3f8fb.

The three prior review threads (SBOM root pseudoversion/exact-head binding; reproducible generator invocation; CI and release attachment) remain unresolved. There are two additional concrete coverage gaps:

  1. Go standard library omitted from the source SBOMs. Each file records Go 1.27.2 only as cdx:gomod:build:env:GOVERSION, without a standard-library dependency component or dependency edge. cyclonedx-gomod app supports -std to explicitly include it. Including this helps downstream scanners that use BOM components rather than freeform metadata; regenerate the files, revalidate versions/licenses, and make any intentional exclusion explicit.
  2. The recorded govulncheck result does not cover the release matrix. The source scan was performed on Linux amd64 without GOFLAGS=-tags=$(cat build-tags.txt); the five SBOM targets used release tags, and Windows-specific code exists. State the exact scanner mode/OS/tags in the audit; repeat vulnerability scanning with the release-tag configuration and platform-aware coverage or explicitly document the scan gap rather than interpreting one result as a property of all distributed binaries.

Scope/context: The dependency is still functionally well justified by the reproducible 550-session old-vs-new shutdown test, but Tailscale's old-to-new upstream comparison includes ~76 commits/268 changed files, so one regression test and an unchanged list of Go module names do not equal comprehensive compatibility review. This supports upstream draft discussion, not immediate release approval. The five existing BOMs are valid source-derived snapshots but not a complete release-level security control.

Comment thread sbom/README.md Resolved
Comment thread sbom/README.md Resolved
@ryjen ryjen changed the title deps: fix netstack shutdown hang and document SBOM/license review (#151) deps: fix netstack shutdown hang with audited SBOMs (#151) Oct 19, 2026

@ryjen ryjen left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final independent review at exact PR #1 head 84645457b58f1e3a5b66f48d7ebb0d9a4ca25ecf.

CI all green: supply-chain inventory run 39336219618 (SBOM + vulnerability jobs), Test run 39336219591 (Linux/macOS/Windows, release tags, tidy, FreeBSD/OpenBSD, WASM), Nix run 39336219402. All 11 reported jobs completed successfully. No new production-code defect or dependency-integrity failure found on re-review. The 550-connection regression remains in separate draft PR #2, which does not have standalone hosted CI at its non-main base.

Low-priority documentation correction: The README and PR description still say GitHub Actions, Nix, and cross-platform qualification have not run, despite the successful exact-head workflows. Update these before presenting the PR to upstream so maintainers don't have conflicting evidence.

Outstanding release qualification (correctly left open): source-derived SBOMs have no cryptographic binding to actual shipped binaries/Deb/RPM/container-image digests; the release workflow does not yet attach binary or image SBOMs. Also note that the SBOM root v0.0.0-sbom.<digest> is a deliberately synthetic source identity, not an actual published Go module version. Keep that distinction explicit for consumers of package URLs.

Verdict: Suitable to open as an upstream draft PR now; not an unconditional release sign-off. I recommend preserving the separation between this bug fix and optional regression/release-publishing work.

Comment thread sbom/README.md Outdated
- A separate **module-level** finding, [GO-2026-5932](https://pkg.go.dev/vuln/GO-2026-5932), concerns the unmaintained `golang.org/x/crypto/openpgp` package. `golang.org/x/crypto` is unchanged at `v0.57.0`; that OpenPGP package is not imported by the checked application. Keep it tracked as pre-existing dependency hygiene risk.
- A separate [550-session close regression](https://github.com/ryjen/tailcat/pull/2) reproduces the old shutdown hang and passes using the updated dependency.
- The BOMs describe selected Go source dependencies for the specified build settings. They **exclude OS packages, Docker image contents, build tool dependencies, and verification of exact final release binary contents**. Generated license matches need human review.
- **Nix qualification, actual cross-platform binary builds and GitHub Actions remain unverified.** A source SBOM freshness and vulnerability gate was added but has not yet run in hosted CI; the five-target vulnerability scans passed locally. Publish separate binary-derived SBOMs alongside final release artifacts, and scan released container images independently. The release workflow currently does **not** attach SBOMs to binary/package/container artifacts.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outdated after exact-head CI success: GitHub Actions run 39336219618 passed both supply-chain jobs, run 39336219591 passed all Test jobs including release-target cross-builds, and run 39336219402 passed Nix. Please update this status and corresponding outdated statements in the PR description. The final binary/container SBOM gap remains outstanding.

@ryjen ryjen left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Performance/cache audit for the exact green head 3616b863 (GitHub runs 39340026414/425/435). No behavior change requested for the netstack fix itself.

P1: Nix cache key does not track application source revisions. .github/workflows/nix.yml uses hashFiles('flake.nix', 'flake.lock', 'go.sum') as a primary key. At this head the 430 MB primary cache restored successfully, but nix build still ran 239 s (62 s buildPhase, 165 s checkPhase), and the post-job cache action explicitly said "Cache hit occurred on the primary-key. Not saving a new cache." Because src = ./. varies by source commit while the primary cache key can stay constant, build/test outputs from subsequent commits may never enter the cache. Consider immutable, source-aware keys with a carefully scoped restore prefix and quota/retention policy, or an attested/shared Nix binary cache. Verify cold-vs-warm timing before claiming speedups; don't simply skip tests to make the Nix job green faster.

P2: Release cross-compilation dominates Test CI. The five target cross-builds execute sequentially in one job and took 232 s despite a restored ~373 MB setup-go cache. Consider bounded matrix/concurrent builds only if lower wall-clock latency matters more than runner minutes/cache duplication; preserve all five targets. The Linux test suite also spent ~109 s in go test and should retain its coverage.

Low priority: Supply-chain jobs already parallelize, finish in ~49–51 s, and restore Go build/module caches; SBOM binary download is ~1 s, so caching that binary is unlikely to beat its cache management overhead. govulncheck installation takes ~15 s, so a separate version-keyed tool cache would have modest payoff only after measuring restore costs. Add concurrency with PR-scoped cancellation if rapid pushes generate redundant in-flight runs; do not cancel main/release jobs or weaken vulnerability/manifest gates.

Review status: caching/performance improvements are recommendations rather than submission blockers. Source-derived final-artifact SBOM publishing remains a separate release-qualification gap.

@ryjen ryjen left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up review at exact head 8f2dccedb049ce6b456a92f6928d8dd2ba879504 — WebAssembly CI repair.

Failure evidence: In run 39345424435, TestBrowserSends evaluated window.tcTest.sendDone after navigation but before the application initialized window.tcTest, raising TypeError: Cannot read properties of undefined (reading 'sendDone'). The receiving test already guarded initial access.

Fix: 881ca3806 guards the poll with window.tcTest && window.tcTest.sendDone === true; it does not change the browser app, network implementation, completion semantics, or timeout. 8f2dccedb refreshes all five source SBOMs because the source digest deliberately includes tracked Go tests.

Exact-head qualification passed:

  • Supply-chain: SBOM and vulnerability jobs successful.
  • Test: all 8 jobs successful. Hosted Chrome TestBrowserSends passed (~1.87 s), as did the three other WebAssembly browser tests; Linux/macOS/Windows tests, release cross-builds, and FreeBSD/OpenBSD passed.
  • Nix: successful.

Locally, Go build/test (headless test compile), vet, five-target SBOM generation/check, and diff checks passed. No physical browser was available locally; hosted Chrome supplies that end-to-end evidence. PR #2 remains a single opt-in test-file delta.

Verdict: Browser-test repair validated; no new blocking code-level finding from this failure. Remaining separate release-security requirement: binary/package/container artifact-bound SBOM publication.

ryjen commented Oct 20, 2026

Copy link
Copy Markdown
Owner Author

Release-stage artifact SBOM follow-up is now separated into fork PR #3, instead of expanding the Tailcat tailscale#151 dependency patch.

The original unresolved release-artifact review thread remains open by design; source-generated SBOMs in this PR remain distinct from final published artifact SBOMs.

ryjen commented Oct 20, 2026

Copy link
Copy Markdown
Owner Author

Release-SBOM follow-up advanced in separate draft PR #3 at 60bd9a1eb:

  • Exact-head snapshot passed: 16 checksummed CycloneDX SBOMs for release binaries, archives and packages, plus a non-published two-platform OCI image with digest-bound SPDX attestations for linux/amd64 and linux/arm64.
  • All 8 Test jobs and Nix passed.
  • Independent review records remaining actual GHCR publication, per-platform registry-digest attestation verification, and signed provenance. These cannot be claimed from the offline snapshot.

This work is intentionally separated from upstream shutdown fix PR #1. No version tag, GitHub release or registry image was published, and the release-artifact follow-up thread remains open until actual release verification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant