Skip to content

proc: include values in /proc/net/netstat#13338

Open
copybara-service[bot] wants to merge 1 commit into
masterfrom
test/cl924992742
Open

proc: include values in /proc/net/netstat#13338
copybara-service[bot] wants to merge 1 commit into
masterfrom
test/cl924992742

Conversation

@copybara-service
Copy link
Copy Markdown

proc: include values in /proc/net/netstat

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=proc: include values in /proc/net/netstat #13275 from Haihan-Jiang:codex/gvisor-netstat-values f1d47ac

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 added the exported Issue was exported automatically label Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

exported Issue was exported automatically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/proc/*/net/netstat is missing the value row

1 participant