google / google/gvisor

Do not assume buffer.View boundaries for packet headers

Open
#2,404 7 comments 0 reactions 1 assignee Claimed by @googleanivia View on GitHub
area: networking revived type: bug
Dominant language
Go
Stars
19.3k
Forks
2k
Avg merge
3d 5h
Merged PRs (30d)
264

Description

`stack.PacketBuffer.Data` is documented to be guaranteed not to contain headers that split across views. However, after a discussion with bhaskerh, this guarantee is not true. As such, we should remove all assumptions about `buffer.View` boundaries for packet headers.

```
// Data holds the payload of the packet. For inbound packets, it also
// holds the headers, which are consumed as the packet moves up the
// stack. Headers are guaranteed not to be split across views.
//
// The bytes backing Data are immutable, but Data itself may be trimmed
// or otherwise modified.
Data buffer.VectorisedView
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.