Skip to content

fix: correct gvisor replace directive to match module path (#26822) - #27137

Merged
mtojek merged 1 commit into
release/2.35from
mike/gvisor-replace-fix-2.35
Jul 13, 2026
Merged

fix: correct gvisor replace directive to match module path (#26822)#27137
mtojek merged 1 commit into
release/2.35from
mike/gvisor-replace-fix-2.35

Conversation

@ibetitsmike

Copy link
Copy Markdown
Collaborator

Cherry-pick of #26822 (f77d0065ed) onto release/2.35.

The gvisor replace directive on this branch targets gvisor.dev instead of the module path gvisor.dev/gvisor. Go matches replace directives by exact module path, so the directive is a silent no-op: v2.34.5, v2.35.0, and v2.35.1 all built against upstream gvisor v0.0.0-20240509041132 without the integer-overflow crash fix from coder/gvisor (#20885). go.sum on this branch has no coder/gvisor entries, confirming the fork was not in the build.

Changes

  • Correct the replace directive to gvisor.dev/gvisor => github.com/coder/gvisor v0.0.0-20260313164934-7a658db7b714 (go.mod + go.sum).

Verification

  • go list -m gvisor.dev/gvisor now resolves to github.com/coder/gvisor v0.0.0-20260313164934-7a658db7b714.
  • go mod tidy is a no-op; go build ./agent/... ./tailnet/... passes.
  • main and release/2.34 already carry this fix; release/2.35 was the only maintained branch missing it.

This PR was authored by Mux on Mike's behalf.

## Summary

Fixes the gvisor `replace` directive in `go.mod` to target the correct
module path.

## Problem

PR #23055 added a replace directive to use the coder/gvisor fork (which
fixes an integer overflow causing `panic: length < 0` crashes). However,
the directive targeted the wrong module path:

```
replace gvisor.dev => github.com/coder/gvisor v0.0.0-20260313164934-7a658db7b714
```

The actual module path declared in gvisor's `go.mod` is
`gvisor.dev/gvisor`, not `gvisor.dev`. Go module replace directives
require an exact module path match, so the previous directive was a
no-op and the patched fork was never used.

## Fix

```diff
-replace gvisor.dev => github.com/coder/gvisor v0.0.0-20260313164934-7a658db7b714
+replace gvisor.dev/gvisor => github.com/coder/gvisor v0.0.0-20260313164934-7a658db7b714
```

## Validation

Verified locally with `go list -m`:

**Before (no-op replace):**
```
$ go list -m gvisor.dev/gvisor
gvisor.dev/gvisor v0.0.0-20240509041132-65b30f7869dc
```

**After (correct replace):**
```
$ go list -m gvisor.dev/gvisor
gvisor.dev/gvisor v0.0.0-20240509041132-65b30f7869dc => github.com/coder/gvisor v0.0.0-20260313164934-7a658db7b714
```

The `=>` confirms the fork is now applied.

Fixes #20885

---

<details>
<summary>Investigation context</summary>

- The coder/gvisor fork (commit `7a658db7b714`) declares `module
gvisor.dev/gvisor` in its go.mod
- Customer runtime stack traces show
`gvisor.dev/gvisor@v0.0.0-20240509041132-65b30f7869dc` (unpatched
upstream), confirming the fork was not applied
- The crash is `panic: length < 0` in
`gvisor.dev/gvisor/pkg/tcpip/transport/tcp.(*sender).splitSeg`
- Related Linear ticket: ENT-118

</details>

---
*Generated by [Coder Agents](https://coder.com/agents) on behalf of
@denisra*

(cherry picked from commit f77d006)
@mtojek
mtojek self-requested a review July 13, 2026 07:07
@mtojek
mtojek merged commit a330eff into release/2.35 Jul 13, 2026
51 of 52 checks passed
@mtojek
mtojek deleted the mike/gvisor-replace-fix-2.35 branch July 13, 2026 07:07
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants