15 Commits

Author SHA1 Message Date
gVisor bot f80fd97720 Internal change.
PiperOrigin-RevId: 691911396
2024-10-31 13:17:28 -07:00
Jing Chen 7cc17225e6 Remove references to math/rand package's Read function.
The helper function is deprecated. The package gvisor.dev/gvisor/pkg/rand
depends on crypto/rand which performs worse thatn math/rand, the changes
are fine since they are not at any gVisor's hot path.

The ultimate goal is to migrate math/rand to math/rand/v2.
2024-10-16 18:17:15 +00:00
Koichi Shiraishi 0cf77c02f8 all: remove use io/ioutil deprecated package & fix some deprecated thing
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
2024-10-10 20:36:24 +09:00
Tiwei Bie 2f01e3fb90 Add an EROFS test in container tests
This patch adds an EROFS test which checks that the checksums we get
from the target directory in container are identical with the ones
got from the source directory that we used to create the EROFS images.

erofs-utils is also added to the default image and will be used to
build the EROFS images during the test.

Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
2023-10-06 01:00:30 +08:00
Nicolas Lacasse e7bd1b4c9c Implement PR_{S,G}ET_CHILD_SUBREAPER.
Closes #2323

PiperOrigin-RevId: 548205854
2023-07-14 13:19:25 -07:00
Etienne Perot 2b9a971a71 Expand test_app syscall to support syscall arguments.
PiperOrigin-RevId: 520677631
2023-03-30 10:29:30 -07:00
Adin Scannell 1ceb814544 Add default_applicable_licenses rules to packages.
PiperOrigin-RevId: 513581243
2023-03-02 10:50:04 -08:00
Ayush Ranjan a53b22ad52 Add self medium to overlay2.
This medium instructs runsc to place the overlay-backing host file inside the
mount being overlayed itself. The file is placed inside the root directory of
the mount at path `.gvisor.overlay.img.{CID}/filestore-{random}`.

Note that the same volume may be mounted at various places in the same
container. Furthermore, the same volume may be mounted by multiple containers
in the same pod. So we create a filestore directory in the mount which is
unique to each container. This filestore directory hosts all the filestore
files for the mount for the given container. This directory is destroyed along
with the contianer on `runsc delete`.

The self medium based host file is a named file because it needs to be
discoverable via path traversal from the host. For the root mount, this allows
k8s to scan the container's root filesystem and apply local ephemeral storage
limits appropriately. This makes self medium appropriate for k8s usage.

Note that the overlay host file (MemoryFile) is a sparse file. Thankfully k8s
uses stat.st_blocks to perform accounting, not stat.st_size. stat.st_blocks
indicates the number of pages allocated towards a file, which works well with
sparse files.

PiperOrigin-RevId: 507301254
2023-02-05 11:08:47 -08:00
Ayush Ranjan 44e0246e29 Add multi-container test to check for memory leaks when using overlay filestore.
When a container exits, it releases all its filesystems. If an overlay was
configured, the tmpfs upper mount is released. Any files created in the overlay
should be deleted and the memory released. Add a test to verify that no such
memory is leaked when containers exit.

I had to add a new OverlayFileUsage method to containerManager to test this
accurately.

I tested the test by intentionally introducing a bug in tmpfs to not release
data from its memory file and this test failed with the following errors:
```
overlay filestore usage changed: old = 0, new = 4096
overlay filestore usage changed: old = 0, new = 8192
overlay filestore usage changed: old = 0, new = 12288
```

This shows that the file created by each sub-containers occupied a different
page in the filestore, which was not cleaned up and hence the test failed.

PiperOrigin-RevId: 501088426
2023-01-10 14:04:52 -08:00
Kevin Krakauer d8aa09e04c convert uses of interface{} to any
Done via:
  find . -name "*.go" | xargs sed -i -E 's/interface\{\}/any/g'

PiperOrigin-RevId: 487033228
2022-11-08 13:14:06 -08:00
Nicolas Lacasse 3fb646ed10 Rename go files that contain "main" function to main.go.
This is a good Go convention that we should follow.

PiperOrigin-RevId: 378538679
2021-06-09 17:36:51 -07:00
Fabricio Voznika 394c6089c3 Fix test_app task-tree
Executing `select {}` to wait forever triggers Go runtime deadlock
detection and kills the child, causing the number actual processes
be less than expected.

PiperOrigin-RevId: 376298799
2021-05-27 19:55:03 -07:00
Adin Scannell 4e03e87547 Fix simple mistakes identified by goreportcard.
These are primarily simplification and lint mistakes. However, minor
fixes are also included and tests added where appropriate.

PiperOrigin-RevId: 351425971
2021-01-12 12:38:22 -08:00
Adin Scannell 4cba3904f4 Remove existing nogo exceptions.
PiperOrigin-RevId: 347047550
2020-12-11 12:06:49 -08:00
Adin Scannell 1481499fe2 Simplify Docker test infrastructure.
This change adds a layer of abstraction around the internal Docker APIs,
and eliminates all direct dependencies on Dockerfiles in the infrastructure.

A subsequent change will automated the generation of local images (with
efficient caching). Note that this change drops the use of bazel container
rules, as that experiment does not seem to be viable.

PiperOrigin-RevId: 308095430
2020-04-23 11:33:30 -07:00