Commit Graph

5275 Commits

Author SHA1 Message Date
Zeling Feng cbac2d9f97 Fix and merge tcp_{outside_the_window,tcp_unacc_seq_ack}_closing
The tests were not using the correct windowSize so the testing segments were
actually within the window for seqNumOffset=0 tests. The issue is already fixed
by #5674.

PiperOrigin-RevId: 364252630
2021-03-22 00:06:18 -07:00
Fabricio Voznika 7fac7e32f3 Translate syserror when validating partial IO errors
syserror allows packages to register translators for errors. These
translators should be called prior to checking if the error is valid,
otherwise it may not account for possible errors that can be returned
from different packages, e.g. safecopy.BusError => syserror.EFAULT.

Second attempt, it passes tests now :-)

PiperOrigin-RevId: 363714508
2021-03-18 12:19:57 -07:00
Zach Koopmans 29be908ab6 Address post submit comments for fs benchmarks.
Also, drop fio total reads/writes to 1GB as 10GB is
prohibitively slow.

PiperOrigin-RevId: 363714060
2021-03-18 12:14:27 -07:00
Jamie Liu 5c4f4ed9eb Skip /dev submount hack on VFS2.
containerd usually configures both /dev and /dev/shm as tmpfs mounts, e.g.:

```
  "mounts": [
    ...
    {
      "destination": "/dev",
      "type": "tmpfs",
      "source": "/run/containerd/io.containerd.runtime.v2.task/moby/10eedbd6a0e7937ddfcab90f2c25bd9a9968b734c4ae361318142165d445e67e/tmpfs",
      "options": [
        "nosuid",
        "strictatime",
        "mode=755",
        "size=65536k"
      ]
    },
    ...
    {
      "destination": "/dev/shm",
      "type": "tmpfs",
      "source": "/run/containerd/io.containerd.runtime.v2.task/moby/10eedbd6a0e7937ddfcab90f2c25bd9a9968b734c4ae361318142165d445e67e/shm",
      "options": [
        "nosuid",
        "noexec",
        "nodev",
        "mode=1777",
        "size=67108864"
      ]
    },
    ...
```

(This is mostly consistent with how Linux is usually configured, except that
/dev is conventionally devtmpfs, not regular tmpfs. runc/libcontainer
implements OCI-runtime-spec-undocumented behavior to create
/dev/{ptmx,fd,stdin,stdout,stderr} in non-bind /dev mounts. runsc silently
switches /dev to devtmpfs. In VFS1, this is necessary to get device files like
/dev/null at all, since VFS1 doesn't support real device special files, only
what is hardcoded in devfs. VFS2 does support device special files, but using
devtmpfs is the easiest way to get pre-created files in /dev.)

runsc ignores many /dev submounts in the spec, including /dev/shm. In VFS1,
this appears to be to avoid introducing a submount overlay for /dev, and is
mostly fine since the typical mode for the /dev/shm mount is ~consistent with
the mode of the /dev/shm directory provided by devfs (modulo the sticky bit).
In VFS2, this is vestigial (VFS2 does not use submount overlays), and devtmpfs'
/dev/shm mode is correct for the mount point but not the mount. So turn off
this behavior for VFS2.

After this change:

```
$ docker run --rm -it ubuntu:focal ls -lah /dev/shm
total 0
drwxrwxrwt 2 root root  40 Mar 18 00:16 .
drwxr-xr-x 5 root root 360 Mar 18 00:16 ..

$ docker run --runtime=runsc --rm -it ubuntu:focal ls -lah /dev/shm
total 0
drwxrwxrwx 1 root root 0 Mar 18 00:16 .
dr-xr-xr-x 1 root root 0 Mar 18 00:16 ..

$ docker run --runtime=runsc-vfs2 --rm -it ubuntu:focal ls -lah /dev/shm
total 0
drwxrwxrwt 2 root root  40 Mar 18 00:16 .
drwxr-xr-x 5 root root 320 Mar 18 00:16 ..
```

Fixes #5687

PiperOrigin-RevId: 363699385
2021-03-18 11:12:43 -07:00
Ghanan Gowripalan d3a433caae Do not use martian loopback packets in tests
Transport demuxer and UDP tests should not use a loopback address as the
source address for packets injected into the stack as martian loopback
packets will be dropped in a later change.

PiperOrigin-RevId: 363479681
2021-03-17 12:29:08 -07:00
Ghanan Gowripalan 4065604e1b Drop loopback traffic from outside of the stack
Loopback traffic should be stack-local but gVisor has some clients
that depend on the ability to receive loopback traffic that originated
from outside of the stack. Because of this, we guard this change behind
IP protocol options.

Test: integration_test.TestExternalLoopbackTraffic
PiperOrigin-RevId: 363461242
2021-03-17 11:12:06 -07:00
Zeling Feng 3dd7ad13b4 Fix tcp_fin_retransmission_netstack_test
Netstack does not check ACK number for FIN-ACK packets and goes into TIMEWAIT
unconditionally. Fixing the state machine will give us back the retransmission
of FIN.

PiperOrigin-RevId: 363301883
2021-03-16 16:59:26 -07:00
Mithun Iyer 5eede4e756 Fix a race with synRcvdCount and accept
There is a race in handling new incoming connections on a listening
endpoint that causes the endpoint to reply to more incoming SYNs than
what is permitted by the listen backlog.

The race occurs when there is a successful passive connection handshake
and the synRcvdCount counter is decremented, followed by the endpoint
delivered to the accept queue. In the window of time between
synRcvdCount decrementing and the endpoint being enqueued for accept,
new incoming SYNs can be handled without honoring the listen backlog
value, as the backlog could be perceived not full.

Fixes #5637

PiperOrigin-RevId: 363279372
2021-03-16 15:08:09 -07:00
Kevin Krakauer 607a1e481c setgid directory support in overlayfs
PiperOrigin-RevId: 363276495
2021-03-16 14:55:29 -07:00
Ghanan Gowripalan 05193de1cc Unexport methods on NDPOption
They are not used outside of the header package.

PiperOrigin-RevId: 363237708
2021-03-16 12:04:52 -07:00
Ghanan Gowripalan 68065d1ceb Detect looped-back NDP DAD messages
...as per RFC 7527.

If a looped-back DAD message is received, do not fail DAD since our own
DAD message does not indicate that a neighbor has the address assigned.

Test: ndp_test.TestDADResolveLoopback
PiperOrigin-RevId: 363224288
2021-03-16 11:09:26 -07:00
Ghanan Gowripalan ebd7c1b889 Do not call into Stack from LinkAddressRequest
Calling into the stack from LinkAddressRequest is not needed as we
already have a reference to the network endpoint (IPv6) or network
interface (IPv4/ARP).

PiperOrigin-RevId: 363213973
2021-03-16 10:29:49 -07:00
Etienne Perot f7e841c2ce Turn sys_thread constants into variables.
PiperOrigin-RevId: 363092268
2021-03-15 20:16:48 -07:00
Etienne Perot f4b7421820 Move MaxIovs back to a variable in iovec.go.
PiperOrigin-RevId: 363091954
2021-03-15 20:11:41 -07:00
Fabricio Voznika 34d0d72067 Deflake proc_test_native
Terminating tasks from other tests can mess up with the task
list of the current test. Tests were changed to look for added/removed
tasks, ignoring other tasks that may exist while the test is running.

PiperOrigin-RevId: 363084261
2021-03-15 19:06:03 -07:00
Kevin Krakauer b1d5787726 Make netstack (//pkg/tcpip) buildable for 32 bit
Doing so involved breaking dependencies between //pkg/tcpip and the rest
of gVisor, which are discouraged anyways.

Tested on the Go branch via:
  gvisor.dev/gvisor/pkg/tcpip/...

Addresses #1446.

PiperOrigin-RevId: 363081778
2021-03-15 18:49:59 -07:00
Ayush Ranjan ec45d96923 [op] Make gofer client handle return partial write length when err is nil.
If there was a partial write (when not using the host FD) which did not generate
an error, we were incorrectly returning the number of bytes attempted to write
instead of the number of bytes actually written.

PiperOrigin-RevId: 363058989
2021-03-15 16:41:02 -07:00
gVisor bot 48915d17df Merge pull request #5618 from iangudger:unix-transport-race
PiperOrigin-RevId: 362999220
2021-03-15 12:16:07 -07:00
Zeling Feng 06b047a5a8 Packetimpact test for ACK to OTW Seq segments behavior in CLOSING
TCP, in CLOSING state, MUST send an ACK with next expected SEQ number after
receiving any segment with OTW SEQ number and remain in the same state.
While I am here, I also changed shutdown to behave the same as other calls
in posix_server.

PiperOrigin-RevId: 362976955
2021-03-15 10:47:58 -07:00
Mithun Iyer b9c2174b08 Fix race in tcp_retransmits_test
The test queries for RTO via TCP_INFO and applies that to the
rest of the test. The RTO is estimated by processing incoming ACK.
There is a race in the test where we may query for RTO before the
incoming ACK was processed. Fix the race in the test by letting the
DUT complete a payload receive, thus estimating RTO before proceeding
to query the RTO. Bump up the time correction to reduce flakes.

PiperOrigin-RevId: 362865904
2021-03-14 22:30:25 -07:00
Ayush Ranjan ee6b22ca63 [perf] Run benchmarks with VFS2.
The run-benchmark target would run the benchmark with VFS1.

PiperOrigin-RevId: 362754188
2021-03-13 20:29:56 -08:00
Nicolas Lacasse 337b36e570 Add escapes to newlines in syzkaller instructions.
So they can be copy-pasted.

PiperOrigin-RevId: 362605833
2021-03-12 14:52:50 -08:00
gVisor bot f04d10bada Merge pull request #5663 from avagin:apt-repo
PiperOrigin-RevId: 362545342
2021-03-12 10:07:13 -08:00
Zeling Feng ab488702a6 Support ICMP echo sockets on Linux DUT
By default net.ipv4.ping_group_range is set to "1 0" and no one (even the root)
can create an ICMP socket. Setting it to "0 0" allows root, which we are inside
the container, to create ICMP sockets for packetimpact tests.

PiperOrigin-RevId: 362454201
2021-03-11 22:37:10 -08:00
Andrei Vagin 8cbea788b9 make/release: Sign a package only if it isn't signed yet.
We can generate more than one apt repo for the same package.  If we will
sign a package again, its file will be changed and all hashes that have
been generated before will be invalid.
2021-03-11 21:59:51 -08:00