159 Commits
Author SHA1 Message Date
Etienne PerotandgVisor bot 4e53fafea2 Use //:release rather than //runsc target for all gVisor test usage
PiperOrigin-RevId: 973178774
2026-08-29 12:57:17 -07:00
Ryan El KochtaandgVisor bot 32276e423f dockerutil: fix docker version parsing
AFAICT previously the function was parsing the Docker *client* version, since
the output of `docker version` has the client version first, which gets picked
up by the `re.FindStringSubmatch()` since it finds the _first_ match:

```
$ docker version
Client: Docker Engine - Community
 Version:           29.6.2
 API version:       1.55
 Go version:        go1.26.5
 Git commit:        dfc4efb
 Built:             Thu Jul 16 16:12:34 2026
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          29.6.2
  API version:      1.55 (minimum version 1.40)
  Go version:       go1.26.5
  Git commit:       3d80467
  Built:            Thu Jul 16 16:12:34 2026
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v2.2.6
  GitCommit:        11ce9d5f3c68c941867e82890e93e815c1304f1b
 runc:
  Version:          1.3.6
  GitCommit:        v1.3.6-0-g491b69ba
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

```

PiperOrigin-RevId: 966681719
2026-08-18 10:47:59 -07:00
Parth SarthiandgVisor bot 4955a45979 docker_image_test: Add logs to help debug the failure.
PiperOrigin-RevId: 963962507
2026-08-13 02:48:37 -07:00
gVisor bot ce8bc5b9b5 Merge pull request #13976 from luiscape:luis/add-support-for-610.57.04
PiperOrigin-RevId: 963219569
2026-08-11 22:49:18 -07:00
Parth SarthiandgVisor bot d49715b660 DockerInGvisor: Try to deflake the docker test.
- `WaitExitStatus` - Return on error/timeout.

PiperOrigin-RevId: 961115658
2026-08-07 14:17:57 -07:00
gVisor bot a6f4af8051 Merge pull request #13929 from EtiennePerot:sentry-binary
PiperOrigin-RevId: 959992675
2026-08-05 19:00:10 -07:00
gVisor bot 4b413396c3 Merge pull request #13851 from EtiennePerot:posture
PiperOrigin-RevId: 959857642
2026-08-05 14:05:43 -07:00
Shailend ChandandgVisor bot b80feec111 Add more systemd integ tests
Add e2e tests for systemd's event-driven activation mechanisms and the
sd_notify watchdog protocol:

- TestSystemdTimer: transient timer units fire repeatedly on both the
  monotonic (OnActiveSec/OnUnitActiveSec) and the realtime (OnCalendar)
  clocks.
- TestSystemdDBusActivation: a bus call to org.freedesktop.hostname1
  starts systemd-hostnamed on demand.
- TestSystemdSocketActivation: with only ssh.socket started, the first
  connection starts ssh.service, which serves it on the inherited
  listening socket.
- TestSystemdWatchdog: a Type=notify service with WatchdogSec= stays up
  while it pings the watchdog, and is killed with Result=watchdog once
  the pings stop.

All TestSystemd* tests now run in parallel, each in its own container.

The systemd entry on the website's compatibility page is also updated.

PiperOrigin-RevId: 958778081
2026-08-03 22:07:45 -07:00
Etienne Perot 5e7190b63b Implement shared "null netns" to avoid netns creation overhead on start
See issue #13764 for motivation and idea. This approach yields the
benefit without the security compromise of moving the fsgofer out of
a network-disabled netns, so it is a safe new default.

Benchmarks:

```
                            │ gofer-netns-new │          gofer-netns-null          │
                            │     sec/op      │   sec/op     vs base               │
OCIStartup/load=idle             118.6m ±  5%   119.3m ± 4%       ~ (p=0.756 n=40)
OCIStartup/load=netns-churn      236.5m ± 13%   215.2m ± 7%  -8.99% (p=0.033 n=20)
geomean                          167.5m         160.2m       -4.32%
```

`netns-churn` is simulated with this bash thingy in the background:

```
for j in $(seq 1 8); do
  ( while :; do unshare -n /bin/true; done ) &
done
```

The effect gets stronger at higher core counts on real servers.
2026-08-03 14:51:43 -07:00
Jing ChenandgVisor bot 8f3100f425 Support parallel execution and Docker isolation for integration tests
The change introduces a deterministic test sharding and isolates host Docker
daemon operations across concurrent workers.

assisted-by:agy
PiperOrigin-RevId: 954858449
2026-07-27 15:27:08 -07:00
Etienne Perot 3ebcc06dc0 Add sandbox security posture integration test.
This verifies that a running Sentry (`runsc boot`) process's host kernel
state matches the state we expect it to be once it starts running untrusted
code.

Useful for defense-in-depth, and to assert that future startup
optimizations do not regress gVisor's security.

Updates issue #13718.
2026-07-24 19:33:31 -07:00
Ayush RanjanandgVisor bot af745f8b6c Update UTS namespace hostname/domainname on restore.
This change modifies the UTS namespace to track whether the hostname or
domainname has been explicitly changed by the application. During a restore
operation, the UTS namespace values are updated from the new sandbox
specification, but only if they were not previously modified by the application
inside the sandbox. This ensures that user-set values are preserved across
checkpoint/restore, while allowing spec-defined values to be applied if the UTS
namespace was in its default state.

Furthermore, made another bug fix: The initial UTS namespace creation was being
done with domainName=hostname. Now we correctly use domainname from the spec.

PiperOrigin-RevId: 934963603
2026-06-19 09:43:24 -07:00
Jing ChenandgVisor bot 630a6b2c38 Implement containerd Sandbox Controller API in runsc shim.
For now, all sandbox controller methods are implemented to return unimplemented
errors (errdefs.ErrNotImplemented).

Add an integration test to verify that
containerd correctly routes sandbox API calls to our shim when configured
with "sandboxer = shim" (or "sandbox_mode = "shim" for containerd 1.7), and
that the shim returns the expected unimplemented error.

PiperOrigin-RevId: 923663790
2026-05-29 16:47:29 -07:00
Jing ChenandgVisor bot de3ac4baf2 Fix pause/resume support in gVisor containerd shim
Fix #12647

PiperOrigin-RevId: 922881383
2026-05-28 11:29:34 -07:00
AnilAltinayandgVisor bot 006c184fdd Use a fresh container for exclusive GPU test execution.
Exclusive GPU tests(tests that are failed) now launch a dedicated container
instead of using one from the pre-warmed pool.

PiperOrigin-RevId: 915689394
2026-05-14 17:02:34 -07:00
gVisor bot 1e78fff2c3 Merge pull request #12791 from a7i:feat/shim-containerd-update
PiperOrigin-RevId: 908496620
2026-04-30 19:07:34 -07:00
AnilAltinayandgVisor bot 235500a37a Refactor common LLM testing utilities into llmutil.
This change moves the Server interface, DockerServer implementation, ResponseMetrics, APIResponse, and MakeAPIResponse functions from the individual LLM test packages (ollama, sglang, triton, vllm) into a new shared package llmutil. This reduces code duplication across the different LLM test clients.

PiperOrigin-RevId: 907987791
2026-04-29 23:59:25 -07:00
Nayana BidariandgVisor bot 1e6759d3d9 Remove usages of save-restore-netstack flag.
This flag has been true by default for a while, remove its usages and
deprecate the flag.

PiperOrigin-RevId: 903909652
2026-04-22 10:15:08 -07:00
Jing ChenandgVisor bot c9a6158a0c Clean up all containers, pods, sandboxes once root tests are completed.
Assisted-by: jetski
PiperOrigin-RevId: 901930379
2026-04-18 17:23:18 -07:00
Amir Alavi 01c5ff65b5 feat(shim): implement containerd Task.Update for cgroup resize
Wire shim Task.Update to runsc update with OCI LinuxResources JSON.
Extend runsc Container.Update for workload containers via compat cgroup
alongside the root sandbox cgroup. Consolidate runsc update CLI on the
shared merge path. Add criutil helper and crictl integration coverage.
2026-03-31 14:57:25 -04:00
Jing ChenandgVisor bot 8a58e753ac Replace github.com/kr/pty with github.com/creack/pty.
The repo github.com/kr/pty is archived and deprecated.

PiperOrigin-RevId: 879260088
2026-03-05 14:58:05 -08:00
Konstantin BogomolovandgVisor bot 4dfcd5e1ae nogo: Fix more analyzer findings.
PiperOrigin-RevId: 875246522
2026-02-25 11:07:15 -08:00
Jing ChenandgVisor bot 44497c276b Add the flag allow-rootfs-tar-annotation.
The flag controls the usage of gVisor rootfs tar file annotations.

PiperOrigin-RevId: 874205192
2026-02-23 12:42:32 -08:00
Kevin Mingtarja 645953d947 runsc: add update command
This change enables updating resource constraints of running containers. It is the runsc equivalent of runc update.
2026-01-23 23:01:08 -08:00
Tamir DubersteinandgVisor bot 7c117d1aca Update Go to 1.25.5
- **checkescape: improve error output**
  The output now includes stderr on failure e.g.:
  ```
  checkescape: tools/checkescape/test2/test2.go:98:6: stack: possible split on function entry (2 omitted) → (possible, error running "external/rules_go++go_sdk+main___download_0/bin/go tool objdump bazel-out/k8-fastbuild-ST-04c87098fb12/bin/tools/checkescape/test2/test2.a": exit status 2 (go: no such tool "objdump")) (GOOARCH=amd64, GOOS=linux)
  ```

  Simplify various bits of the implementation while I'm here:
  - Use a set of strings rather than a list to avoid some O(n) operations.
  - Use `CommandContext` to ensure proper cleanup.
  - Remove stderr pipe and goroutine by setting `Stderr` to a
    `bytes.Buffer`.
  - Use `bufio.Scanner` instead of manually calling
    `(*bufio.Reader).ReadString` and handling errors.
  - Remove `NextLine` loop label.
-  **go_stateify: plumb go binary to goimports**
    This avoids go_stateify relying on `go` being available outside of the
    bazel sandbox.
- **Update Go to 1.25.5**
  Reduce duplication of the version information in various places:
  - Use `go_sdk.from_file` instead of repeating the version encoded in
    `go.mod` in `MODULE.bazel`.

  Add a workaround to allow `objdump` to be lazily compiled in the manner
  introduced in https://go.dev/issue/71867 when invoked under bazel in
  checkescape.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/gvisor/pull/12452 from tamird:update-go 6c7f6400f5d3ea883096eef18d365c97f875bc68
PiperOrigin-RevId: 853572845
2026-01-07 23:11:36 -08:00
Jing ChenandgVisor bot 0b01881876 Enable rootfs only snapshot in runsc.
PiperOrigin-RevId: 819927696
2025-10-15 15:01:34 -07:00
Ayush RanjanandgVisor bot 04bc260625 Skip Docker restore tests on Docker v28+.
Docker's `restore` functionality is broken starting from v28 due to
https://github.com/moby/moby/issues/50750. This change adds a version check to
`dockerutil` and skips tests that rely on `docker restore` if the Docker
version is v28 or greater. TCP checkpoint/restore tests are also refactored to
centralize common setup and version checks.

PiperOrigin-RevId: 818827864
2025-10-13 14:20:57 -07:00
Jamie LiuandgVisor bot efc0252e67 Break runsc/config dependency on pkg/sentry/watchdog.
PiperOrigin-RevId: 817484566
2025-10-09 22:30:25 -07:00
gVisor bot cd0a180bac Merge pull request #12160 from avagin:bazel-mod-switch
PiperOrigin-RevId: 811952342
2025-09-26 14:17:25 -07:00
AV 7f81d98b53 bazel: switch to bzlmod completly
- Deletion of the WORKSPACE file. Dependencies are now managed in the MODULE.bazel file.
- Removal of --noenable_bzlmod and --enable_workspace from .bazelrc to enable bzlmod.
- Update paths in MODULE.bazel to be relative to the repository root.
2025-09-23 06:06:59 +00:00
Shailend ChandandgVisor bot 2c6185b9d1 Support privileged executables inside the sandbox
There is already some support for privileged executables before this change:
file capabilities were taken into account when creating new processes inside
the sandbox from external instigation (but not during execve(2)). set-user-id
and set-group-id bits were never taken into account, and the Sentry behaved
as if NO_NEW_PRIVS is always true. After this change, execve(2) and the
external Exec entry point both take the set-user(group)-id bits and file
capabilities into account.

Because NO_NEW_PRIVS can no longer be assumed to be always set, a couple of
extra checks to prevent privilege elevation during execve(2) are needed:
the presence of a ptracer and the use of a shared fsContext. Moreover,
execve had to be serialized with seccomp(2) when it is syncing filters to
all threads in a group. Serializing execve with PTRACE_ATTACH and seccomp
required some Task runState gymnastics.

Task dumpability is reset when privilege elevation takes place and privilege
elevation is denied for binaries living on nosuid mounts. To fix an old bug
where some aux vectors were populated using data from the old pre-execve
creds, the computation of the (file-privilege-augmented) creds during execve
now takes place before the stack for the new program is set up.

gvisor users who thus far have exec'd into the sandbox with UID as (sandbox)
root will lose the caps an all-powerful namespace root'd have if: 1) the binary
is a suid/guid binary 2) the owner of the binary is host root and there is
no mapping for host root in the host user namespace of the sandbox. To avoid
this surprise, the suid/sgid bits are ignored by default. Users can opt-in
via the --allow-suid flag.

One result of this change is that sudo now works inside the sandbox.

PiperOrigin-RevId: 794414101
2025-08-12 23:07:38 -07:00
Etienne PerotandgVisor bot d5f6cfd5a0 PGO: Reduce combinations of nginx benchmarks run for PGO purposes.
PiperOrigin-RevId: 785581845
2025-07-21 14:51:39 -07:00
Etienne PerotandgVisor bot 28f53fbdda iperf_test: Better debug logging on failure.
PiperOrigin-RevId: 785491613
2025-07-21 10:42:38 -07:00
Etienne PerotandgVisor bot 77fbe844ad PGO benchmarks: Only run a representative subset of benchmark tests.
Speeds up the PGO profile pipeline.

PiperOrigin-RevId: 784392458
2025-07-17 18:50:53 -07:00
Etienne PerotandgVisor bot 8f1257c31a Docker tests and benchmarks: Remove use of exposed ports.
All these tests and benchmarks rely on networking between containers,
not on these ports being exposed on the host, so there is no need to
expose them on the host.

This avoids random errors like "Error starting userland proxy:
listen tcp4 0.0.0.0:12345: bind: address already in use".

#codehealth

PiperOrigin-RevId: 778272096
2025-07-01 18:26:32 -07:00
Zach KoopmansandgVisor bot 9d5eb273d3 Add cuda_tests to gke_tester
PiperOrigin-RevId: 767435312
2025-06-04 22:30:25 -07:00
Nayana BidariandgVisor bot fd622c0fe8 Remove TESTONLY from the save restore netstack flag name.
PiperOrigin-RevId: 762056877
2025-05-22 11:53:48 -07:00
Ayush RanjanandgVisor bot 05e2a45d01 Validate the process spec on runsc run.
The run command was missing the process spec validation.

Updates #11736

PiperOrigin-RevId: 761704978
2025-05-21 16:07:04 -07:00
gVisor bot 5b8db7ad7d Internal change
PiperOrigin-RevId: 758837096
2025-05-14 14:39:07 -07:00
Zach KoopmansandgVisor bot a29d368fba Remove version flag from checking driver version
The --version flag is not supported on all driver versions w/
nvidia-smi. Remove it to get older driver versions to pass.

PiperOrigin-RevId: 752470520
2025-04-28 15:39:47 -07:00
Zach KoopmansandgVisor bot 79c036d8a4 Add 12.8 CUDA tests
Add 12.8 basic CUDA image and smoke tests. A later submission
will add CUDA tests similar to the current 12.2 tests.

PiperOrigin-RevId: 751593396
2025-04-25 16:16:48 -07:00
gVisor bot d3713e247b Internal change.
PiperOrigin-RevId: 739263572
2025-03-21 12:32:21 -07:00
Ayush RanjanandgVisor bot b950f71370 Add Container.RestoreInTest() to handle known Docker bugs.
This can be used by all test users. Avoids duplicated code. We can handle all
known issues in one place.

There is a Docker bug which causes restore to fail sporadically. See
https://github.com/moby/moby/issues/42900. This has been broken at least since
Docker v19.03.12 (when the issue was reported) and was fixed in v25.0.4. Added
the handling for this issue.

Also got rid of the testutil.Poll() around restore. That can hide gVisor
restore flakiness issues. That was added in 1ec5baeb31 ("Make
checkpoint/restore e2e test less flaky"). The original sleep has been restored.

PiperOrigin-RevId: 734303878
2025-03-06 15:13:16 -08:00
Etienne PerotandgVisor bot 39aba198a9 On COS, add NVIDIA library directory to LD configuration and update cache.
Unlike Ubuntu VMs where we use Docker's `--gpus` flag, COS VMs do not use
this flag and instead mount the NVIDIA library directories automatically.
However, nothing guarantees that these directories are added to the LD
config. This change fixes that. It take advantage of the fact that all GPU
tests have the sniffer binary as entrypoint, which slightly overloads the
role of the sniffer within the GPU test infrastructure... but then again
the ioctl sniffer is already deeply intertwined with ld configuration
because it already overrides the `ioctl` libc function, so this doesn't
seem like too big of a stretch.

This change makes the ffmpeg test succeed with `runc` on COS, but they still
fail with gVisor (with `CUDA_ERROR_OUT_OF_MEMORY` errors). So there must be
some further gVisor-specific error.

Updates #11351
Updates #11321

PiperOrigin-RevId: 715222952
2025-01-13 21:13:14 -08:00
Etienne PerotandgVisor bot 9101ab55ce Modify make rules to allow using a fully-local build cache.
This includes the ability to force using local images only (do not check
for updated manifests), and to explicitly mount and specify external caches
for Go repositories via `rules_go`'s `GO_REPOSITORY_USE_HOST_MODCACHE`.

PiperOrigin-RevId: 713473497
2025-01-09 12:23:53 -08:00
Ayush RanjanandgVisor bot 6eb6d6cbea Specify all capabilities in TestGPUCheckpointRestore.
This test was broken by 8e3b1bb7d4 ("Update CUDA test compatibility to keep
up with added gVisor support.") which requires all
images/gpu/cuda-tests/run_sample.go users to specify "all" driver capabilities.

PiperOrigin-RevId: 713170590
2025-01-07 23:28:03 -08:00
Etienne PerotandgVisor bot 8e3b1bb7d4 Update CUDA test compatibility to keep up with added gVisor support.
These CUDA tests were initially broken in gVisor but now appear to pass.

The test now also verifies that all capabilities are enabled when running.

PiperOrigin-RevId: 713094806
2025-01-07 17:28:00 -08:00
gVisor bot e7b2c426c5 Internal change
PiperOrigin-RevId: 698529562
2024-11-20 14:53:44 -08:00
Nayana BidariandgVisor bot 1bc1bb3b81 Restore listening connections when netstack s/r is enabled.
This CL restores the listening connections when netstack s/r is enabled.
The changes include:
- New method as a workaround to replace the new routes and nics to the loaded
stack after restore.
- New Restore() for transport layer protocols to restore the protocol level
background workers.
- Adds afterLoad() method for fdbased processors.
- Adds a test to verify listening connection is restored after checkpointing
with netstack s/r enabled.
- Few other changes to save restore fields to enable netstack s/r.

PiperOrigin-RevId: 698453124
2024-11-20 11:13:57 -08:00
gVisor bot d555c3baf3 Merge pull request #11030 from milantracy:rand
PiperOrigin-RevId: 688287238
2024-10-21 15:11:10 -07:00