Marks the structs in netstack as savable. This does not change or break any
existing behavior as the netstack itself is not savable yet.
PiperOrigin-RevId: 635943481
This addresses an issue discovered by Inon Kaplan (PhD candidate in the
Hebrew University School of Computer Science and Engineering), Ron Even (BSc
graduate of Bar Ilan University) and Amit Klein (faculty member in the Hebrew
University School of Computer Science and Engineering). Details will be
provided in their paper, to be presented in a forthcoming academic conference.
Also:
- Add a secure RNG type to prevent mixing up with the default PRNG
- Give the PRNG the name `InsecureRNG` to make it more obvious to future
contributors that some RNGs are inappropriate in certain instances.
- Some tests were injecting fake RNGs and had to be relaxed: they relied on the
stack calling the RNG a specific number of times and in a specific order.
That order is now changed, and is too brittle to unit test.
- Remove the double package comment in pkg/rand. The linter complains.
PiperOrigin-RevId: 577513723
The important change here is in tcpip/tcpip.go, where tcpip.Address is defined.
The rest is updating uses of tcpip.Address.
This is preparation for netip.Addr or []byte based addresses, which should save
us a bunch of allocations. Currently, we allocate every time we want to, say,
get a tcpip.Address from a header. This is because the header is a byte slice,
but Address is a string. Strings are immutable, so Go allocates and copies.
PiperOrigin-RevId: 532284732
This change has significant performance implications. bufferv2 is reference
counted and pooled, which alleviates heap/GC pressure. Below are the results
from running the iperf benchmark.
HEAD:
BenchmarkIperf/operation.Upload-16 1552 ns/op 46.6GiB total allocations
BenchmarkIperf/operation.Download-16 1114 ns/op 68.6GiB total allocations
w/ change:
BenchmarkIperf/operation.Upload-16 1139 ns/op (-27%) 1.41GiB total allocations (-97%)
BenchmarkIperf/operation.Download-16 753.2 ns/op (-33%) 706MiB total allocations (-99%)
PiperOrigin-RevId: 462453185
WritePackets ownership is hard to get right, especially when packets can
belong to multiple PacketBufferLists, and these lists are modified
concurrently. For example, in SendTCPBatch when the qdisc link layer was
enabled, packets could belong to multiple lists, like the batch list and the
original packet list.
If gvisor is concurrently processing a packet in a qdisc
batch and that same packet is in a list that is being DecRef'd in the original
SendTCPBatch() call, then that packet's entry can point to packets in the
batch rather than the ones in the original list. Since this is the only place
WritePackets() is used, it is reasonable to just use WritePacket instead.
PiperOrigin-RevId: 417432389
Previously, we recorded a single aggregated count. These per-protocol counts
can help us debug field issues when frames are dropped for this reason.
PiperOrigin-RevId: 405913911
Replaced the current AddAddressWithOptions method with
AddAddressWithProperties which passes all address properties in
a single AddressProperties type. More properties that need to be
configured in the future are expected, so adding a type makes adding
them easier.
PiperOrigin-RevId: 396930729