Commit Graph

2720 Commits

Author SHA1 Message Date
Ghanan Gowripalan fbe80460a7 Handle IPv6 Fragment & Routing extension headers
Enables the reassembly of fragmented IPv6 packets and handling of the
Routing extension header with a Segments Left value of 0. Atomic
fragments are handled as described in RFC 6946 to not interfere with
"normal" fragment traffic. No specific routing header type is supported.

Note, the stack does not yet support sending ICMPv6 error messages in
response to IPv6 packets that cannot be handled/parsed. That will come
in a later change (Issue #2211).

Test:
- header_test.TestIPv6RoutingExtHdr
- header_test.TestIPv6FragmentExtHdr
- header_test.TestIPv6ExtHdrIterErr
- header_test.TestIPv6ExtHdrIter
- ipv6_test.TestReceiveIPv6ExtHdrs
- ipv6_test.TestReceiveIPv6Fragments

RELNOTES: n/a
PiperOrigin-RevId: 303189584
2020-03-26 14:05:39 -07:00
Nicolas Lacasse e466ab04a2 Add unique ID to Mount type.
Analagous to Linux's mount.mnt_id. This ID is displayed in
/proc/[pid]/mountinfo.

PiperOrigin-RevId: 303185564
2020-03-26 13:49:59 -07:00
gVisor bot 01ac53099f Merge pull request #2254 from kevinGC:container-timeout
PiperOrigin-RevId: 303159175
2020-03-26 11:42:15 -07:00
gVisor bot f5fbe859ed Merge pull request #2177 from xiaobo55x:sysret_test
PiperOrigin-RevId: 303158421
2020-03-26 11:37:45 -07:00
Jay Zhuang d5ef8091b4 Add IPv4 to bind_to_device distribution test
PiperOrigin-RevId: 303156734
2020-03-26 11:33:28 -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
Jay Zhuang c64796748c Clean up transport_demuxer.go and test
- Change receiver of endpoint lookup functions
- Remove unused struct fields and functions in test
- s/%v/%s/ for errors
- Capitalize NIC
  https://github.com/golang/go/wiki/CodeReviewComments#initialisms

PiperOrigin-RevId: 303119580
2020-03-26 08:50:17 -07:00
gVisor bot 7aa388ce74 Merge pull request #1986 from lubinszARM:pr_ring0_clean_1
PiperOrigin-RevId: 303105826
2020-03-26 08:49:12 -07:00
Fabricio Voznika de694e5484 Combine file mode and isDir arguments
Updates #1035

PiperOrigin-RevId: 303021328
2020-03-26 08:48:04 -07:00
Kevin Krakauer 4f374da60c iptable: fix tests timeouts
Tests were run assuming a runtime of "runsc" was present, and did not
have --net-raw enabled.
2020-03-25 20:37:48 -07:00
gVisor bot ce0a69ea97 Merge pull request #2238 from amscanne:nogo
PiperOrigin-RevId: 303010530
2020-03-25 17:55:14 -07:00
Adin Scannell 882ed330e6 nogo: enable sanitizers.
This enables all relevant santizers (though most analyzers will not find
much, it will prevent instances from creeping in), and codifies existing
exceptions in tools/nogo.js to be fixed.
2020-03-25 16:21:27 -07:00
Adin Scannell d440fe0613 Fix go_marshal Example name.
There is a canonical naming convention for Examples, which are checked
by analyzers. This must be fixed since adding exceptions for generated
code will be more challenging.
2020-03-25 16:18:05 -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 f2eba94015 Remove TODO to push down exec permission check
Pushing it down requires all implementation to check for
exec individualy which is not maintanable. Making it part
of GenericCheckPermissions add extra cost to everyone that
calls it. So it's better to keep is in
VirtualFilesystem.OpenAt.

Updates #1193

PiperOrigin-RevId: 302982993
2020-03-25 15:57:37 -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
Fabricio Voznika c7f5673529 Set file mode and type to attribute
Makes less error prone to find file type.

Updates #1197

PiperOrigin-RevId: 302974244
2020-03-25 14:49:13 -07:00
Andrei Vagin 2e09f2bdce travis: exclude copybara branches
When copybara migrates changes, it creates a new branch and then creates a
pull-requests which is based on this branch. In this case, travis-ci
triggers build twice for the branch and for the pull-request.

PiperOrigin-RevId: 302930634
2020-03-25 11:21:34 -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
Bhasker Hariharan d04adebaab Fix data-race in endpoint.Readiness
PiperOrigin-RevId: 302924789
2020-03-25 10:55:22 -07:00
Bhasker Hariharan d8c4eff3f7 Automated rollback of changelist 301837227
PiperOrigin-RevId: 302891559
2020-03-25 08:11:21 -07:00
Bhasker Hariharan c8eeedcc1d Add support for setting TCP segment hash.
This allows the link layer endpoints to consistenly hash a TCP
segment to a single underlying queue in case a link layer endpoint
does support multiple underlying queues.

Updates #231

PiperOrigin-RevId: 302760664
2020-03-24 15:34:43 -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
Bhasker Hariharan 7e4073af12 Move tcpip.PacketBuffer and IPTables to stack package.
This is a precursor to be being able to build an intrusive list
of PacketBuffers for use in queuing disciplines being implemented.

Updates #2214

PiperOrigin-RevId: 302677662
2020-03-24 09:06:26 -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
Bhasker Hariharan 369cf38bd7 Fix data race in SetSockOpt.
PiperOrigin-RevId: 302539171
2020-03-23 16:06:33 -07:00
Dean Deng 6eebaea949 Correctly release taskPathOperation for accessAt.
PiperOrigin-RevId: 302518924
2020-03-23 14:33:15 -07:00
Kevin Krakauer 8c35614760 iptables: enable iptables tests as nonblocking
PiperOrigin-RevId: 302506064
2020-03-23 13:36:26 -07:00
Eyal Soha fed59953aa Statically link libpthread for static c++ binaries.
The posix_server works fine when run in locally or in docker but fails in the
kokoro GCP build environment. Linking libpthread statically fixes it.

PiperOrigin-RevId: 302139082
2020-03-20 18:24:00 -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
Bhasker Hariharan 1bf2e52bdb Actually wrap rand.Reader in bufio.Reader.
Updates #231

PiperOrigin-RevId: 302127697
2020-03-20 17:02:13 -07:00
Ting-Yu Wang 49aef9cee7 Remove unused variable `sndNxtList`.
PiperOrigin-RevId: 302110328
2020-03-20 15:25:15 -07:00
Dean Deng 248e46f320 Whitelist utimensat(2).
utimensat is used by hostfs for setting timestamps on imported fds. Previously,
this would crash the sandbox since utimensat was not allowed.

Correct the VFS2 version of hostfs to match the call in VFS1.

PiperOrigin-RevId: 301970121
2020-03-19 23:30:21 -07:00
Fabricio Voznika 069f1edbe4 Improve error message when pivot_root fails
PiperOrigin-RevId: 301949722
2020-03-19 20:18:03 -07:00
Zach Koopmans b9210b2855 Fix bm-tools to run on bazel.
Fixes random stuff that is broken on bazel/kokoro.
- random output coming back as "bytes" object instead of str
- missed syntax error in bazel
- a flag is missing in the version of gcloud on kokoro

PiperOrigin-RevId: 301915289
2020-03-19 16:07:05 -07:00
Zach Koopmans 57d9bd922b Remove the "frozen" bit from dirents.
Frozen was to lock down changes to the host filesystem
for hostFS. Now that hostFS is gone, it can be removed.

PiperOrigin-RevId: 301907923
2020-03-19 15:30:13 -07:00
Michael Pratt 238e80fe38 Automated rollback of changelist 300409401
PiperOrigin-RevId: 301891849
2020-03-19 14:10:37 -07:00
Eyal Soha e0fbcdcb7f Add packetimpact tests to presubmit and CI testing
PiperOrigin-RevId: 301872161
2020-03-19 12:33:29 -07:00
Jay Zhuang 8b461aa36b Remove redundant dep in BUILD
PiperOrigin-RevId: 301859066
2020-03-19 11:34:49 -07:00
Bhasker Hariharan 3a37f67917 Change SocketOperations.readMu to an RWMutex.
Also get rid of the readViewHasData as it's not required anymore.

Updates #231, #357

PiperOrigin-RevId: 301837227
2020-03-19 10:00:31 -07:00
Bhasker Hariharan fd27a917ef Address comments on workMu removal change.
Updates #231, #357

PiperOrigin-RevId: 301833669
2020-03-19 09:43:23 -07:00
Bhasker Hariharan e9e399c25d Remove workMu from tcpip.Endpoint.
workMu is removed and e.mu is now a mutex that supports TryLock.  The packet
processing path tries to lock the mutex and if its locked it will just queue the
packet and move on. The endpoint.UnlockUser() will process any backlog of
packets before unlocking the socket.

This simplifies the locking inside tcp endpoints a lot. Further the
endpoint.LockUser() implements spinning as long as the lock is not held by
another syscall goroutine. This ensures low latency as not spinning leads to the
task thread being put to sleep if the lock is held by the packet dispatch
path. This is suboptimal as the lower layer rarely holds the lock for long so
implementing spinning here helps.

If the lock is held by another task goroutine then we just proceed to call
LockUser() and the task could be put to sleep.

The protocol goroutines themselves just call e.mu.Lock() and block if the
lock is currently not available.

Updates #231, #357

PiperOrigin-RevId: 301808349
2020-03-19 07:19:58 -07:00
Dean Deng 3a42638a0b Port imported TTY fds to vfs2.
Refactor fs/host.TTYFileOperations so that the relevant functionality can be
shared with VFS2 (fsimpl/host.ttyFD).

Incorporate host.defaultFileFD into the default host.fileDescription. This way,
there is no need for a separate default_file.go. As in vfs1, the TTY file
implementation can be built on top of this default and override operations as
necessary (PRead/Read/PWrite/Write, Release, Ioctl).

Note that these changes still need to be plumbed into runsc, which refers to
imported TTYs in control/proc.go:ExecAsync.

Updates #1672.

PiperOrigin-RevId: 301718157
2020-03-18 19:12:10 -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
Andrei Vagin c3cee7f5a4 Deflake third_party/gvisor/pkg/gate/gate_test
TestConcurrentAll executes 1000 goroutines which never sleep,
so they are not preempted by Go's runtime. In Go 1.14, async preemption
has been added, but the added runtime.Gosched() call will do nothing
wrong in this case too.

PiperOrigin-RevId: 301705712
2020-03-18 17:42:29 -07:00
gVisor bot a0fed7ea45 Merge pull request #2061 from lubinszARM:pr_restart_syscall
PiperOrigin-RevId: 301700868
2020-03-18 17:11:43 -07:00
Ian Gudger 92a00ca91a Store segment transmit count.
This will aid in segment reordering detection.

Updates #691

PiperOrigin-RevId: 301692638
2020-03-18 16:26:36 -07:00
Kevin Krakauer b5ea65c07c iptables: skip tests for not-yet-supported features
PiperOrigin-RevId: 301686266
2020-03-18 15:52:57 -07:00