Skip to content

Crash when get TCPInfo under hostinet #640

Closed
@tanjianfeng

Description

@tanjianfeng

Below command under hostinet network will lead to panic:

  $ cat /proc/net/tcp

It's caused by the wrong size of TCPInfo.

  #0 runtime.panicindex()
  #1 encoding/binary.littleEndian.Uint64
  #2 encoding/binary.(*littleEndian).Uint64
  #3 gvisor.dev/gvisor/pkg/binary.unmarshal
  #4 gvisor.dev/gvisor/pkg/binary.unmarshal
  #5 gvisor.dev/gvisor/pkg/binary.Unmarshal
  #6 gvisor.dev/gvisor/pkg/sentry/socket/hostinet.(*socketOperations).State
  #7 gvisor.dev/gvisor/pkg/sentry/fs/proc.(*netTCP).ReadSeqFileData

After initial investigation, we think the root cause is the wrong value of SizeOfTCPInfo (shall be 192 instead of 104).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions