Commit Graph

5180 Commits

Author SHA1 Message Date
Adin Scannell f884ea13b7 Move ring0 package.
This allows the package to serve as a general purpose ring0 support package, as
opposed to being bound to specific sentry platforms.

Updates #5039

PiperOrigin-RevId: 355220044
2021-02-02 12:03:26 -08:00
Fabricio Voznika d6d169320c Add ETIMEDOUT to partial result list
Reported-by: syzbot+db8d83f93b84fcb84374@syzkaller.appspotmail.com
PiperOrigin-RevId: 355213994
2021-02-02 11:37:11 -08:00
Adin Scannell 017348af99 Drop gazelle target from the Makefile.
This is replaced with a straight call to bazel. Unfortunately,
the built gazelle target requires a bazel installation to run
anyways.

PiperOrigin-RevId: 355211990
2021-02-02 11:29:02 -08:00
Bhasker Hariharan 8c7c5abafb Add support for rate limiting out of window ACKs.
Netstack today will send dupACK's with no rate limit for incoming out of
window segments. This can result in ACK loops for example if a TCP socket
connects to itself (actually permitted by TCP). Where the ACK sent in
response to packets being out of order itself gets considered as an out
of window segment resulting in another ACK being generated.

PiperOrigin-RevId: 355206877
2021-02-02 11:05:28 -08:00
Adin Scannell 3817c7349d Remove go_tool_library references.
This is required only for the built-in bazel nogo functionality.
Since we roll these targets manually via the wrappers, we don't need
to use go_tool_library. The inconsistent use of these targets leads
to conflicting instantiations of go_default_library and go_tool_library,
which both contain the same output files.

PiperOrigin-RevId: 355184975
2021-02-02 09:37:09 -08:00
Tamir Duberstein 00d21b9ae0 Assert TCP_INFO size before checking content
Also sync syscall test expectations on Fuchisa.

PiperOrigin-RevId: 355163492
2021-02-02 07:45:47 -08:00
Adin Scannell 5fa683ffdf Minor page tables improvements.
* Make split safe.
* Enable looking up next valid address.
* Support mappings with !accessType.Any(), distinct from unmap.

These changes allow for the use of pagetables in low-level OS packages, such
as ring0, and allow for the use of pagetables for more generic address space
reservation (by writing entries with no access specified).

Updates #5039

PiperOrigin-RevId: 355109016
2021-02-02 00:10:19 -08:00
Adin Scannell 0c8cc66117 Fix empty Packages file for APT repository.
This change also adds an extra sanity check to the make_apt.sh script,
in order to ensure that this simple mistake does not occur again.

PiperOrigin-RevId: 355101754
2021-02-01 23:03:58 -08:00
Fabricio Voznika aae4803808 Enable container checkpoint/restore tests with VFS2
Updates #1663

PiperOrigin-RevId: 355077816
2021-02-01 19:29:29 -08:00
Nayana Bidari d3855ad6bd Add RACK reorder tests.
PiperOrigin-RevId: 355067082
2021-02-01 18:00:38 -08:00
Adin Scannell 5d8054e75a Remove Go cache on failure.
It's unclear why permissions wind up corrupted, but these can be cleared
on any failure, similar to the bazel cache itself:
  https://buildkite.com/gvisor/pipeline/builds/2304#_

PiperOrigin-RevId: 355057421
2021-02-01 17:00:58 -08:00
gVisor bot 5230c8e13c Merge pull request #5403 from avagin:syzkaller3
PiperOrigin-RevId: 355047815
2021-02-01 16:08:49 -08:00
Ayush Ranjan 0da3c72c9d [infra] Consolidate all ubuntu tests into one image.
This makes it easier to add more tests that run on Ubuntu. We can now just
add a bash script and call that from integration_test without having to set up
another image.

PiperOrigin-RevId: 355000410
2021-02-01 12:30:45 -08:00
Adin Scannell ea63a4e733 Ignore convenience symlink. 2021-02-01 20:30:16 +00:00
Adin Scannell 4fcf8b2282
Update .devcontainer.json
Provide appropriate capabilities and adjust Docker socket.
2021-02-01 12:16:48 -08:00
Adin Scannell 196c9de99e Add basic VSCode plumbing. 2021-02-01 20:08:00 +00:00
Ghanan Gowripalan ebd3912c0f Refactor HandleControlPacket/SockError
...to remove the need for the transport layer to deduce the type of
error it received.

Rename HandleControlPacket to HandleError as HandleControlPacket only
handles errors.

tcpip.SockError now holds a tcpip.SockErrorCause interface that
different errors can implement.

PiperOrigin-RevId: 354994306
2021-02-01 12:04:03 -08:00
Ayush Ranjan cbcebfea80 [infra] Fix gazelle target.
PiperOrigin-RevId: 354991724
2021-02-01 11:53:30 -08:00
Tamir Duberstein 726100f8eb Assert expected size before unmarshalling
...to prevent panicking in case of failure.

PiperOrigin-RevId: 354970257
2021-02-01 10:29:39 -08:00
Ghanan Gowripalan d930def27a Default to NUD/neighborCache instead of linkAddrCache
This change flips gvisor to use Neighbor unreachability detection by
default to populate the neighbor table as defined by RFC 4861 section 7.
Although RFC 4861 is targeted at IPv6, the same algorithm is used for
link resolution on IPv4 networks using ARP.

Integrators may still use the legacy link address cache by setting
stack.Options.UseLinkAddrCache to true; stack.Options.UseNeighborCache
is now unused and will be removed.

A later change will remove linkAddrCache and associated code.

Updates #4658.

PiperOrigin-RevId: 354850531
2021-01-31 18:48:26 -08:00
Ghanan Gowripalan c5e3c1c7bd Use closure for IPv6 testContext cleanup
PiperOrigin-RevId: 354827491
2021-01-31 13:47:57 -08:00
Ghanan Gowripalan b4f8a92528 Remove NICs before closing their link endpoints
...in IPv6 ICMP tests.

A channel link endpoint's channel is closed when the link endpoint is
closed.

When the stack tries to send packets through a NIC with a closed channel
endpoint, a panic will occur when attempting to write to a closed
channel (https://golang.org/ref/spec#Close). To make sure the stack does
not try to send packets through a NIC, we remove it.

PiperOrigin-RevId: 354822085
2021-01-31 12:27:21 -08:00
Ghanan Gowripalan 4ee8cf8734 Use different neighbor tables per network endpoint
This stores each protocol's neighbor state separately.

This change also removes the need for each neighbor entry to keep
track of their own link address resolver now that all the entries
in a cache will use the same resolver.

PiperOrigin-RevId: 354818155
2021-01-31 11:33:46 -08:00
Ghanan Gowripalan daeb06d2cb Hide neighbor table kind from NetworkEndpoint
The network endpoint should not need to have logic to handle different
kinds of neighbor tables. Network endpoints can let the NIC know about
differnt neighbor discovery messages and let the NIC decide which table
to update.

This allows us to remove the LinkAddressCache interface.

PiperOrigin-RevId: 354812584
2021-01-31 10:03:46 -08:00
Tamir Duberstein 8dda226542 Extract route table from Stack lock
PiperOrigin-RevId: 354746864
2021-01-30 17:53:41 -08:00
Fabricio Voznika ccf9138e6d Remove side effect from open tests
Individual test cases must not rely on being executed in a clean environment.

PiperOrigin-RevId: 354730126
2021-01-30 13:38:05 -08:00
Ghanan Gowripalan 2d90bc5480 Implement LinkAddressResolver on NetworkEndpoints
This removes the need to provide the link address request with the NIC
the request is being performed on since the NetworkEndpoints already
have a reference to the NIC.

PiperOrigin-RevId: 354721940
2021-01-30 11:37:29 -08:00
Andrei Vagin 44e0a0eac9 Add syzkaller docker image 2021-01-29 19:00:57 -08:00
Ting-Yu Wang 825c185dc5 Make fragmentation return a reassembled PacketBuffer
This allows later decoupling of the backing network buffer implementation.

PiperOrigin-RevId: 354643297
2021-01-29 17:37:29 -08:00
Ghanan Gowripalan 45fe9fe9c6 Clear IGMPv1 present flag on NIC down
This is dynamic state that can be re-learned when the NIC comes
back up.

Test: ipv4_test.TestIgmpV1Present
PiperOrigin-RevId: 354630921
2021-01-29 16:10:49 -08:00
Kevin Krakauer 66aa6f3d4f setgid directory syscall tests
PiperOrigin-RevId: 354615220
2021-01-29 14:49:04 -08:00
Fabricio Voznika fdbfd447a0 Remove side effect from test cases
Individual test cases must not rely on being executed in a clean environment.

PiperOrigin-RevId: 354604389
2021-01-29 13:56:17 -08:00
Ghanan Gowripalan 5e2edfb872 Refresh delayed report timers on query messages
...as per As per RFC 2236 section 3 page 3 (for IGMPv2) and
RFC 2710 section 4 page 5 (for MLDv1).

See comments in code for more details.

Test: ip_test.TestHandleQuery
PiperOrigin-RevId: 354603068
2021-01-29 13:49:38 -08:00
Nayana Bidari 0a52b64794 - Add more comments for the TCP_INFO struct fields.
PiperOrigin-RevId: 354595623
2021-01-29 13:15:57 -08:00
Fabricio Voznika 0fa534f116 Fix deadlock in specialFileFD.pwrite
When file is regular and metadata cache is authoritative, metadata lock
is taken. The code deadlocks trying to acquire the metadata lock
again to update time stampts.

PiperOrigin-RevId: 354584594
2021-01-29 12:18:42 -08:00
gVisor bot 25284ae3c9 Merge pull request #4503 from dqminh:nested-cgroup
PiperOrigin-RevId: 354568091
2021-01-29 11:06:55 -08:00
Peter Johnston 71623e4068 Discard invalid Neighbor Advertisements
...per RFC 4861 s7.1.2.

Startblock:
  has LGTM from sbalana
  and then
  add reviewer ghanan
PiperOrigin-RevId: 354539026
2021-01-29 08:36:33 -08:00
Ghanan Gowripalan d6a39734c4 Avoid locking when route doesn't require resolution
When a route does not need to resolve a remote link address to send a
packet, avoid having to obtain the pending packets queue's lock.

PiperOrigin-RevId: 354456280
2021-01-28 20:32:09 -08:00
Nayana Bidari ff4fc42784 RACK: Update reorder window.
After receiving an ACK(cumulative or selective), RACK will update the reorder
window which is used as a settling time before marking the packet as lost.
This change will add an init function to initialize the variables in RACK and
also store the reference to sender in rackControl.
The reorder window is calculated as per rfc:
https://tools.ietf.org/html/draft-ietf-tcpm-rack-08#section-7.2 Step 4.

PiperOrigin-RevId: 354453528
2021-01-28 20:08:23 -08:00
Tamir Duberstein b81b5883c7 Acquire entry lock with cache lock held
Avoid a race condition in which an entry is acquired while it is being
evicted by overlapping the entry lock with the cache lock.

PiperOrigin-RevId: 354452639
2021-01-28 20:01:08 -08:00
Fabricio Voznika 9cc2570ea7 Change EXPECT/ASSERT to TEST_CHECK inside InForkedProcess
PiperOrigin-RevId: 354441239
2021-01-28 18:24:58 -08:00
Tamir Duberstein 8d1afb4185 Change tcpip.Error to an interface
This makes it possible to add data to types that implement tcpip.Error.
ErrBadLinkEndpoint is removed as it is unused.

PiperOrigin-RevId: 354437314
2021-01-28 17:59:58 -08:00
Tamir Duberstein c99e092a3b Propagate reader error in ReadFrom
This was removed in 6c0e1d9cfe but turns
out to be crucial to prevent flaky behaviour in sendfile.

PiperOrigin-RevId: 354434144
2021-01-28 17:41:02 -08:00
Ghanan Gowripalan 56fb2ec119 Do not use clockwork for faketime
Clockwork does not support timers being reset/stopped from different
goroutines. Our current use of clockwork causes data races and
gotsan complains about clockwork.

This change uses our own implementation of faketime, avoiding data
races.

PiperOrigin-RevId: 354428208
2021-01-28 17:08:12 -08:00
Arthur Sfez b4357939c0 Re-enable ipv4 reassembly packetimpact tests
When these specific tests were first added, they would fail when ran by
kokoro during the presubmit tests (but they always passed locally).
These tests are now passing, so they can be re-enabled. Unclear what
changed, one hypothesis is the move from kokoro to buildkite.

Fixes #4971

PiperOrigin-RevId: 354425395
2021-01-28 16:54:24 -08:00
Ayush Ranjan 62a37034f0 [vfs] Fix rename implementation in OrderedChildren.
Fixes #3027 as there is just 1 writable user using OrderedChildren's rename,
unlink and rmdir (kernfs.syntheticDirectory) but it doesn't support the sticky
bit yet.

Fuse which is the other writable user implements its own Inode operations.

PiperOrigin-RevId: 354386522
2021-01-28 16:52:18 -08:00
Zeling Feng bc4039353d Make tcp_noaccept_close_rst more robust
There used to be a race condition where we may call Close before the connection
is established. Adding poll support so that we can eliminate this kind of race.

Startblock:
  has LGTM from iyerm
  and then
  add reviewer tamird
PiperOrigin-RevId: 354369130
2021-01-28 12:31:56 -08:00
gVisor bot d8c330254a Add O_PATH support in vfs2
PiperOrigin-RevId: 354367665
2021-01-28 12:24:37 -08:00
Tamir Duberstein 449c155bc0 Correctly check permissions in ping socket test
The previous check was using SOCK_RAW, despite the fact that the test only uses
SOCK_DGRAM. Simplify the test machinery while I'm here.

PiperOrigin-RevId: 354359842
2021-01-28 11:50:29 -08:00
Michael Pratt 665c966084 Internal change.
PiperOrigin-RevId: 354327882
2021-01-28 09:31:11 -08:00