gvisor/pkg/buffer
Ayush Ranjan 6d0b40b1d1 [op] Make PacketBuffer Clone() do a deeper copy.
Earlier PacketBuffer.Clone() would do a shallow top level copy of the packet
buffer - which involved sharing the *buffer.Buffer between packets. Reading
or writing to the buffer in one packet would impact the other.

This caused modifications in one packet to affect the other's pkt.Views() which
is not desired. Change the clone to do a deeper copy of the underlying buffer
list and buffer pointers. The payload buffers (which are immutable) are still
shared. This change makes the Clone() operation more expensive as we now need to
allocate the entire buffer list.

Added unit test to test integrity of packet data after cloning.

Reported-by: syzbot+7ffff9a82a227b8f2e31@syzkaller.appspotmail.com
Reported-by: syzbot+7d241de0d9072b2b6075@syzkaller.appspotmail.com
Reported-by: syzbot+212bc4d75802fa461521@syzkaller.appspotmail.com
PiperOrigin-RevId: 390277713
2021-08-11 20:18:19 -07:00
..
BUILD pkg/buffer: Remove dependency to safemem, code no longer used 2021-05-14 12:53:29 -07:00
buffer.go Migrate PacketBuffer to use pkg/buffer 2021-05-13 13:56:16 -07:00
buffer_test.go Migrate PacketBuffer to use pkg/buffer 2021-05-13 13:56:16 -07:00
pool.go Migrate PacketBuffer to use pkg/buffer 2021-05-13 13:56:16 -07:00
pool_test.go pkg/buffer: Reorganize internal structure to allow dynamic sizes. 2020-09-22 17:56:40 -07:00
view.go [op] Make PacketBuffer Clone() do a deeper copy. 2021-08-11 20:18:19 -07:00
view_test.go Migrate PacketBuffer to use pkg/buffer 2021-05-13 13:56:16 -07:00
view_unsafe.go Make pipe buffer implementation standard. 2020-02-28 12:29:23 -08:00