Skip to content

microvm: forward sysctls and lift the guest's privileged-port limit to match gVisor - #1904

Open
Davanum Srinivas (dims) wants to merge 3 commits into
agent-substrate:mainfrom
dims:pr/microvm-sysctls
Open

Davanum Srinivas (dims) wants to merge 3 commits into
agent-substrate:mainfrom
dims:pr/microvm-sysctls

Conversation

@dims

@dims Davanum Srinivas (dims) commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

A micro-VM container that drops NET_BIND_SERVICE could not bind a port below 1024; the same container on gVisor could, since its network stack has no privileged-port limit.

The kata agent now receives the spec's sysctls, and ShapeMicroVM sets net.ipv4.ip_unprivileged_port_start=0, so both runtimes behave the same. Neither sets no_new_privileges; gVisor runs with --allow-suid since #2361, so setuid binaries work on both.

The capabilities e2e suite gains a drop-ALL template whose probe listens on port 80, and the probe reports NoNewPrivs, asserted off on both lanes.

  • Tests pass: go test -race ./internal/ocispec/..., GOOS=linux go vet on kata and ocispec, go vet ./internal/e2e/...; e2e on both lanes in CI.
  • Appropriate changes to documentation are included in the PR: docs/api-guide.md.

@dims
Davanum Srinivas (dims) marked this pull request as ready for review September 25, 2026 23:52
@dims
Davanum Srinivas (dims) marked this pull request as draft September 26, 2026 02:19
@dims Davanum Srinivas (dims) changed the title microvm: forward Linux.Sysctl to the kata agent and allow low ports microvm: parity with gVisor for sysctls, low ports and no_new_privileges Sep 26, 2026
@dims
Davanum Srinivas (dims) force-pushed the pr/microvm-sysctls branch 3 times, most recently from 3eb0b33 to 4c25c22 Compare September 27, 2026 02:00
@dims
Davanum Srinivas (dims) marked this pull request as ready for review September 27, 2026 02:25
@dims

Copy link
Copy Markdown
Collaborator Author

@BenTheElder

Copy link
Copy Markdown
Collaborator

Both stay out of Build: runsc restore compares Sysctl and Process with the checkpoint-time spec, so a shared default would break restores of older gVisor snapshots

we have no back compat right now and aggressively prefer the approach that is more correct / maintainable long-term than accruing halfway compat attempts

@dims

Copy link
Copy Markdown
Collaborator Author

thanks Tim Hockin (@thockin) Benjamin Elder (@BenTheElder) i've removed backward compat stuff.

@bowei Bowei Du (bowei) added area/security Security related issue/pr kind/bug Something isn't working / bugfixes labels Sep 30, 2026

@mayawang Maya Wang (mayawang) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good. One question on where these two settings live, following Ben's note above.

Comment thread internal/ocispec/microvm.go Outdated
@dims Davanum Srinivas (dims) changed the title microvm: parity with gVisor for sysctls, low ports and no_new_privileges microvm: forward sysctls, allow low ports; set no_new_privileges on every container Oct 1, 2026
Comment thread internal/ocispec/ocispec.go Outdated
Comment thread internal/ocispec/microvm.go
Comment thread docs/upgrade.md Outdated
Comment thread docs/api-guide.md Outdated
Comment thread docs/api-guide.md Outdated
@dims
Davanum Srinivas (dims) force-pushed the pr/microvm-sysctls branch 4 times, most recently from fda5193 to 8bfff79 Compare October 17, 2026 11:59
@dims Davanum Srinivas (dims) changed the title microvm: forward sysctls, allow low ports; set no_new_privileges on every container microvm: forward sysctls and lift the guest's privileged-port limit to match gVisor Oct 17, 2026
@dims

Copy link
Copy Markdown
Collaborator Author

thanks Benjamin Elder (@BenTheElder) fixed this up as #2361 merged

The agent honors sysctls, and net.* keys need no network namespace of
their own, which is what ateom-microvm produces.
Set net.ipv4.ip_unprivileged_port_start=0 in ShapeMicroVM. gVisor has no
privileged-port check and runsc ignores this sysctl, so only the guest
kernel needs it.
The probe listens on port 80, so a caps-none template proves the bind on
both runtimes. The probe also reports NoNewPrivs; neither runtime sets
it, and gVisor runs with --allow-suid.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/microVM area/security Security related issue/pr kind/bug Something isn't working / bugfixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants