Commit Graph

477 Commits

Author SHA1 Message Date
gVisor bot f5fbe859ed Merge pull request #2177 from xiaobo55x:sysret_test
PiperOrigin-RevId: 303158421
2020-03-26 11:37:45 -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 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
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
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
Ting-Yu Wang 69da42885a Enable ARP resolution in TAP devices.
PiperOrigin-RevId: 301208471
2020-03-16 12:03:27 -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
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
gVisor bot 2c2622b942 Merge pull request #1975 from nybidari:iptables
PiperOrigin-RevId: 300362789
2020-03-11 11:02:04 -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
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
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
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
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
Ting-Yu Wang 6b4d36e325 Hide /dev/net/tun when using hostinet.
/dev/net/tun does not currently work with hostinet. This has caused some
program starts failing because it thinks the feature exists.

PiperOrigin-RevId: 297876196
2020-02-28 10:39:12 -08:00
Bin Lu dd1ed5c789 skip vsyscall test cases on Arm64
Signed-off-by: Bin Lu <bin.lu@arm.com>
2020-02-28 14:47:50 +08:00
Nayana Bidari abf7ebcd38 Internal change.
PiperOrigin-RevId: 297638665
2020-02-27 11:00:41 -08:00
Jay Zhuang de0b2ebf86 Add getsockopt tests for SO_SNDTIMEO and SO_RCVTIMEO
PiperOrigin-RevId: 297485310
2020-02-26 18:17:23 -08:00
gVisor bot 93626a28e4 Merge pull request #1886 from avagin:arm64-travis-ci
PiperOrigin-RevId: 296975376
2020-02-24 14:34:13 -08:00
Andrei Vagin 75d7f76a6c arm64: add a travis build ci
Build runsc and run "runsc do ls".

Signed-off-by: Andrei Vagin <avagin@gmail.com>
2020-02-21 22:44:19 -08:00
Ting-Yu Wang b8f56c79be Implement tap/tun device in vfs.
PiperOrigin-RevId: 296526279
2020-02-21 15:42:56 -08:00
gVisor bot 4a73bae269 Initial network namespace support.
TCP/IP will work with netstack networking. hostinet doesn't work, and sockets
will have the same behavior as it is now.

Before the userspace is able to create device, the default loopback device can
be used to test.

/proc/net and /sys/net will still be connected to the root network stack; this
is the same behavior now.

Issue #1833

PiperOrigin-RevId: 296309389
2020-02-20 15:20:40 -08:00
Adin Scannell 30794512d3 Add basic microbenchmarks.
PiperOrigin-RevId: 296104390
2020-02-19 18:21:54 -08:00
gVisor bot 55c99ce106 Include more test files in exports_files
So that they can be included by Fuchsia's syscall tests

PiperOrigin-RevId: 296030383
2020-02-19 12:32:44 -08:00
gVisor bot 56fd9504aa Enable IPV6_RECVTCLASS socket option for datagram sockets
Added the ability to get/set the IP_RECVTCLASS socket option on UDP endpoints.
If enabled, traffic class from the incoming Network Header passed as ancillary
data in the ControlMessages.

Adding Get/SetSockOptBool to decrease the overhead of getting/setting simple
options. (This was absorbed in a CL that will be landing before this one).

Test:
* Added unit test to udp_test.go that tests getting/setting as well as
verifying that we receive expected TOS from incoming packet.
* Added a syscall test for verifying getting/setting
* Removed test skip for existing syscall test to enable end to end test.
PiperOrigin-RevId: 295840218
2020-02-18 15:45:36 -08:00
gVisor bot c841373013 Deflake fallocate syscall test.
- Retry if fallocate returns EINTR.

- If fallocate fails, don't try to fstat and confirm the result.

PiperOrigin-RevId: 295789790
2020-02-18 12:02:05 -08:00
gVisor bot 69bf39e8a4 Internal change.
PiperOrigin-RevId: 294952610
2020-02-13 10:59:52 -08:00
gVisor bot 46a36b64d5 Include more test files in exports_files
So that they can be included by Fuchsia's syscall tests

PiperOrigin-RevId: 294654890
2020-02-12 06:36:43 -08:00
Zach Koopmans 75412ed9f5 Internal change.
PiperOrigin-RevId: 294250370
2020-02-10 10:29:57 -08:00
Dean Deng 17b9f5e662 Support listxattr and removexattr syscalls.
Note that these are only implemented for tmpfs, and other impls will still
return EOPNOTSUPP.

PiperOrigin-RevId: 293899385
2020-02-07 14:47:13 -08:00
Jay Zhuang 6de49546cb Refactor syscall tests
- Move shared helpers V4Multicast and V4Broadcast to socket_test_util
- Add unnamed namespace so socket_ipv4_tcp_unbound_external_networking_test.cc
  and socket_ipv4_udp_unbound_external_networking_test.cc can be compiled
  together
- Add test files to "exports_files" so they can be included by Fuchsia's syscall
  test setup

PiperOrigin-RevId: 293880429
2020-02-07 13:19:18 -08:00
Adin Scannell 0e96fcafd4 Fix test case on AMD.
When ignored, the trap should be executed which generates
a SIGSEGV as in the above case.

PiperOrigin-RevId: 293618489
2020-02-06 10:12:16 -08:00
Adin Scannell 1b6a12a768 Add notes to relevant tests.
These were out-of-band notes that can help provide additional context
and simplify automated imports.

PiperOrigin-RevId: 293525915
2020-02-05 22:46:35 -08:00
Eyal Soha f3d9560703 recv() on a closed TCP socket returns ENOTCONN
From RFC 793 s3.9 p58 Event Processing:

If RECEIVE Call arrives in CLOSED state and the user has access to such a
connection, the return should be "error: connection does not exist"

Fixes #1598

PiperOrigin-RevId: 293494287
2020-02-05 17:56:42 -08:00
Nicolas Lacasse eea0eeee93 Disable get/set xattrs until list/remove exist too.
PiperOrigin-RevId: 293411655
2020-02-05 11:26:19 -08:00
Ting-Yu Wang 665b614e4a Support RTM_NEWADDR and RTM_GETLINK in (rt)netlink.
PiperOrigin-RevId: 293271055
2020-02-04 18:05:03 -08:00
Ian Gudger a26a954946 Add socket connection stress test.
Tests 65k connection attempts on common types of sockets to check for port
leaks.

Also fixes a bug where dual-stack sockets wouldn't properly re-queue
segments received while closing.

PiperOrigin-RevId: 293241166
2020-02-04 15:54:49 -08:00
Michael Pratt 6823b5e244 timer_create(2) should return 0 on success
The timer ID is copied out to the argument.

Fixes #1738

PiperOrigin-RevId: 293210801
2020-02-04 13:27:39 -08:00
Jay Zhuang c5d4041623 Include socket_ip_udp_loopback.cc in exportes_files
So it can be included in fuchsia's syscall tests

PiperOrigin-RevId: 293208306
2020-02-04 13:13:10 -08:00
Fabricio Voznika d7cd484091 Add support for sentry internal pipe for gofer mounts
Internal pipes are supported similarly to how internal UDS is done.
It is also controlled by the same flag.

Fixes #1102

PiperOrigin-RevId: 293150045
2020-02-04 08:20:52 -08:00
Ting-Yu Wang e7846e50f2 Reduce run time for //test/syscalls:socket_inet_loopback_test_runsc_ptrace.
* Tests are picked for a shard differently. It now picks one test from each
  block, instead of picking the whole block. This makes the same kind of tests
  spreads across different shards.

* Reduce the number of connect() calls in TCPListenClose.

PiperOrigin-RevId: 293019281
2020-02-03 15:42:21 -08:00