Commit Graph

960 Commits

Author SHA1 Message Date
Zach Koopmans 988ab27058 Fix AllSocketPairTest for open source.
Setting timeouts for sockets on GCP images (debian) for usecs only
respects multiples of 4K. Set the test with a multiple of 4K with a comment.

PiperOrigin-RevId: 327093848
2020-08-17 14:04:20 -07:00
Ayush Ranjan e3e1b36896 [vfs] Do O_DIRECTORY check after resolving symlinks.
Fixes python runtime test test_glob.
Updates #3515

We were checking is the to-be-opened dentry is a dir or not before resolving
symlinks. We should check that after resolving symlinks.
This was preventing us from opening a symlink which pointed to a directory
with O_DIRECTORY.

Also added this check in tmpfs and removed a duplicate check.

PiperOrigin-RevId: 327085895
2020-08-17 13:26:31 -07:00
Nayana Bidari af433e159d Update README for packetimpact
PiperOrigin-RevId: 326733912
2020-08-14 14:49:14 -07:00
gVisor bot 3be8b49c70 Merge pull request #3375 from kevinGC:ipt-test-early-return
PiperOrigin-RevId: 326693922
2020-08-14 11:24:56 -07:00
Zach Koopmans e6ea59203b Skip UDPMulticast Tests when net interfaces aren't found.
PiperOrigin-RevId: 326686761
2020-08-14 10:53:04 -07:00
Julian Elischer 190634e0fc Give the ICMP Code its own type
This is  a preparatory commit for a larger commit working on
ICMP generation in error cases.
This is removal of technical debt and cleanup in the gvisor code
as part of gvisor issue 2211.

Updates #2211.

PiperOrigin-RevId: 326615389
2020-08-14 02:07:36 -07:00
Ayush Ranjan d6520e1d05 [vfs2][gofer] Fix file creation flags sent to gofer.
Fixes php runtime test ext/standard/tests/file/readfile_basic.phpt
Fixes #3516

fsgofers only want the access mode in the OpenFlags passed to Create(). If more
flags are supplied (like O_APPEND in this case), read/write from that fd will
fail with EBADF. See runsc/fsgofer/fsgofer.go:WriteAt()
VFS2 was providing more than just access modes. So filtering the flags using
p9.OpenFlagsModeMask == linux.O_ACCMODE fixes the issue.

Gofer in VFS1 also only extracts the access mode flags while making the create
RPC. See pkg/sentry/fs/gofer/path.go:Create()

Even in VFS2, when we open a handle, we extract out only the access mode flags
+ O_TRUNC.
See third_party/gvisor/pkg/sentry/fsimpl/gofer/handle.go:openHandle()

Added a test for this.

PiperOrigin-RevId: 326574829
2020-08-13 19:33:56 -07:00
Ayush Ranjan 5036f135e4 Disable vfs2 for socket_stress_test.
PiperOrigin-RevId: 326553620
2020-08-13 16:58:43 -07:00
Bhasker Hariharan b928d074b4 Ensure TCP TIME-WAIT is not terminated prematurely.
Netstack's TIME-WAIT state for a TCP socket could be terminated prematurely if
the socket entered TIME-WAIT using shutdown(..., SHUT_RDWR) and then was closed
using close(). This fixes that bug and updates the tests to verify that Netstack
correctly honors TIME-WAIT under such conditions.

Fixes #3106

PiperOrigin-RevId: 326456443
2020-08-13 09:04:31 -07:00
Ayush Ranjan 42b610d567 [vfs2][gofer] Return appropriate errors when opening and creating files.
Fixes php test ext/standard/tests/file/touch_variation5.phpt on vfs2.
Updates #3516

Also spotted a bug with O_EXCL, where we did not return EEXIST when we tried
to open the root of the filesystem with O_EXCL | O_CREAT.

Added some more tests for open() corner cases.

PiperOrigin-RevId: 326346863
2020-08-12 17:19:09 -07:00
gVisor bot e6df6222ac Merge pull request #3250 from craig08:fuse-getattr
PiperOrigin-RevId: 326313858
2020-08-12 14:36:04 -07:00
Fabricio Voznika 00b684ea7f Limit the scope when deleting test log directory on success
The code was deleting logs for all tests when a single test
passed. Change it to delete only the logs relevant to the
test at hand.

Also fixed the benchmark lookup code, which was always generating
a single empty benchmark entry if there were not benchmarks.

PiperOrigin-RevId: 326311477
2020-08-12 14:23:29 -07:00
Zach Koopmans 89f3197fc3 Mark integration tests as passing in VFS2 except CheckpointRestore.
Mark all tests passing for VFS2 in:
image_test
integration_test

There's no way to do negative look ahead/behind in golang test regex,
so check if the tests uses VFS2 and skip CheckPointRestore if it does.

PiperOrigin-RevId: 326050915
2020-08-11 10:37:32 -07:00
Craig Chi 51e64d2fc5 Implement FUSE_GETATTR
FUSE_GETATTR is called when a stat(2), fstat(2), or lstat(2) is issued
from VFS2 layer to a FUSE filesystem.

Fixes #3175
2020-08-10 18:15:32 -07:00
Kevin Krakauer 805a96d7ba Speed up iptables tests
//test/iptables:iptables_test runs 30 seconds faster on my machine.

* Using contexts instead of many smaller timeouts makes the tests less
  likely to flake and removes unnecessary complexity.
* We also use context to properly shut down concurrent goroutines and
  the test container.
* Container logs are always logged.
2020-08-10 17:50:01 -07:00
Ghanan Gowripalan 0a8ae4b32f Populate IPPacketInfo with destination address
IPPacketInfo.DestinationAddr should hold the destination of the IP
packet, not the source. This change fixes that bug.

PiperOrigin-RevId: 325910766
2020-08-10 16:22:31 -07:00
Ayush Ranjan a1af46c20a Enable VFS2 by default for all syscall tests.
Fixes #2923

PiperOrigin-RevId: 325904734
2020-08-10 15:50:22 -07:00
Zach Koopmans a88cf5a2e1 Add benchmarks to continuous build.
PiperOrigin-RevId: 325892974
2020-08-10 14:52:36 -07:00
Zach Koopmans 80c80a1410 Remove old benchmark tools.
Remove the old benchmark-tools directory, including
imports in the WORKSPACE file and associated bazel rules.

The new Golang benchmark-tools can be found at //test/benchmarks
and it is functionally equivalent, excepting syscall_test
which can be found in //test/perf/linux.

PiperOrigin-RevId: 325529075
2020-08-07 16:18:51 -07:00
Zach Koopmans 7b9bfc0ce0 Port Ruby benchmark.
PiperOrigin-RevId: 325500772
2020-08-07 13:49:07 -07:00
Zach Koopmans a7bd0a7012 Port Startup and Density Benchmarks.
PiperOrigin-RevId: 325497346
2020-08-07 13:30:39 -07:00
Andrei Vagin 10c13bccaf tcp: change the limit of TCP_LINGER2
It was changed in the Linux kernel:

commit f0628c524fd188c3f9418e12478dfdfadacba815
Date:   Fri Apr 24 16:06:16 2020 +0800
net: Replace the limit of TCP_LINGER2 with TCP_FIN_TIMEOUT_MAX
PiperOrigin-RevId: 325493859
2020-08-07 13:10:29 -07:00
Jamie Liu 93cb66825b Support separate read/write handles in fsimpl/gofer.dentry.
PiperOrigin-RevId: 325490674
2020-08-07 12:56:12 -07:00
Ayush Ranjan 293f11ca95 [runtime tests] Exclude flaky/failing tests
PiperOrigin-RevId: 325481011
2020-08-07 12:07:46 -07:00
Jamie Liu 8c1573ebab Tolerate EINTR from fallocate() in inotify test.
PiperOrigin-RevId: 325472312
2020-08-07 11:26:20 -07:00
Fabricio Voznika f20e63e31b Add LinkAt support to gofer
Updates #1198

PiperOrigin-RevId: 325350818
2020-08-06 18:16:21 -07:00
Adin Scannell 90021e775a Add bzl_library rules for .bzl files without one.
PiperOrigin-RevId: 325280924
2020-08-06 12:10:49 -07:00
gVisor bot 0d69bfa8aa Merge pull request #3511 from amscanne:packetimpact-tests
PiperOrigin-RevId: 325269275
2020-08-06 11:30:03 -07:00
Ayush Ranjan 72b528c840 [runtime tests] Exclude failing python and java tests
test_httplib was un-excluded in cl/325137657. Exclude it again.
test_httplib fails consistently when running in a kokoro job. Could not repro
with Docker.

There are some java tests that pass locally on Docker but fail when running
within a kokoro job.

Also make shard count a multiple of 8 to minimize idle cores and minimize test
time.

PiperOrigin-RevId: 325267071
2020-08-06 11:08:50 -07:00
Ghanan Gowripalan fc4dd3ef45 Join IPv4 all-systems group on NIC enable
Test:
- stack_test.TestJoinLeaveMulticastOnNICEnableDisable
- integration_test.TestIncomingMulticastAndBroadcast
PiperOrigin-RevId: 325185259
2020-08-06 01:32:21 -07:00
Nayana Bidari 35312a95c4 Add loss recovery option for TCP.
/proc/sys/net/ipv4/tcp_recovery is used to enable RACK loss
recovery in TCP.

PiperOrigin-RevId: 325157807
2020-08-05 20:50:06 -07:00
Ayush Ranjan ce463c027b [runtime tests] Update python tests.
- un-exclude passing tests to increase testing surface.
- create/update bugs for tests that fail on runsc but pass on runc.

PiperOrigin-RevId: 325137657
2020-08-05 17:48:07 -07:00
gVisor bot 34d302cb8a Merge pull request #3502 from craig08:fuse-integration-test-fix-connection-refused
PiperOrigin-RevId: 325080329
2020-08-05 12:47:55 -07:00
Ayush Ranjan d0127b23f2 [runtime tests] Update bugs and un-exclude passing tests.
PiperOrigin-RevId: 325045486
2020-08-05 10:23:12 -07:00
Adin Scannell c5f5806fe6 Enable "make packetimpact-tests" to work.
This required minor fixes to the bazel wrapper. The "dut_platform" is
also changed to "native" to line-up with the system call tests and
remove the hard-coded "linux" and "netstack" strings.
2020-08-04 20:49:00 -07:00
Ayush Ranjan 338f96b36c [runtime tests] Exclude flaky tests.
PiperOrigin-RevId: 324923599
2020-08-04 17:20:24 -07:00
Zach Koopmans be7079578e Port sysbench benchmark.
PiperOrigin-RevId: 324918229
2020-08-04 16:51:04 -07:00
Craig Chi 9094adfc27 Fix FUSE integration test failed with ECONNREFUSED
The newer version of FUSE_INIT checks the response from the FUSE server
if its major number is equal to 7. If it's not, then FUSE_INIT fails and
further filesystem operations will get ECONNREFUSED. To mitigate this
issue, we can send back a response with major version equals to 7 when
consuming the first FUSE_INIT request.

Fixes #3500
2020-08-04 14:48:37 -07:00
gVisor bot af2f456735 Merge pull request #3320 from craig08:fuse-integration-test
PiperOrigin-RevId: 324877577
2020-08-04 13:25:40 -07:00
Craig Chi 21d0334e7f Add FUSE integration test
This commit adds an integration test framework for FUSE support. Please
refer to the test example and test/fuse/README.md for further details.

Fixes #3098
2020-08-04 12:27:55 -07:00
Ayush Ranjan 7dfcf727a5 [runtime tests] Fix nodejs runtime tests.
- Exclude flaky tests.
- Bump timeout.
- Un-exclude passing tests to increase testing surface.
- Create/Update bugs for tests that pass on runc but fail on runsc.

PiperOrigin-RevId: 324830840
2020-08-04 09:51:13 -07:00
Bhasker Hariharan 1bdadbc4f8 Fix broken httpd_test.
PiperOrigin-RevId: 324822613
2020-08-04 09:07:09 -07:00
Dean Deng b5c9ff8192 Exclude flaky nodejs runtime test.
PiperOrigin-RevId: 324738840
2020-08-03 20:32:23 -07:00
Dean Deng 1fbbc795ef Add inotify events for fallocate and tests for fallocate/sendfile.
Updates #1479, #2923.

PiperOrigin-RevId: 324658826
2020-08-03 12:36:14 -07:00
gVisor bot 07267fc4c0 Merge pull request #3469 from craig08:fuse-fix-test-mount-failed
PiperOrigin-RevId: 324657612
2020-08-03 12:27:03 -07:00
Bhasker Hariharan 1a93a78d10 Add support for a reverse HTTPD test.
This change adds a new reverse HTTP test where the HTTPD server runs
in a native container but the client runs inside gVisor. It allows
us to test download performance under varying levels of concurrency.

Also tweaks the concurrent request numbers to test for high levels
of concurrency.

PiperOrigin-RevId: 324651203
2020-08-03 12:00:01 -07:00
Craig Chi e76c3c1064 Fix MountFuseFilesystem tests failing
Before kernel version 4.16-rc6, fuse mount is protected by
capable(CAP_SYS_ADMIN). After this version, it uses
ns_capable(CAP_SYS_ADMIN) to protect. Before the 4.16 kernel,
it was not allowed to mount fuse file systems without the
global CAP_SYS_ADMIN.

Fixes #3360
2020-07-31 16:18:40 -07:00
Andrei Vagin fd5f4ffed1 test/socket_netlink_route: check that there is a route on local or main tables
A new network namespace has only the local route table.

PiperOrigin-RevId: 324303629
2020-07-31 16:14:06 -07:00
Ayush Ranjan 12a6657d9c [runtime tests] Enhance java runtime test.
- Added a bunch of helpful options which help in speeding up the test and
  providing useful output.
- Unexcluded passing tests and updated bugs. Excluded tests which were failing.
- Increased the batch size for java tests so that we can take advantage of
  the shared JVMs.

The running time of the tests decreased from 3+ hours (I don't know the exact
running time because this test has always timed out after 3 hours) to 1 hour
15 minutes. We can reliably run this a CI kokoro job.

PiperOrigin-RevId: 324301503
2020-07-31 16:01:36 -07:00
gVisor bot b22c2ab1d7 Merge pull request #3348 from kevinGC:so-orig-dst
PiperOrigin-RevId: 324279280
2020-07-31 14:01:03 -07:00