Commit Graph
102 Commits
Author SHA1 Message Date
Lucas ManningandgVisor bot 33c1b3856d Fix debug builds.
This change also adds instructions for using a debugger with syscall tests.

Fixes #9039

PiperOrigin-RevId: 563576842
2023-09-07 16:28:00 -07:00
Lucas ManningandgVisor bot 586bf2016a Fix the delay-for-debugger flag so that it reports test failures.
The wait command will always return 0 even if the underlying process
returns a different exit code. It prints out the exit code of the process
to its stdout as json.

PiperOrigin-RevId: 557877257
2023-08-17 11:07:39 -07:00
Ayush RanjanandgVisor bot ef4fb56055 Get rid of unnecessary tmpfs bind mount when fileAccess = shared.
This is unnecessary because fileAccess=shared causes the rootfs mount to have
shared gofer mode. So we don't need a separate bind mount to force shared mode.

Fixes f12ca103ca ("test: Create a separate /tmp mount only for tests with the
shared tag")

PiperOrigin-RevId: 537213357
2023-06-01 21:50:17 -07:00
Lucas ManningandgVisor bot 5a6b502a87 Add fuse dimension to perf microbenchmarks.
PiperOrigin-RevId: 534916754
2023-05-24 11:25:57 -07:00
Lucas ManningandgVisor bot bb5d1731d6 Add FUSE dimension to gvisor macrobenchmarks.
PiperOrigin-RevId: 534131305
2023-05-22 11:35:58 -07:00
Lucas ManningandgVisor bot 681bcc0d45 Add FUSE dimension to microbenchmarks.
PiperOrigin-RevId: 532901869
2023-05-17 14:10:07 -07:00
Ayush RanjanandgVisor bot 416eb4d6d6 Prepare to make directfs the default in runsc.
We plan on making --directfs=true the default for runsc. That will be a
risky change which might need rollbacks. This change is in preparation for
that so that the breaking change has a small delta.

PiperOrigin-RevId: 532670826
2023-05-16 22:07:39 -07:00
Nicolas LacasseandgVisor bot 78be58e783 Partial rollback of cl/522685544.
To re-enable hostinet tests that require CAP_NET_RAW and CAP_NET_ADMIN.

PiperOrigin-RevId: 526701516
2023-04-24 11:20:47 -07:00
Ayush RanjanandgVisor bot da72cf686d Add directfs test variant to syscall tests.
PiperOrigin-RevId: 524084716
2023-04-13 13:24:16 -07:00
Nicolas LacasseandgVisor bot c07dc2673f Implement hostinet.Stack methods that manipulate interfaces and addresses.
And enable all of the netlink tests that depend on this functionality.

Specifially, this CL implements hostinet.stack:
* .RemoveInterface()
* .AddInterfaceAddr()
* .RemoveInterfaceAddr()

Applications use netlink messages to call into these methods. For hostinet, we
use netlink messages to the host to implement these methods.

Note that the netlink messages are not simple passed from the application to
the host -- they are parsed first and only carefully crafted messages are sent
to the host.

This CL required a lot of refactoring to the existing netlink code in the
hostinet package, as well as a bunch of new functionality. All of that code has
been collected in hostinet/netlink.go

I also changed how we handle CAP_NET_ADMIN and CAP_NET_RAW in tests, since we
must drop those capabilities inside the sandbox if we don't have them on the
host. The new solution is cleaner and does not rely on google-specific env
variables.

PiperOrigin-RevId: 522685544
2023-04-07 14:33:21 -07:00
Kevin KrakauerandgVisor bot 34f2f25bc0 enable GRO in syscall tests
GRO should be totally transparent and should not affect behavior.

PiperOrigin-RevId: 518424809
2023-03-21 17:21:20 -07:00
Kevin KrakauerandgVisor bot 575847947b Automated rollback of changelist 516870932
PiperOrigin-RevId: 516937389
2023-03-15 14:56:55 -07:00
Kevin KrakauerandgVisor bot cc4b14b884 gro: fix bug where handshake packets would be stuck waiting in GRO
Also enables GRO in syscall tests. GRO should be totally transparent and should
not affect behavior. This ensures it's tested and fixes the bug it uncovered.

GRO would not immediately flush the final ACK in the SYN-SYN/ACK-ACK handshake.
This could lead to a situation where

- Client A calls connect(), which returns once the final ACK of the handshake
  is sent and A reaches state ESTABLISHED
- The ACK gets GRO'd, delaying it from reaching the server
- Client B calls non-blocking connect()
- Client B's ACK gets GRO'd as well
- Client B is marked as ESTABLISHED
- The server, with accept queue size 1, is only going to accept one connection,
  but two clients are ESTABLISHED.

It now immediately flushes packets with no payload, as they are important to
TCP connection state and management.

PiperOrigin-RevId: 516870932
2023-03-15 10:54:43 -07:00
Ayush RanjanandgVisor bot 8a167a5f72 Prepare to make root overlay the default.
We plan on making --overlay2=root:self the default for runsc. That will be a
risky change which might need rollbacks. This change is in preparation for
that. We manually set --overlay2=none in places where we don't want the
overlay configuration to impact. This change should be a noop. The intention
for this change is to make the risky change very small and limited to just
flipping a flag.

PiperOrigin-RevId: 513930702
2023-03-04 00:46:47 -08:00
Adin ScannellandgVisor bot 2911d8c3b8 Add default_applicable_licenses rules to packages.
PiperOrigin-RevId: 513581243
2023-03-02 10:50:04 -08:00
Lucas ManningandgVisor bot b9e8295bb2 Add delay-for-debugger option to the test runner.
This enabling this option prints out the sandbox PID and waits for the
specified duration. This makes it much easier to attach a debugger like
delve to the sandbox process.

PiperOrigin-RevId: 513564358
2023-03-02 09:48:52 -08:00
Nicolas LacasseandgVisor bot 42fd695098 runsc requires CAP_NET_RAW with network=host and raw sockets enabled.
We must have CAP_NET_RAW to create raw sockets with hostinet. This change makes
the runsc Loader fail if hostinet+raw sockets are configured but we do not have
the necessary capability.

PiperOrigin-RevId: 513417124
2023-03-01 20:17:37 -08:00
Ayush RanjanandgVisor bot 755cbdca2f Deflake test/syscalls:connect_external_test_native.
This native test was flaking on Buildkite because it would timeout. The test
itself would pass but I think a cleanup stage would hang indefinitely. Such a
hang would only happen when one of the cleaners from uds.go:createPipeReader()
would fail with the following log:
`Failed to kick pipe reader: open /tmp/sockets930502909/pipe/out: no such
device or address`.

The connect_external_test does not even use pipes. It is unnecessary setup and
cleanup steps. Furthermore, test logs are very noisy from these such setup and
cleanup steps for tests that are not even run.

Although I am not sure why failing to kick the pipe reader would cause the test
to hang, I have split out the setup done in `CreateSocketTree()` into 3 parts:
1. Creating a UDS tree so that sandbox can connect to it.
2. Create connectors outside sandbox who connect to sockets created by sandbox.
3. Creating pipes outside the sandbox that sandbox can read/write to.

I also split the test targets into separate tests. These setup steps are only
done for their respective tests. Makes the logs more relevant, gets rid of
unnecessary steps and failures and deflakes the native connect test.

PiperOrigin-RevId: 511128400
2023-02-21 01:11:38 -08:00
Lucas ManningandgVisor bot e36b094745 Enable write and fallocate tests for FUSE.
This change also stubs out some methods that will be needed to
implement mmap.

PiperOrigin-RevId: 509298123
2023-02-13 12:17:57 -08:00
Lucas ManningandgVisor bot 04a5f6e473 Give FUSE hard link capabilities and enable the link syscall test.
PiperOrigin-RevId: 507001947
2023-02-03 15:00:04 -08:00
Lucas ManningandgVisor bot 3b92144583 Enable more FUSE syscall tests.
Several syscall tests are working after refactoring inode operations.
This change also renames the use_fusefs test attribute to add_fusefs,
since that more accurately describes what the attribute does.

PiperOrigin-RevId: 506692314
2023-02-02 12:27:24 -08:00
Lucas ManningandgVisor bot fd8e6fd97e Refactor FUSE inode implementation.
This change replaces the FUSE inode implementations with a custom
inode type that implementsthe kernfs.Inode interface. It also cleans
up some of the attribute related functions and gets the open_test to
pass.

PiperOrigin-RevId: 506465698
2023-02-01 17:20:22 -08:00
Lucas ManningandgVisor bot 25bb8ba650 Add more internal logging to fuse syscall tests
PiperOrigin-RevId: 506445741
2023-02-01 15:56:18 -08:00
Lucas ManningandgVisor bot 91b6c3f428 Fix flakiness in FUSE syscall tests.
PiperOrigin-RevId: 506082577
2023-01-31 12:41:11 -08:00
Ayush RanjanandgVisor bot 710955192d Add dir= prefix in overlay2 flag's medium.
This is to make it clear that the host file will be created inside this
directory. This also makes it look cleaner when other medium options are added
later.

PiperOrigin-RevId: 505033408
2023-01-26 22:56:52 -08:00
Fabricio VoznikaandgVisor bot 96ed0ca2cc Log seccomp from spec
Only log if OCI seccomp flag is enabled, otherwise the seccomp field
is ignored.

PiperOrigin-RevId: 504640124
2023-01-25 13:06:09 -08:00
Lucas ManningandgVisor bot 6e095583b8 Create a new test dimension that mounts a FUSE fs on /tmp.
If you add "use_fusefs=True" to a syscall test, it generates a new test
target denoted with _fuse at the end. This target runs a shim binary
that mounts a FUSE fs at /tmp and runs a server that forwards all
filesystem ops to /fuse. Once the FUSE is mounted, the shim execs the normal
test binary.

This new dimension should help test the correctness of our FUSE implementation.
All relevant tests that already pass have the use_fusefs enabled. The rest
are still broken.

PiperOrigin-RevId: 501059036
2023-01-10 12:13:09 -08:00
Rahat MahmoodandgVisor bot b47ecb8223 Disable io_uring syscalls by default.
The current io_uring support is very limited and experimental. Disable
it by default, and add a flag to enable it for testing.

PiperOrigin-RevId: 500760451
2023-01-09 11:11:57 -08:00
Lucas ManningandgVisor bot 9343d1484d Remove FUSE feature flag and enable by default.
PiperOrigin-RevId: 493410677
2022-12-06 14:22:34 -08:00
329def4002 Add overlay2 flag in runsc.
--overlay2 flag supersedes --overlay flag. It allows more granular
configuration for overlayfs in runsc. It does so in two ways:

1. Allows to apply overlay on all mounts or only the root mount.
   --overlay applies overlay to all mounts.
2. Allows to specify if overlay's upper layer should be backed by
   container memory or disk. --overlay always used container memory.

Allowing tmpfs to be backed by a file on disk prevents the container
memory from bloating up. Note that the tmpfs filesystem tree will
still be stored in sentry memory.

Using overlay on the root filesystem, helps avoid expensive
communication with the gofer process. The root filesystem of the
container is not preserved across container lifecycle. So we don't
need to keep updating the host filesystem, which will anyways be
destroyed once the container is destroyed. It is wasted effort.
Instead we keep all the changes to the root filesystem in tmpfs which
is directly accessible by the sentry.

The host file is created as an unnamed file using O_TMPFILE. Support
has been added for sub-containers too. Save/restore support is
still lacking.

Co-authored-by: Andrei Vagin <[email protected]>
PiperOrigin-RevId: 491988485
2022-11-30 12:29:14 -08:00
Ayush RanjanandgVisor bot 4e0477f352 Remove testing for 9P.
LISAFS is now default.
Updates #7911

PiperOrigin-RevId: 488442569
2022-11-14 12:48:20 -08:00
Ayush RanjanandgVisor bot bcff13c793 Get connect external tests to work natively.
- Use the correct paths for sockets based on environment variables.
- Doing a double-bind(2) before listen(2) causes subsequent double-bind(2) after
  listen(2) to fail with EADDRINUSE on Linux somehow. Avoid tripping that
  behavior in the test.
- Do not run BindListenAccept test with TEST_UDS_ATTACH_TREE parameter.

PiperOrigin-RevId: 488430850
2022-11-14 12:03:55 -08:00
Kevin KrakauerandgVisor bot 3a76efe831 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
Fabricio VoznikaandgVisor bot 44695888ee Allow fsgofer to open pipes that connect with host
It requires setting the flag `--host-fifo=open`, otherwise the caller will not
be allowed to open host FIFOs (or named pipes) to protect the host by default.

Closes #8037

PiperOrigin-RevId: 483787839
2022-10-25 15:16:37 -07:00
Fabricio VoznikaandgVisor bot 3282365494 Replace fsgofer-host-uds flag
The new `host-uds` flag has the following differences:

  * More granular control: user can specify whether to ignore host UDS,
    connect to an existing host UDS, create a host UDS, or both
  * Will shortly be used to also control pipes from the host, hence the
    removal of UDS from the name
  * Can be used with other filesystems, not gofer-based, hence the
    removal of fsgofer from the name

This change also removes support for bind() from 9P based gofer since it's
not supported and would make this change more complicated.

Updates #8037

PiperOrigin-RevId: 483538832
2022-10-24 18:26:44 -07:00
Andrei VaginandgVisor bot 007d013e66 Don't run each test case in a separate sandbox
This change was inspired by the Fabricio's change:
2bf42fffda ("Run shards in a single sandbox")

PiperOrigin-RevId: 480151140
2022-10-10 12:41:58 -07:00
Fabricio VoznikaandgVisor bot 1565387b3e Add runsc usage to list of commands
Also make `runsc debug` write to stdout and log file to make it
easier to see the output when running the command manually.

PiperOrigin-RevId: 470042053
2022-08-25 11:40:36 -07:00
Ayush RanjanandgVisor bot b13c9d70d2 Change test targets to use _p9 if p9 is enabled.
lisafs is default. So we should not have all targets be generated
with _lisafs. Also if nothing is specified, then lisafs should run.
Which is not the case right now.

PiperOrigin-RevId: 469770835
2022-08-24 10:55:30 -07:00
Ayush RanjanandgVisor bot 5d71ecdddf Enable lisafs by default for runsc.
Made some other changes:
- We no longer generate a separate runtime for p9 on `make
  dev`.
- We no longer run p9 runtime tests. Instead run lisafs runtime
  tests on presubmits.
- All tests are generated with lisafs. Only 1 p9 variant is
  generated with default platform.
- Run integration tests only with lisafs.

P9 is now considered deprecated.

Use `--lisafs=false` if you need to disable it. Make sure to
report a bug if you have the need to disable LISAFS.

Fixes #6319

PiperOrigin-RevId: 469548694
2022-08-23 13:58:27 -07:00
Kevin KrakauerandgVisor bot 604e31c82b remove references to nonexistent directory
PiperOrigin-RevId: 462728462
2022-07-22 16:34:50 -07:00
Fabricio VoznikaandgVisor bot bcd0cc6fb1 Enable all trace points for syscall tests
Enable all trace points while running syscall tests to catch possible
crashes and bugs that may exist. These are not verifying that the data
in the points are correct though. Since all trace points are platform
agnostic for now, only enable them for ptrace.

Updates #4805

PiperOrigin-RevId: 455232093
2022-06-15 15:22:12 -07:00
Etienne PerotandgVisor bot c99645a922 Test runner: Containerize host-networking syscall tests by default.
PiperOrigin-RevId: 454248722
2022-06-10 15:03:22 -07:00
Etienne PerotandgVisor bot e994bbb096 Disable tests for platforms tagged with "internal".
PiperOrigin-RevId: 453554360
2022-06-07 16:42:18 -07:00
Etienne PerotandgVisor bot cd32bef37d Export GVISOR_PLATFORM_SUPPORT environment variable for tests.
This environment variable encodes what capabilities the platform
supports, and is consumed by `platform_util.cc` to determine
which syscall tests are appropriate to run.

PiperOrigin-RevId: 452870567
2022-06-03 17:04:01 -07:00
Ayush RanjanandgVisor bot 042dac5db2 Enable all tests for lisafs.
- Generates a lisafs variant of all syscall tests.
- Adds Makefile targets to run runtime tests with lisafs. We run runtime tests
  continuously (on every commit to master) and on presubmits iff the commit
  message contains "lisafs".
- Updates the docker tests target to run the integration tests with lisafs too.

Fixes #5466

PiperOrigin-RevId: 433782954
2022-03-10 10:09:05 -08:00
Ayush RanjanandgVisor bot 6e4b110592 Do not generate native variants for verity benchmarks.
PiperOrigin-RevId: 431006942
2022-02-25 12:38:30 -08:00
Ayush RanjanandgVisor bot f6263c38df Remove VFS1 special handling in tests.
Also clean up usage of GVISOR_VFS environment variable.
Updates #1624

PiperOrigin-RevId: 429100450
2022-02-16 11:41:51 -08:00
Ayush RanjanandgVisor bot 821e6a0af4 Do not generate VFS1 tests.
Updates #1624

PiperOrigin-RevId: 429085588
2022-02-16 10:41:44 -08:00
Adin ScannellandgVisor bot e52546f46f Support STAGED_BINARIES to run prebuilt binaries with the test pipeline.
In some cases, it may be desirable to prebuild binaries and run all tests,
for example to run benchmarks with various experiments. Allow the top-level
Makefile to support this by checking for a STAGED_BINARIES variable.

PiperOrigin-RevId: 410673120
2021-11-17 17:49:35 -08:00
Fabricio VoznikaandgVisor bot 96c91b20ac Enable VFS2 by default
This change enables VFS2 by default. VFS2 is much faster than the previous
implementation and it's also more compatible. VFS1 is no longer supported and
will be deleted from the code.

Use `--vfs2=false` if you need to disable it. Make sure to report a bug if you
have the need to disable VFS2 or something is not working for you.

Closes #1035

PiperOrigin-RevId: 404898135
2021-10-21 15:48:25 -07:00