Skip to content

Support externally owned buffer chunks - #15443

Open
tamird wants to merge 1 commit into
google:masterfrom
tamird:buffer-external-storage-refresh
Open

tamird wants to merge 1 commit into
google:masterfrom
tamird:buffer-external-storage-refresh

Conversation

@tamird

@tamird tamird commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Linux accepts writes to /dev/net/tun larger than the interface MTU 1.
gVisor rejects them and copies accepted writes into Go heap storage.
Removing that limit would let applications request large heap
allocations, whose failures cannot be returned to the writer as syscall
errors.

MemoryFile, the sentry's file-backed allocator, can report allocation
failure. Using it for packet data requires buffers to retain its storage
while packets are queued or cloned, even after the TUN file is closed.
The buffer package previously supported only Go heap storage.

Allow views to take ownership of external storage and release it with
the last chunk reference. Preserve that shared ownership across
checkpoints and retain copy-on-write semantics. This provides the buffer
support for a separate change to TUN's allocation and write-limit
handling.

Assisted-by: OpenAI Codex

Linux accepts writes to /dev/net/tun larger than the interface MTU [1].
gVisor rejects them and copies accepted writes into Go heap storage.
Removing that limit would let applications request large heap allocations,
whose failures cannot be returned to the writer as syscall errors.

MemoryFile, the sentry's file-backed allocator, can report allocation
failure. Using it for packet data requires buffers to retain its storage
while packets are queued or cloned, even after the TUN file is closed.
The buffer package previously supported only Go heap storage.

Allow views to take ownership of external storage and release it with the
last chunk reference. Preserve that shared ownership across checkpoints
and retain copy-on-write semantics. This provides the buffer support for
a separate change to TUN's allocation and write-limit handling.

[1]: https://github.com/torvalds/linux/blob/830b3c68c/drivers/net/tun.c#L1735

Assisted-by: OpenAI Codex
@github-actions
github-actions Bot requested review from kerumeto and relkochta October 7, 2026 16:00
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