Skip to content

proc: include values in /proc/net/netstat - #13275

Merged
copybara-service[bot] merged 1 commit into
gvisor:masterfrom
Haihan-Jiang:codex/gvisor-netstat-values
Jun 11, 2026
Merged

copybara-service[bot] merged 1 commit into
gvisor:masterfrom
Haihan-Jiang:codex/gvisor-netstat-values

Conversation

@Haihan-Jiang

Copy link
Copy Markdown
Contributor

Fixes #13151.

/proc/net/netstat currently emits only the TcpExt field-name row in gVisor. Linux emits netstat rows in name/value pairs, and consumers such as metric parsers expect the value row to have the same number of fields as the header row. Without the value row, parsers report a field-count mismatch.

This change keeps the existing TcpExt fields and emits a matching TcpExt value row populated with zeroes for the stats gVisor does not track yet. That resolves the header/data length mismatch without pretending to implement non-zero counters.

I also added a proc unit test for matching name/value field counts and enabled the existing /proc/net/netstat syscall format check under gVisor.

Validation:

  • gofmt -w pkg/sentry/fsimpl/proc/task_net.go pkg/sentry/fsimpl/proc/tasks_sys_test.go
  • git diff --check
  • attempted bazel test //pkg/sentry/fsimpl/proc:proc_test //test/syscalls/linux:proc_net_test on macOS; local Bazel failed before executing tests due the host toolchain missing C++ standard library headers for external deps.
  • attempted SDKROOT=$(xcrun --show-sdk-path) ... bazel test //pkg/sentry/fsimpl/proc:proc_test; local Bazel then failed before executing tests because /usr/bin/aarch64-linux-gnu-gcc is not installed.
  • attempted go test ./pkg/sentry/fsimpl/proc; unsupported for this repo checkout because generated proto packages/build-constrained files are provided through Bazel.
@Haihan-Jiang

Copy link
Copy Markdown
Contributor Author

This is ready for review. The proc netstat output now includes values, and the visible checks are green.

@nybidari nybidari added the ready to pull Causes the PR to be imported into Google. Will be removed soon. label Jun 2, 2026
copybara-service Bot pushed a commit that referenced this pull request Jun 8, 2026
Fixes #13151.

`/proc/net/netstat` currently emits only the `TcpExt` field-name row in gVisor. Linux emits netstat rows in name/value pairs, and consumers such as metric parsers expect the value row to have the same number of fields as the header row. Without the value row, parsers report a field-count mismatch.

This change keeps the existing `TcpExt` fields and emits a matching `TcpExt` value row populated with zeroes for the stats gVisor does not track yet. That resolves the header/data length mismatch without pretending to implement non-zero counters.

I also added a proc unit test for matching name/value field counts and enabled the existing `/proc/net/netstat` syscall format check under gVisor.

Validation:
- `gofmt -w pkg/sentry/fsimpl/proc/task_net.go pkg/sentry/fsimpl/proc/tasks_sys_test.go`
- `git diff --check`
- attempted `bazel test //pkg/sentry/fsimpl/proc:proc_test //test/syscalls/linux:proc_net_test` on macOS; local Bazel failed before executing tests due the host toolchain missing C++ standard library headers for external deps.
- attempted `SDKROOT=$(xcrun --show-sdk-path) ... bazel test //pkg/sentry/fsimpl/proc:proc_test`; local Bazel then failed before executing tests because `/usr/bin/aarch64-linux-gnu-gcc` is not installed.
- attempted `go test ./pkg/sentry/fsimpl/proc`; unsupported for this repo checkout because generated proto packages/build-constrained files are provided through Bazel.
FUTURE_COPYBARA_INTEGRATE_REVIEW=#13275 from Haihan-Jiang:codex/gvisor-netstat-values f1d47ac
PiperOrigin-RevId: 924992742
copybara-service Bot pushed a commit that referenced this pull request Jun 8, 2026
Fixes #13151.

`/proc/net/netstat` currently emits only the `TcpExt` field-name row in gVisor. Linux emits netstat rows in name/value pairs, and consumers such as metric parsers expect the value row to have the same number of fields as the header row. Without the value row, parsers report a field-count mismatch.

This change keeps the existing `TcpExt` fields and emits a matching `TcpExt` value row populated with zeroes for the stats gVisor does not track yet. That resolves the header/data length mismatch without pretending to implement non-zero counters.

I also added a proc unit test for matching name/value field counts and enabled the existing `/proc/net/netstat` syscall format check under gVisor.

Validation:
- `gofmt -w pkg/sentry/fsimpl/proc/task_net.go pkg/sentry/fsimpl/proc/tasks_sys_test.go`
- `git diff --check`
- attempted `bazel test //pkg/sentry/fsimpl/proc:proc_test //test/syscalls/linux:proc_net_test` on macOS; local Bazel failed before executing tests due the host toolchain missing C++ standard library headers for external deps.
- attempted `SDKROOT=$(xcrun --show-sdk-path) ... bazel test //pkg/sentry/fsimpl/proc:proc_test`; local Bazel then failed before executing tests because `/usr/bin/aarch64-linux-gnu-gcc` is not installed.
- attempted `go test ./pkg/sentry/fsimpl/proc`; unsupported for this repo checkout because generated proto packages/build-constrained files are provided through Bazel.
FUTURE_COPYBARA_INTEGRATE_REVIEW=#13275 from Haihan-Jiang:codex/gvisor-netstat-values f1d47ac
PiperOrigin-RevId: 924992742
copybara-service Bot pushed a commit that referenced this pull request Jun 11, 2026
Fixes #13151.

`/proc/net/netstat` currently emits only the `TcpExt` field-name row in gVisor. Linux emits netstat rows in name/value pairs, and consumers such as metric parsers expect the value row to have the same number of fields as the header row. Without the value row, parsers report a field-count mismatch.

This change keeps the existing `TcpExt` fields and emits a matching `TcpExt` value row populated with zeroes for the stats gVisor does not track yet. That resolves the header/data length mismatch without pretending to implement non-zero counters.

I also added a proc unit test for matching name/value field counts and enabled the existing `/proc/net/netstat` syscall format check under gVisor.

Validation:
- `gofmt -w pkg/sentry/fsimpl/proc/task_net.go pkg/sentry/fsimpl/proc/tasks_sys_test.go`
- `git diff --check`
- attempted `bazel test //pkg/sentry/fsimpl/proc:proc_test //test/syscalls/linux:proc_net_test` on macOS; local Bazel failed before executing tests due the host toolchain missing C++ standard library headers for external deps.
- attempted `SDKROOT=$(xcrun --show-sdk-path) ... bazel test //pkg/sentry/fsimpl/proc:proc_test`; local Bazel then failed before executing tests because `/usr/bin/aarch64-linux-gnu-gcc` is not installed.
- attempted `go test ./pkg/sentry/fsimpl/proc`; unsupported for this repo checkout because generated proto packages/build-constrained files are provided through Bazel.
FUTURE_COPYBARA_INTEGRATE_REVIEW=#13275 from Haihan-Jiang:codex/gvisor-netstat-values f1d47ac
PiperOrigin-RevId: 924992742
copybara-service Bot pushed a commit that referenced this pull request Jun 11, 2026
Fixes #13151.

`/proc/net/netstat` currently emits only the `TcpExt` field-name row in gVisor. Linux emits netstat rows in name/value pairs, and consumers such as metric parsers expect the value row to have the same number of fields as the header row. Without the value row, parsers report a field-count mismatch.

This change keeps the existing `TcpExt` fields and emits a matching `TcpExt` value row populated with zeroes for the stats gVisor does not track yet. That resolves the header/data length mismatch without pretending to implement non-zero counters.

I also added a proc unit test for matching name/value field counts and enabled the existing `/proc/net/netstat` syscall format check under gVisor.

Validation:
- `gofmt -w pkg/sentry/fsimpl/proc/task_net.go pkg/sentry/fsimpl/proc/tasks_sys_test.go`
- `git diff --check`
- attempted `bazel test //pkg/sentry/fsimpl/proc:proc_test //test/syscalls/linux:proc_net_test` on macOS; local Bazel failed before executing tests due the host toolchain missing C++ standard library headers for external deps.
- attempted `SDKROOT=$(xcrun --show-sdk-path) ... bazel test //pkg/sentry/fsimpl/proc:proc_test`; local Bazel then failed before executing tests because `/usr/bin/aarch64-linux-gnu-gcc` is not installed.
- attempted `go test ./pkg/sentry/fsimpl/proc`; unsupported for this repo checkout because generated proto packages/build-constrained files are provided through Bazel.
FUTURE_COPYBARA_INTEGRATE_REVIEW=#13275 from Haihan-Jiang:codex/gvisor-netstat-values f1d47ac
PiperOrigin-RevId: 924992742
@copybara-service
copybara-service Bot merged commit b5ab9cb into gvisor:master Jun 11, 2026
5 checks passed
hanzo-dev pushed a commit to hanzoai/visor that referenced this pull request Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready to pull Causes the PR to be imported into Google. Will be removed soon.

2 participants