Commit Graph

3795 Commits

Author SHA1 Message Date
Bhasker Hariharan f15d5a8d0f Revert change to default buffer size.
In
ca6bded95d
we reduced the default buffer size to 32KB. This mostly works fine except at
high throughput where we hit zero window very quickly and the TCP receive
buffer moderation is not able to grow the window. This can be seen in the
benchmarks where with a 32KB buffer and 100 connections downloading a 10MB
file we get about 30 requests/s vs the 1MB buffer gives us about 53 requests/s.

A proper fix requires a few changes to when we send a zero window as well as
when we decide to send a zero window update. Today we consider available space
below 1MSS as zero and send an update when it crosses 1MSS of available space.
This is way too low and results in the window staying very small once we hit
a zero window condition as we keep sending updates with size barely over 1MSS.

Linux and BSD are smarter about this and use different thresholds. We should
separately update our logic to match linux or BSD so that we don't send
window updates that are really tiny or wait until we drop below 1MSS to
advertise a zero window.

PiperOrigin-RevId: 324087019
2020-07-30 14:46:49 -07:00
Ghanan Gowripalan 9960a816a9 Enforce fragment block size and validate args
Allow configuring fragmentation.Fragmentation with a fragment
block size which will be enforced when processing fragments. Also
validate arguments when processing fragments.

Test:
    - fragmentation.TestErrors
    - ipv6_test.TestReceiveIPv6Fragments
    - ipv4_test.TestReceiveIPv6Fragments
PiperOrigin-RevId: 324081521
2020-07-30 14:25:53 -07:00
Jamie Liu 3c70b4c986 Implement overlayfs_stale_read for vfs2.
PiperOrigin-RevId: 324080111
2020-07-30 14:18:11 -07:00
Adin Scannell 877fac4864 Allocate a pseudo-tty for exec.
Otherwise Ctrl-C will kill the 'docker exec' as opposed to killing
the bazel command being run inside the container.

PiperOrigin-RevId: 324079339
2020-07-30 14:11:09 -07:00
Zach Koopmans 78f1a18ab3 Add runsc build benchmark.
PiperOrigin-RevId: 324071377
2020-07-30 13:37:21 -07:00
Sam Balana ab4bb38455 Implement neighbor unreachability detection for ARP and NDP.
This change implements the Neighbor Unreachability Detection (NUD) state
machine, as per RFC 4861 [1]. The state machine operates on a single neighbor
in the local network. This requires the state machine to be implemented on each
entry of the neighbor table.

This change also adds, but does not expose, several APIs. The first API is for
performing basic operations on the neighbor table:
 - Create a static entry
 - List all entries
 - Delete all entries
 - Remove an entry by address

The second API is used for changing the NUD protocol constants on a per-NIC
basis to allow Neighbor Discovery to operate over links with widely varying
performance characteristics. See [RFC 4861 Section 10][2] for the list of
constants.

Finally, the last API is for allowing users to subscribe to NUD state changes.
See [RFC 4861 Appendix C][3] for the list of edges.

[1]: https://tools.ietf.org/html/rfc4861
[2]: https://tools.ietf.org/html/rfc4861#section-10
[3]: https://tools.ietf.org/html/rfc4861#appendix-C

Tests:
 pkg/tcpip/stack:stack_test
 - TestNeighborCacheAddStaticEntryThenOverflow
 - TestNeighborCacheClear
 - TestNeighborCacheClearThenOverflow
 - TestNeighborCacheConcurrent
 - TestNeighborCacheDuplicateStaticEntryWithDifferentLinkAddress
 - TestNeighborCacheDuplicateStaticEntryWithSameLinkAddress
 - TestNeighborCacheEntry
 - TestNeighborCacheEntryNoLinkAddress
 - TestNeighborCacheGetConfig
 - TestNeighborCacheKeepFrequentlyUsed
 - TestNeighborCacheNotifiesWaker
 - TestNeighborCacheOverflow
 - TestNeighborCacheOverwriteWithStaticEntryThenOverflow
 - TestNeighborCacheRemoveEntry
 - TestNeighborCacheRemoveEntryThenOverflow
 - TestNeighborCacheRemoveStaticEntry
 - TestNeighborCacheRemoveStaticEntryThenOverflow
 - TestNeighborCacheRemoveWaker
 - TestNeighborCacheReplace
 - TestNeighborCacheResolutionFailed
 - TestNeighborCacheResolutionTimeout
 - TestNeighborCacheSetConfig
 - TestNeighborCacheStaticResolution
 - TestEntryAddsAndClearsWakers
 - TestEntryDelayToProbe
 - TestEntryDelayToReachableWhenSolicitedOverrideConfirmation
 - TestEntryDelayToReachableWhenUpperLevelConfirmation
 - TestEntryDelayToStaleWhenConfirmationWithDifferentAddress
 - TestEntryDelayToStaleWhenProbeWithDifferentAddress
 - TestEntryFailedGetsDeleted
 - TestEntryIncompleteToFailed
 - TestEntryIncompleteToIncompleteDoesNotChangeUpdatedAt
 - TestEntryIncompleteToReachable
 - TestEntryIncompleteToReachableWithRouterFlag
 - TestEntryIncompleteToStale
 - TestEntryInitiallyUnknown
 - TestEntryProbeToFailed
 - TestEntryProbeToReachableWhenSolicitedConfirmationWithSameAddress
 - TestEntryProbeToReachableWhenSolicitedOverrideConfirmation
 - TestEntryProbeToStaleWhenConfirmationWithDifferentAddress
 - TestEntryProbeToStaleWhenProbeWithDifferentAddress
 - TestEntryReachableToStaleWhenConfirmationWithDifferentAddress
 - TestEntryReachableToStaleWhenConfirmationWithDifferentAddressAndOverride
 - TestEntryReachableToStaleWhenProbeWithDifferentAddress
 - TestEntryReachableToStaleWhenTimeout
 - TestEntryStaleToDelay
 - TestEntryStaleToReachableWhenSolicitedOverrideConfirmation
 - TestEntryStaleToStaleWhenOverrideConfirmation
 - TestEntryStaleToStaleWhenProbeUpdateAddress
 - TestEntryStaysDelayWhenOverrideConfirmationWithSameAddress
 - TestEntryStaysProbeWhenOverrideConfirmationWithSameAddress
 - TestEntryStaysReachableWhenConfirmationWithRouterFlag
 - TestEntryStaysReachableWhenProbeWithSameAddress
 - TestEntryStaysStaleWhenProbeWithSameAddress
 - TestEntryUnknownToIncomplete
 - TestEntryUnknownToStale
 - TestEntryUnknownToUnknownWhenConfirmationWithUnknownAddress

 pkg/tcpip/stack:stack_x_test
 - TestDefaultNUDConfigurations
 - TestNUDConfigurationFailsForNotSupported
 - TestNUDConfigurationsBaseReachableTime
 - TestNUDConfigurationsDelayFirstProbeTime
 - TestNUDConfigurationsMaxMulticastProbes
 - TestNUDConfigurationsMaxRandomFactor
 - TestNUDConfigurationsMaxUnicastProbes
 - TestNUDConfigurationsMinRandomFactor
 - TestNUDConfigurationsRetransmitTimer
 - TestNUDConfigurationsUnreachableTime
 - TestNUDStateReachableTime
 - TestNUDStateRecomputeReachableTime
 - TestSetNUDConfigurationFailsForBadNICID
 - TestSetNUDConfigurationFailsForNotSupported

[1]: https://tools.ietf.org/html/rfc4861
[2]: https://tools.ietf.org/html/rfc4861#section-10
[3]: https://tools.ietf.org/html/rfc4861#appendix-C

Updates #1889
Updates #1894
Updates #1895
Updates #1947
Updates #1948
Updates #1949
Updates #1950

PiperOrigin-RevId: 324070795
2020-07-30 13:30:16 -07:00
Ghanan Gowripalan b00858d075 Use brodcast MAC for broadcast IPv4 packets
When sending packets to a known network's broadcast address, use the
broadcast MAC address.

Test:
- stack_test.TestOutgoingSubnetBroadcast
- udp_test.TestOutgoingSubnetBroadcast
PiperOrigin-RevId: 324062407
2020-07-30 12:50:02 -07:00
Kevin Krakauer bc8201d01b Have dockerutil.Wait* respect the context deadline
PiperOrigin-RevId: 324044634
2020-07-30 11:29:24 -07:00
Dean Deng c43305731e Fix SETOWN_EX return value.
Return on success should be 0, not size of the struct copied out.

PiperOrigin-RevId: 324029193
2020-07-30 10:27:44 -07:00
Ayush Ranjan f7281902f8 [runtime tests] go language test enhancement
- Unexported some passing tests. This will increase the testing surface and
  will be especially helpful when this is enabled for vfs2.
- Run tool tests with -v (verbose output). We only print the output when a test
  fails so this should not clutter the output.
- Run tool tests with "-no-rebuild" flag.
- Surround test name with appropriate regex, i.e. ^testname$. This will ensure
  that only that test is run. Earlier running go_test:os would also run
  go_test:os/exec, go_test:os/signal, go_test:os/user. This should help speed
  up the tests as we do not run the same test multiple times anymore.
- Updated bugs.

Updates #3191

PiperOrigin-RevId: 324028878
2020-07-30 10:26:09 -07:00
Zach Koopmans 2775ecd931 Update call in Node benchmark.
PiperOrigin-RevId: 324028183
2020-07-30 10:19:14 -07:00
Adin Scannell 6a59e765c3 Override the test timeout for runtimes.
PiperOrigin-RevId: 324026021
2020-07-30 10:12:20 -07:00
Adin Scannell cb1a3ba63a Fix merge flow for Go branch.
PiperOrigin-RevId: 324024075
2020-07-30 10:05:48 -07:00
Adin Scannell 61b3e05f40 Drop complex awk step.
PiperOrigin-RevId: 324023425
2020-07-30 09:59:03 -07:00
Adin Scannell 0d7c87ad01 Double the number of jobs used by RBE.
PiperOrigin-RevId: 324022546
2020-07-30 09:51:07 -07:00
Adin Scannell 84496b3a61 Disable consistently failing test.
PiperOrigin-RevId: 324017310
2020-07-30 09:25:58 -07:00
Jamie Liu 4cd4759238 Force registration for EPOLLHUP, not EPOLLRDHUP, in vfs2's epoll.
Compare Linux's fs/eventpoll.c:do_epoll_ctl(). I don't know where EPOLLRDHUP
came from.

PiperOrigin-RevId: 323874419
2020-07-29 14:57:48 -07:00
Zach Koopmans 1715896fc8 Port fio benchmark
PiperOrigin-RevId: 323810654
2020-07-29 10:15:53 -07:00
Zach Koopmans 6b4e11ab50 Port node benchmark.
PiperOrigin-RevId: 323810235
2020-07-29 10:06:38 -07:00
Jay Zhuang a6b4538ae0 Test UDP socket bound to ANY can receive unicast
PiperOrigin-RevId: 323773771
2020-07-29 06:23:23 -07:00
Fabricio Voznika f82dd8ddb4 Redirect TODO to GitHub issues
PiperOrigin-RevId: 323715260
2020-07-28 21:24:26 -07:00
gVisor bot 1e829a7c86 Merge pull request #3025 from kevinGC:ipv6-iptables-testing2
PiperOrigin-RevId: 323692144
2020-07-28 18:01:54 -07:00
Adin Scannell c1c643abe7 Delete unused script.
PiperOrigin-RevId: 323676189
2020-07-28 16:23:40 -07:00
Adin Scannell eca2fcce94 Add MIT license to top-level LICENSE file.
This is needed for e.g. pkg/safecopy/memcpy_amd64.s.

PiperOrigin-RevId: 323673052
2020-07-28 16:06:06 -07:00
Adin Scannell 7881610a3f Use the appropriate remote configuration.
PiperOrigin-RevId: 323646156
2020-07-28 13:53:13 -07:00
gVisor bot 8518800090 Merge pull request #3102 from stripe:andrew/cgroup-eintr
PiperOrigin-RevId: 323638518
2020-07-28 13:16:30 -07:00
Zach Koopmans 5873b0f43f Port tensorflow benchmark.
PiperOrigin-RevId: 323633737
2020-07-28 12:56:06 -07:00
Ayush Ranjan 15d13e3398 [Runtime Tests] Exclude flaky/failing tests
PiperOrigin-RevId: 323632510
2020-07-28 12:47:12 -07:00
Kevin Krakauer d9c9420335 ip6tables testing
We skip gVisor tests for now, as ip6tables aren't yet implemented.
2020-07-28 10:51:14 -07:00
Adin Scannell a05ea20ef1 Don't attempt to use the secret if it does not exist.
Fixes #3326

PiperOrigin-RevId: 323589669
2020-07-28 09:40:44 -07:00
Jay Zhuang 487b0905a4 More test cases on receiving UDP mcast/bcast
PiperOrigin-RevId: 323553832
2020-07-28 05:30:02 -07:00
gVisor bot 7c1c5917da Merge pull request #2797 from Rajpratik71:optimization/pip-no-cache
PiperOrigin-RevId: 323508910
2020-07-27 22:18:37 -07:00
Bhasker Hariharan 4d076ec152 Fix for gvisor-builder image.
As it happens
gvisor/tools/bazel.mk:88
 useradd --uid $(UID) --non-unique --no-create-home \
adds the user-id to /var/log/lastlog which happens to be a sparse file except
Go's tar support can't handle sparse files so it actually tries to allocate
the file to seek to the end causing the VM to run out of disk space.

See:
https://github.com/moby/moby/issues/5419#issuecomment-193876183

The fix is to pass -l to useradd to prevent it from trying to add to lastlog.

Fixes #3397

PiperOrigin-RevId: 323492591
2020-07-27 19:38:35 -07:00
Jamie Liu 18c2463596 Fix strace for epoll event arrays.
PiperOrigin-RevId: 323491461
2020-07-27 19:27:14 -07:00
gVisor bot b0eafc7454 Merge pull request #3201 from lubinszARM:pr_sys64_2
PiperOrigin-RevId: 323456118
2020-07-27 15:46:33 -07:00
gVisor bot 1b2006083c Merge pull request #3299 from lubinszARM:pr_asid
PiperOrigin-RevId: 323455097
2020-07-27 15:44:30 -07:00
Adin Scannell 4b336f16b8 Enable RBE for standard-tests.
PiperOrigin-RevId: 323454998
2020-07-27 15:36:21 -07:00
Sam Balana 8dbf428a12 Add ability to send unicast ARP requests and Neighbor Solicitations
The previous implementation of LinkAddressRequest only supported sending
broadcast ARP requests and multicast Neighbor Solicitations. The ability to
send these packets as unicast is required for Neighbor Unreachability
Detection.

Tests:
 pkg/tcpip/network/arp:arp_test
 - TestLinkAddressRequest

 pkg/tcpip/network/ipv6:ipv6_test
 - TestLinkAddressRequest

Updates #1889
Updates #1894
Updates #1895
Updates #1947
Updates #1948
Updates #1949
Updates #1950

PiperOrigin-RevId: 323451569
2020-07-27 15:21:17 -07:00
Bhasker Hariharan ca6bded95d Fix memory accounting in TCP pending segment queue.
TCP now tracks the overhead of the segment structure itself in it's out-of-order
queue (pending). This is required to ensure that a malicious sender sending 1
byte out-of-order segments cannot queue like 1000's of segments which bloat up
memory usage.

We also reduce the default receive window to 32KB. With TCP moderation there is
no need to keep this window at 1MB which means that for new connections the
default out-of-order queue will be small unless the application actually reads
the data that is being sent. This prevents a sender from just maliciously
filling up pending buf with lots of tiny out-of-order segments.

PiperOrigin-RevId: 323450913
2020-07-27 15:14:34 -07:00
gVisor bot 9a4ad9d5e7 Merge pull request #2958 from lubinszARM:pr_vfs2_1
PiperOrigin-RevId: 323443142
2020-07-27 14:38:45 -07:00
Ridwan Sharif 112eb0c5b9 Add device implementation for /dev/fuse
This PR adds the following:
  - [x] Marshall-able structs for fuse headers
  - [x] Data structures needed in /dev/fuse to communicate with the daemon server
  - [x] Implementation of the device interface
  - [x] Go unit tests

This change adds the `/dev/fuse` implementation. `Connection` controls the
communication between the server and the sentry.  The FUSE server uses
the `FileDescription` interface to interact with the Sentry. The Sentry
implmenetation of fusefs, uses `Connection` and the Connection interface
to interact with the Server. All communication messages are in the form
of `go_marshal` backed structs defined in the ABI package.

This change also adds some go unit tests that test (pretty basically)
the interfaces and should be used as an example of an end to end FUSE
operation.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/gvisor/pull/3083 from ridwanmsharif:ridwanmsharif/fuse-device-impl 69aa2ce970004938fe9f918168dfe57636ab856e
PiperOrigin-RevId: 323428180
2020-07-27 13:34:44 -07:00
Rahat Mahmood c8fa685cb6 Fix when FUSE tests need to be skipped due to sentry configuration.
PiperOrigin-RevId: 323426851
2020-07-27 13:26:23 -07:00
gVisor bot c40a3304e4 Merge pull request #3371 from kevinGC:ipt-tests-udp-faster
PiperOrigin-RevId: 323426155
2020-07-27 13:18:17 -07:00
Andrei Vagin f347a578b7 Move platform.File in memmap
The subsequent systrap changes will need to import memmap from
the platform package.

PiperOrigin-RevId: 323409486
2020-07-27 11:59:10 -07:00
gVisor bot 1876225fc8 Merge pull request #3377 from kevinGC:native-tags
PiperOrigin-RevId: 323398518
2020-07-27 11:10:24 -07:00
Adin Scannell d0fd97541a Clean-up bazel wrapper.
The bazel server was being started as the wrong user, leading to issues
where the container would suddenly exit during a build.

We can also simplify the waiting logic by starting the container in two
separate steps: those that must complete first, then the asynchronous bit.

PiperOrigin-RevId: 323391161
2020-07-27 10:40:29 -07:00
Zach Koopmans 77552f1c77 Port ffmpeg benchmark
PiperOrigin-RevId: 323383320
2020-07-27 10:10:14 -07:00
Zach Koopmans 29e5609b22 Port redis benchmark
PiperOrigin-RevId: 323381964
2020-07-27 10:01:45 -07:00
Jay Zhuang cf7141fb43 Ask for *testing.T instead of storing it
Storing *testing.T on test helper structs is problematic when
subtests are used, because it is possible for nested tests to call
Fatal on parent test, which incorrect terminates the parent test.

For example

  func TestOuter(t *testing.T) {
    dut := NewDUT(t)

    t.Run("first test", func(t *testing.T) {
      dut.FallibleCall()
    })

    t.Run("second test", func(t *testing.T) {
      dut.FallibleCall()
    }
  }

In the example above, assuming `FallibleCall` calls `t.Fatal` on the
`t` it holds, if `dut.FallibleCall` fails in "first test", it will
call `Fatal` on the parent `t`, quitting `TestOuter`. This is not a
behavior we want.

PiperOrigin-RevId: 323350241
2020-07-27 06:39:06 -07:00
Zach Koopmans 2ecf66903e Add profiling to dockerutil
Adds profiling with `runsc debug` or pprof to dockerutil. All
targets using dockerutil should now be able to use profiling.

In addition, modifies existing benchmarks to use profiling.

PiperOrigin-RevId: 323298634
2020-07-26 22:02:51 -07:00