Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when get TCPInfo under hostinet #640

Closed
tanjianfeng opened this issue Aug 2, 2019 · 1 comment
Closed

Crash when get TCPInfo under hostinet #640

tanjianfeng opened this issue Aug 2, 2019 · 1 comment
Assignees
Labels
area: networking Issue related to networking priority: p1 High priority status: help wanted Extra attention is needed type: bug Something isn't working

Comments

@tanjianfeng
Copy link
Contributor

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).

@ianlewis ianlewis added area: networking Issue related to networking type: bug Something isn't working priority: p2 Normal priority priority: p1 High priority status: help wanted Extra attention is needed and removed priority: p2 Normal priority labels Aug 2, 2019
tanjianfeng added a commit to tanjianfeng/gvisor that referenced this issue Aug 2, 2019
Below command under hostinet network will lead to panic:

  $ cat /proc/net/tcp

It's caused by the wrong SizeOfTCPInfo.

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

Correct SizeOfTCPInfo from 104 to 192 to fix it.

Fixes google#640

Signed-off-by: Jianfeng Tan <henry.tjf@antfin.com>
@mrahatm mrahatm closed this as completed Aug 13, 2019
@mrahatm
Copy link
Contributor

mrahatm commented Aug 13, 2019

Fixed by 691c2f8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: networking Issue related to networking priority: p1 High priority status: help wanted Extra attention is needed type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants