Commit Graph

599 Commits

Author SHA1 Message Date
Dean Deng 5b2396d244 Fix typo in TODO comments.
PiperOrigin-RevId: 304508083
2020-04-02 17:07:13 -07:00
Bhasker Hariharan c6d5742c21 Fix flaky TCPLinger2TimeoutAfterClose test.
The test is flaky in cooperative S/R mode because TCP timers are not restored
across a S/R. This can cause the TCPLinger2 timer to not fire. This change
disables S/R before setting the TCP_LINGER2 timeout.

PiperOrigin-RevId: 304430536
2020-04-02 10:41:12 -07:00
Eyal Soha 38f4501c99 Add context.Context argument to XxxWithErrno functions
This allows control over the gRPC timeouts as needed.

PiperOrigin-RevId: 304225713
2020-04-01 11:27:03 -07:00
Eyal Soha d25036ad17 Test receiving multicast packets over UDP
PiperOrigin-RevId: 304098611
2020-03-31 19:53:11 -07:00
Dean Deng 639d94f9f7 Add socket filesystem and global disconnected socket mount for VFS2.
A socket mount where anonymous sockets will reside is added to the
VirtualFilesystem. Socketfs is built on top of kernfs.

Updates #1476, #1478, #1484, #1485.

PiperOrigin-RevId: 304095251
2020-03-31 19:17:12 -07:00
Nayana Bidari 92b9069b67 Support owner matching for iptables.
This feature will match UID and GID of the packet creator, for locally
generated packets. This match is only valid in the OUTPUT and POSTROUTING
chains. Forwarded packets do not have any socket associated with them.
Packets from kernel threads do have a socket, but usually no owner.
2020-03-26 12:21:24 -07:00
gVisor bot f5fbe859ed Merge pull request #2177 from xiaobo55x:sysret_test
PiperOrigin-RevId: 303158421
2020-03-26 11:37:45 -07:00
Kevin Krakauer bc3def43c3 Check error in DropTCP*Port tests and fix comment.
PiperOrigin-RevId: 303147253
2020-03-26 10:47:51 -07:00
gVisor bot 3afbe5461a Merge pull request #2151 from xiaobo55x:seccomp_test
PiperOrigin-RevId: 302987344
2020-03-25 15:59:53 -07:00
Fabricio Voznika 5f03dca522 Fix race in TestRunEnvHasHome
It's possible to execute the command that checks user's
$HOME dir before the user is created. Move the code that
creates the user inside exec so it can be serialized.

PiperOrigin-RevId: 302986184
2020-03-25 15:58:45 -07:00
Fabricio Voznika e541ebec2f Misc fixes to make stat_test pass (almost)
The only test failing now requires socket which is not
available in VFS2 yet.

Updates #1198

PiperOrigin-RevId: 302976572
2020-03-25 14:59:15 -07:00
Jamie Liu e7fbf69495 Fix futex_benchmark.
- Fix definitions of Futex* wrappers.

- Correctly handle glibc syscall() (which returns -1 and sets errno instead of
  returning the raw syscall return value).

- De-parameterize FutexWaitBitset, which was apparently intended to test with
  deadlines of between 0 and 100000 nanoseconds after the Unix epoch, but was
  broken due to the preceding two issues.

- Use wall time to measure the durations of tests that are expected to block
  (and thus stop accumulating CPU time).

- Require 5s for all tests to improve robustness in the presence of sentry GC.

- Remove FutexContend and FutexContendDeadline; it's unclear what these are
  supposed to measure, given that (1) FutexLock is unrealistically inefficient
  and (2) the benchmark rewards slow scheduling (since this reduces
  contention).

PiperOrigin-RevId: 302925246
2020-03-25 10:59:39 -07:00
Andrei Vagin f97858011f Open a temp directory before changing capabilities and user ID-s
In cl/302130790, we started using a temp directory which is provided by bazel.

By default, a test process has enough permissions to open it, but there is not
any guarantee that it still will be able to do this after changing credentials.

PiperOrigin-RevId: 302702337
2020-03-24 10:58:51 -07:00
Ian Lewis a730d74b32 Support basic /proc/net/dev metrics for netstack
Fixes #506

PiperOrigin-RevId: 302540404
2020-03-23 16:12:58 -07:00
Andrei Vagin d5fe1ce0c1 test: Create a separate /tmp mount only for tests with the shared tag
The root mount is not shared by default, but all other mounts are shared.

So if we create the /tmp mount, this means that we run tests on a shared mount
even if tests run without the --shared option.

PiperOrigin-RevId: 302130790
2020-03-20 17:20:24 -07:00
Eyal Soha e0fbcdcb7f Add packetimpact tests to presubmit and CI testing
PiperOrigin-RevId: 301872161
2020-03-19 12:33:29 -07:00
gVisor bot 79389f8abb Merge pull request #2187 from kevinGC:deflake-connectTCP
PiperOrigin-RevId: 301716568
2020-03-18 18:58:30 -07:00
Kevin Krakauer a8f9cc8798 iptables: deflake DropTCP*Port tests
These tests could timeout because net.DialTCP didn't respect the
timeout.
2020-03-18 18:16:33 -07:00
Kevin Krakauer b5ea65c07c iptables: skip tests for not-yet-supported features
PiperOrigin-RevId: 301686266
2020-03-18 15:52:57 -07:00
Kevin Krakauer fc16e64396 Automated rollback of changelist 301476456
PiperOrigin-RevId: 301650898
2020-03-18 13:08:11 -07:00
Eyal Soha 707664e0c4 Send the ACK later to stabilize the test.
PiperOrigin-RevId: 301614096
2020-03-18 10:18:13 -07:00
Haibo Xu 9c35d7eb1f Enable syscall sysret_test on arm64.
Fixes #2058

Signed-off-by: Haibo Xu <haibo.xu@arm.com>
Change-Id: I05750d238a6425d3a47fae15720901f4dd924a32
2020-03-18 09:27:19 +00:00
Kevin Krakauer 1cc5a71a0e iptables: fix type in script name, mark some new tests as skipped
PiperOrigin-RevId: 301476456
2020-03-17 16:23:00 -07:00
Eyal Soha 3192e55ffe Packetimpact in Go with c++ stub
PiperOrigin-RevId: 301382690
2020-03-17 08:53:27 -07:00
Ting-Yu Wang 69da42885a Enable ARP resolution in TAP devices.
PiperOrigin-RevId: 301208471
2020-03-16 12:03:27 -07:00
gVisor bot 159a230b9b Merge pull request #1943 from kevinGC:ipt-filter-ip
PiperOrigin-RevId: 301197007
2020-03-16 11:13:14 -07:00
Dean Deng 5e413cad10 Plumb VFS2 imported fds into virtual filesystem.
- When setting up the virtual filesystem, mount a host.filesystem to contain
  all files that need to be imported.
- Make read/preadv syscalls to the host in cases where preadv2 may not be
  supported yet (likewise for writing).
- Make save/restore functions in kernel/kernel.go return early if vfs2 is
  enabled.

PiperOrigin-RevId: 300922353
2020-03-14 07:14:33 -07:00
Fabricio Voznika 722abdd833 Skip process if it has exited
PiperOrigin-RevId: 300802159
2020-03-13 12:11:13 -07:00
Haibo Xu 333b74dc28 Enable syscall seccomp test on arm64.
Signed-off-by: Haibo Xu <haibo.xu@arm.com>
Change-Id: Ibc926c917d98b31fc92bbf8d82d6818c39b0f93c
2020-03-13 05:40:13 +00:00
Ting-Yu Wang bbf86003bf Remove flaky network namespace test that uses clone().
PiperOrigin-RevId: 300626011
2020-03-12 14:35:25 -07:00
Fabricio Voznika f2e4b5ab93 Kill sandbox process when parent process terminates
When the sandbox runs in attached more, e.g. runsc do, runsc run, the
sandbox lifetime is controlled by the parent process. This wasn't working
in all cases because PR_GET_PDEATHSIG doesn't propagate through execve
when the process changes uid/gid. So it was getting dropped when the
sandbox execve's to change to user nobody.

PiperOrigin-RevId: 300601247
2020-03-12 12:32:26 -07:00
Kevin Krakauer 4054b021f0 iptables: ready tests to be enabled in kokoro
Fixed flakes (tested via --runs_per_test=100) and added skips for
not-yet-implemented features. Once submitted, the iptables tests will be
ready to enable in kokoro.
2020-03-11 15:13:58 -07:00
gVisor bot 2c2622b942 Merge pull request #1975 from nybidari:iptables
PiperOrigin-RevId: 300362789
2020-03-11 11:02:04 -07:00
Ian Lewis 0990ef7517 Make checkpoint/restore e2e test less flaky
PiperOrigin-RevId: 300171916
2020-03-10 13:59:49 -07:00
Ting-Yu Wang b36de6e7be Move /proc/net to /proc/PID/net, and make /proc/net -> /proc/self/net.
Issue #1833

PiperOrigin-RevId: 299998105
2020-03-09 19:59:09 -07:00
Andrei Vagin 2446161b3f perf/signal: rewrite code in assembly to avoid compiler optimizations
Without this change, the assembly code of this test compiled without
optimizations:

mov    -0x150(%rbp),%rax
movl   $0x77777777,(%rax)
lea    -0x128(%rbp),%rax

with optimizations:

movl   $0x77777777,0x0

This code doesn't work properly, because the test changes rax in the segv
handler.

PiperOrigin-RevId: 299896117
2020-03-09 11:53:28 -07:00
Eyal Soha d5dbe366bf shutdown(s, SHUT_WR) in TIME-WAIT returns ENOTCONN
From RFC 793 s3.9 p61 Event Processing:

CLOSE Call during TIME-WAIT: return with "error: connection closing"

Fixes #1603

PiperOrigin-RevId: 299401353
2020-03-06 11:42:34 -08:00
Eyal Soha 20170d4fd5 Move packetdrill tests to open-source
PiperOrigin-RevId: 299396286
2020-03-06 11:24:11 -08:00
Ian Lewis da48fc6cca Stub oom_score_adj and oom_score.
Adds an oom_score_adj and oom_score proc file stub. oom_score_adj accepts
writes of values -1000 to 1000 and persists the value with the task. New tasks
inherit the parent's oom_score_adj.

oom_score is a read-only stub that always returns the value '0'.

Issue #202

PiperOrigin-RevId: 299245355
2020-03-05 18:23:01 -08:00
gVisor bot b1576e5332 Merge pull request #2036 from xiaobo55x:syscall_test
PiperOrigin-RevId: 299151227
2020-03-05 11:34:09 -08:00
gVisor bot 4f43d5ecad Merge pull request #2054 from avagin:gvisor-test
PiperOrigin-RevId: 298951909
2020-03-04 15:12:26 -08:00
Andrei Vagin 504c9e14d6 test/runner: use proper filters for test cases
The benchmark_filter options accepts regex-s, but
the gtest-filter option accepts shell-like wildcards.

Fixes #2034

Signed-off-by: Andrei Vagin <avagin@gmail.com>
2020-03-04 12:52:13 -08:00
Eyal Soha ef1219c145 Use shuf instead of $RANDOM everywhere.
$RANDOM can cause collisions but shuf uses /dev/urandom so it ought to cause
fewer.

PiperOrigin-RevId: 298786344
2020-03-04 00:15:49 -08:00
gVisor bot ba8b8154e8 Merge pull request #2008 from lubinszARM:pr_skip_vsyscall
PiperOrigin-RevId: 298683693
2020-03-03 13:48:00 -08:00
gVisor bot 3aa97c893d Merge pull request #2043 from lubinszARM:pr_clean1
PiperOrigin-RevId: 298683502
2020-03-03 13:46:54 -08:00
Adin Scannell b3c549d839 Move temp_umask to test/util.
PiperOrigin-RevId: 298667595
2020-03-03 12:38:00 -08:00
Bin Lu fc3a09cd3c code clean: minor changes to compatible with ubuntu18.04
Signed-off-by: Bin Lu <bin.lu@arm.com>
2020-03-03 17:45:59 +08:00
Nayana Bidari 43abb24657 Fix panic caused by invalid address for Bind in packet sockets.
PiperOrigin-RevId: 298476533
2020-03-02 16:31:52 -08:00
Bhasker Hariharan 3310175250 Fix data-race when reading/writing e.amss.
PiperOrigin-RevId: 298451319
2020-03-02 14:45:03 -08:00
Haibo Xu 36b193b1db Fix syscall test build error on arm64.
The error was introduced in the merge of PR #1471.
Some codes are missing when adding bazel select_arch
command to the test/syscall/linux/BUILD file.

Signed-off-by: Haibo Xu <haibo.xu@arm.com>
Change-Id: I8cae3f4ae78c2e14671f3ac6e7361dc2806d9305
2020-03-02 07:35:30 +00:00