Commit Graph

3039 Commits

Author SHA1 Message Date
Adin Scannell 56c64e4bb9 Fix include type.
PiperOrigin-RevId: 309506957
2020-05-01 18:03:09 -07:00
Adin Scannell 89562b5b2b Run labeller only for non-forked pull requests.
Otherwise the labeller will generate an error each time.

PiperOrigin-RevId: 309505731
2020-05-01 17:50:07 -07:00
Nayana Bidari b660f16d18 Support for connection tracking of TCP packets.
Connection tracking is used to track packets in prerouting and
output hooks of iptables. The NAT rules modify the tuples in
connections. The connection tracking code modifies the packets by
looking at the modified tuples.
2020-05-01 16:59:40 -07:00
Ghanan Gowripalan 40d6aae122 Regenerate SLAAC address on conflicts with the NIC
If the NIC already has a generated SLAAC address, regenerate a new SLAAC
address until one is generated that does not conflict with the NIC's
existing addresses, up to a maximum of 10 attempts.

This applies to both stable and temporary SLAAC addresses.

Test: stack_test.TestMixedSLAACAddrConflictRegen
PiperOrigin-RevId: 309495628
2020-05-01 16:33:43 -07:00
Kevin Krakauer 5e1e61fbcb Automated rollback of changelist 308674219
PiperOrigin-RevId: 309491861
2020-05-01 16:09:53 -07:00
gVisor bot e7b8a71156 Internal change.
PiperOrigin-RevId: 309467878
2020-05-01 13:52:21 -07:00
Dean Deng 82bae30cee Port netstack, hostinet, and netlink sockets to VFS2.
All three follow the same pattern:
1. Refactor VFS1 sockets into socketOpsCommon, so that most of the methods can
   be shared with VFS2.
2. Create a FileDescriptionImpl with the corresponding socket operations,
   rewriting the few that cannot be shared with VFS1.
3. Set up a VFS2 socket provider that creates a socket by setting up a dentry
   in the global Kernel.socketMount and connecting it with a new
   FileDescription.

This mostly completes the work for porting sockets to VFS2, and many syscall
tests can be enabled as a result.
There are several networking-related syscall tests that are still not passing:
1. net gofer tests
2. socketpair gofer tests
2. sendfile tests (splice is not implemented in VFS2 yet)

Updates #1478, #1484, #1485

PiperOrigin-RevId: 309457331
2020-05-01 12:54:41 -07:00
Bhasker Hariharan 8962b7840f Enable FIFO QDisc by default in runsc.
Updates #231

PiperOrigin-RevId: 309339316
2020-04-30 18:29:57 -07:00
Bhasker Hariharan ae15d90436 FIFO QDisc implementation
Updates #231

PiperOrigin-RevId: 309323808
2020-04-30 16:41:00 -07:00
Jamie Liu 01beec3bb4 Add gofer.InternalFilesystemOptions.LeakConnection.
PiperOrigin-RevId: 309317605
2020-04-30 16:04:21 -07:00
Nicolas Lacasse bae30a0c69 Implement waiter.Waitable methods on VFS2 host inodes.
This fixes bash in Ubuntu.

Updates #1672.

PiperOrigin-RevId: 309298252
2020-04-30 14:19:45 -07:00
Andrei Vagin c01e103256 Allow to run kvm syscall tests on the RBE cluster
PiperOrigin-RevId: 309265978
2020-04-30 11:33:07 -07:00
Ghanan Gowripalan 043b7d83bd Prefer temporary addresses
Implement rule 7 of Source Address Selection RFC 6724 section 5. This
makes temporary (short-lived) addresses preferred over non-temporary
addresses when earlier rules are equal.

Test: stack_test.TestIPv6SourceAddressSelectionScopeAndSameAddress
PiperOrigin-RevId: 309250975
2020-04-30 10:23:17 -07:00
Dean Deng 442fde405d Fix proc net bugs in VFS2.
The /proc/net/udp header was missing, and /proc/sys/net was set up as
/proc/sys/net/net. Discovered while trying to run networking tests for VFS2.

PiperOrigin-RevId: 309243758
2020-04-30 09:48:00 -07:00
Zeling Feng 4875cda8d1 Make tcp_close_wait_ack_test more accurate
Previously the test used an out-dated window size which is advertised
during the handshake to generate testing packets, but the window size
has changed since the handshake; currently it is using the most recent
one which is advertised in DUT's ACK to our FIN packet to generate the
testing outside-the-window packets.

PiperOrigin-RevId: 309222921
2020-04-30 07:40:34 -07:00
Andrei Vagin 44a57646d8 make_repository.sh has to print only the repo path on stdout
PiperOrigin-RevId: 309176385
2020-04-30 00:34:26 -07:00
Dean Deng ef94401955 Add read/write timeouts for VFS2 socket files.
Updates #1476

PiperOrigin-RevId: 309098590
2020-04-29 14:35:43 -07:00
Kevin Krakauer a105d185ff iptables: don't pollute logs
The netfilter package uses logs to make debugging the (de)serialization of
structs easier. This generates a lot of (usually irrelevant) logs. Logging is
now hidden behind a debug flag.

PiperOrigin-RevId: 309087115
2020-04-29 13:38:14 -07:00
gVisor bot d5c34ba2ff Merge pull request #2487 from moricho:fix/bindmount
PiperOrigin-RevId: 309082540
2020-04-29 13:13:51 -07:00
Dean Deng ce19497c1c Fix Unix socket permissions.
Enforce write permission checks in BoundEndpointAt, which corresponds to the
permission checks in Linux (net/unix/af_unix.c:unix_find_other).
Also, create bound socket files with the correct permissions in VFS2.

Fixes #2324.

PiperOrigin-RevId: 308949084
2020-04-28 20:13:01 -07:00
gVisor bot 24abccbc1c Internal change.
PiperOrigin-RevId: 308940886
2020-04-28 18:50:44 -07:00
Dean Deng f93f2fda74 Deduplicate unix socket Release() method.
PiperOrigin-RevId: 308932254
2020-04-28 17:43:14 -07:00
Ghanan Gowripalan 37a59bc76d Support IPv6 Privacy Extensions for SLAAC
Support generating temporary (short-lived) IPv6 SLAAC addresses to
address privacy concerns outlined in RFC 4941.

Tests:
- stack_test.TestAutoGenTempAddr
- stack_test.TestNoAutoGenTempAddrForLinkLocal
- stack_test.TestAutoGenTempAddrRegen
- stack_test.TestAutoGenTempAddrRegenTimerUpdates
- stack_test.TestNoAutoGenTempAddrWithoutStableAddr
- stack_test.TestAutoGenAddrInResponseToDADConflicts
PiperOrigin-RevId: 308915566
2020-04-28 16:02:44 -07:00
Adin Scannell 64723470a6 Use existing bazeldefs with top-level BUILD file.
PiperOrigin-RevId: 308901116
2020-04-28 14:46:19 -07:00
Jamie Liu 4282260355 Don't unlink named pipes in pipe test.
TempPath's destructor runs at the end of the named pipe creation functions,
deleting the named pipe. If the named pipe is backed by a "non-virtual"
filesystem (!fs.Inode.IsVirtual()), this causes the following save attempt to
fail because there are FDs holding the deleted named pipe open.

PiperOrigin-RevId: 308861999
2020-04-28 11:28:44 -07:00
gVisor bot ceb3c0e062 Merge pull request #2558 from prattmic:forward_signal
PiperOrigin-RevId: 308829800
2020-04-28 08:43:49 -07:00
Dean Deng f3ca5ca82a Support pipes and sockets in VFS2 gofer fs.
Named pipes and sockets can be represented in two ways in gofer fs:
1. As a file on the remote filesystem. In this case, all file operations are
   passed through 9p.
2. As a synthetic file that is internal to the sandbox. In this case, the
   dentry stores an endpoint or VFSPipe for sockets and pipes respectively,
   which replaces interactions with the remote fs through the gofer.
In gofer.filesystem.MknodAt, we attempt to call mknod(2) through 9p,
and if it fails, fall back to the synthetic version.

Updates #1200.

PiperOrigin-RevId: 308828161
2020-04-28 08:34:00 -07:00
Bin Lu 44d780aa4b code clean in arch module
Signed-off-by: Bin Lu <bin.lu@arm.com>
2020-04-28 01:15:43 -04:00
gVisor bot 316394ee89 Merge pull request #2544 from prattmic:runsc_do_cleanup
PiperOrigin-RevId: 308727526
2020-04-27 17:01:33 -07:00
Dean Deng 1c2ecbb1a0 Import host sockets.
The FileDescription implementation for hostfs sockets uses the standard Unix
socket implementation (unix.SocketVFS2), but is also tied to a hostfs dentry.

Updates #1672, #1476

PiperOrigin-RevId: 308716426
2020-04-27 16:02:18 -07:00
Bhasker Hariharan 8f42cbfd08 Reduce flakiness in tcp_test.
Poll for metric updates as immediately trying to read them can sometimes be
flaky if due to goroutine scheduling the check happens before the sender has got
a chance to update the corresponding sent metric.

PiperOrigin-RevId: 308712817
2020-04-27 15:41:20 -07:00
gVisor bot ad6ba20188 Merge pull request #2557 from cmingxu:master
PiperOrigin-RevId: 308706483
2020-04-27 15:07:35 -07:00
Michael Pratt 147c8ba1f7 runsc: extend do network cleanup
Previously we unconditionally failed to cleanup the networking files
(hostname, resolve.conf, hosts), and failed to cleanup the netns, etc on
partial setup failure.

We can drop the iptables commands from cleanup, as the routes
automatically go away when the device is deleted. Those commands were
failing previously.

Forward signals to the container, allowing it to exit normally when a
signal is received, and then for runsc to run the cleanup. This doesn't
cover cleanup when runsc is signalled before the container start, it
covers the most common case.

Fixes #2539
Fixes #2540
2020-04-27 16:36:07 -04:00
Fabricio Voznika 003e79a6d1 Dump stack for stuck start and stuck watchdog
The meaning for skipDump was reversed, but not all callers
were updated. Change the meaning once again to forceDump, so
that the period between stack dump is respected from all
callers.

PiperOrigin-RevId: 308674373
2020-04-27 12:30:49 -07:00
gVisor bot 55f0c3316a Automated rollback of changelist 308163542
PiperOrigin-RevId: 308674219
2020-04-27 12:26:32 -07:00
Michael Pratt b15d49a137 container: use sighandling package
Use the sighandling package for Container.ForwardSignals, for
consistency with other signal forwarding.

Fixes #2546
2020-04-27 11:52:43 -04:00
Jamie Liu 292f3f99b7 Don't leak vfs.MountNamespace reference if kernel.TaskSet.NewTask fails.
PiperOrigin-RevId: 308617610
2020-04-27 07:39:10 -07:00
kevin.xu 9a4ae0322e
Update container.go
typo, should be `start` in comments
2020-04-27 21:53:04 +08:00
kevin.xu e896ca54db
Merge pull request #1 from google/master
catch up
2020-04-27 21:51:31 +08:00
moricho fc53d64367 refactor and add test for bindmount
Signed-off-by: moricho <ikeda.morito@gmail.com>
2020-04-26 17:24:34 +09:00
Rahat Mahmood 3c67754663 Enable automated marshalling for signals and the arch package.
PiperOrigin-RevId: 308472331
2020-04-25 23:56:04 -07:00
Zach Koopmans 17ac90a203 Add container tests passing with VFS2
Several tests are passing after getting TestAppExitStatus (run /bin/true)
changes. Make versions that run via VFS2 so that we know what is and isn't
working.

In addition, fix bug in VFSFile ReadFull. For the TestExePath test in
container_test.go, the case "unmasked" will return 0 bytes read with no
EOF err, causing the ReadFull call to spin.

PiperOrigin-RevId: 308428126
2020-04-25 11:27:23 -07:00
moricho 0b3166f624 add bind/rbind options for mount
Signed-off-by: moricho <ikeda.morito@gmail.com>
2020-04-25 22:04:39 +09:00
moricho 93e510e26f fix behavior of `getMountNameAndOptions` when options include either bind or rbind
Signed-off-by: moricho <ikeda.morito@gmail.com>
2020-04-25 22:04:39 +09:00
Eyal Soha c9199bab92 More descriptive error message for missing docker image.
Tested:
  Ran a packetimpact test after `docker image rm` and examined the message.
PiperOrigin-RevId: 308370603
2020-04-24 20:00:24 -07:00
Zach Koopmans 15a822a193 VFS2: Get HelloWorld image tests to pass with VFS2
This change includes:
- Modifications to loader_test.go to get TestCreateMountNamespace to
pass with VFS2.
- Changes necessary to get TestHelloWorld in image tests to pass with
VFS2. This means runsc can run the hello-world container with docker
on VSF2.

Note: Containers that use sockets will not run with these changes.
See "//test/image/...". Any tests here with sockets currently fail
(which is all of them but HelloWorld).
PiperOrigin-RevId: 308363072
2020-04-24 18:23:37 -07:00
Fabricio Voznika 4af39dd1c5 Propagate PID limit from OCI to sandbox cgroup
Closes #2489

PiperOrigin-RevId: 308362434
2020-04-24 18:17:01 -07:00
gVisor bot 10725475c3 Merge pull request #1707 from lubinszARM:pr_lazy_fpsimd_2
PiperOrigin-RevId: 308347744
2020-04-24 16:23:16 -07:00
Eyal Soha dfff265fe4 Add ICMP6 param problem test
Tested:
  When run on Linux, a correct ICMPv6 response is received.  On netstack, no
  ICMPv6 response is received.
PiperOrigin-RevId: 308343113
2020-04-24 15:56:27 -07:00
Eyal Soha 3d860530a9 Better error message from ExpectFrame
Display the errors as diffs between the expected and wanted frame.

PiperOrigin-RevId: 308333271
2020-04-24 15:04:03 -07:00