Commit Graph

1117 Commits

Author SHA1 Message Date
Andrei Vagin c002fc36f9 sockets: ignore io.EOF from view.ReadAt
Reported-by: syzbot+5466463b7604c2902875@syzkaller.appspotmail.com
PiperOrigin-RevId: 337451896
2020-10-15 23:15:48 -07:00
Zeling Feng 0d54b41e55 Syncing packetimpact tests in different directories
By exposing an ALL_TESTS list in defs.bzl we can make sure all packetimpact
users get to agree on the list of all tests. A defect in this approach is that
we have to keep a list of packetimpact_testbench rules in the BUILD file. An
helper validate_all_tests has been added to help keep BUILD and .bzl files in
sync.

PiperOrigin-RevId: 337411839
2020-10-15 17:02:00 -07:00
Andrei Vagin 10ca12b3d0 gvisor/test: Set nogotsan for native tests
Tests are written in C++ and there is no reason to run them with gotsan without
gVisor.

PiperOrigin-RevId: 336783276
2020-10-12 17:57:37 -07:00
Bhasker Hariharan db36d948fa TCP Receive window advertisement fixes.
The fix in commit 028e045da9 was incorrect as
it can cause the right edge of the window to shrink when we announce
a zero window due to receive buffer being full as its done before the check
for seeing if the window is being shrunk because of the selected window.

Further the window was calculated purely on available space but in cases where
we are getting full sized segments it makes more sense to use the actual bytes
being held. This CL changes to use the lower of the total available space vs
the available space in the maximal window we could advertise minus the actual
payload bytes being held.

This change also cleans up the code so that the window selection logic is
not duplicated between getSendParams() and windowCrossedACKThresholdLocked.

PiperOrigin-RevId: 336404827
2020-10-09 19:02:03 -07:00
Kevin Krakauer 79a5910c04 Add gvisor webhook configuration
PiperOrigin-RevId: 336393190
2020-10-09 17:11:19 -07:00
Zach Koopmans b576de907c Add parsers golang benchmarks.
Add parser and formatting for golang benchmarks for docker benchmarks.
Change adds a library for printing and parsing Test parameters and metrics.
Benchmarks use the library to print parameters in the Benchmark title
(e.g. the name field in b.Run()), and to report CustomMetrics. Parser
uses the library to parse printed data from benchmark output and
put it into BigQuery structs.

PiperOrigin-RevId: 336365628
2020-10-09 14:29:21 -07:00
Zeling Feng 46e168b5a0 Set expect_failure flags on tests that currently fails on fuchsia
PiperOrigin-RevId: 336350318
2020-10-09 13:07:01 -07:00
Andrei Vagin 33d6622172 test/syscall/iptables: don't use designated initializers
test/syscalls/linux/iptables.cc:130:3:
error: C99 designator 'name' outside aggregate initializer
  130 |   };
      |
PiperOrigin-RevId: 336331738
2020-10-09 11:30:52 -07:00
Adin Scannell a55bd73d48 Add staticcheck and staticstyle analyzers.
This change also adds support to go_stateify for detecting an appropriate
receiver name, avoiding a large number of false positives.

PiperOrigin-RevId: 335994587
2020-10-07 18:29:05 -07:00
Ayush Ranjan 85a58d110f [runtime-tests] Exclude failing test due to expired cert.
PiperOrigin-RevId: 335927821
2020-10-07 12:32:44 -07:00
Arthur Sfez 99bf022c2a Add support for IPv6 fragmentation
Most of the IPv4 fragmentation code was moved in the fragmentation
package and it is reused by IPv6 fragmentation.

Test:
  - pkg/tcpip/network/ipv4:ipv4_test
  - pkg/tcpip/network/ipv6:ipv6_test
  - pkg/tcpip/network/fragmentation:fragmentation_test

Fixes #4389

PiperOrigin-RevId: 335714280
2020-10-06 14:03:39 -07:00
Jamie Liu 1336af78d5 Implement membarrier(2) commands other than *_SYNC_CORE.
Updates #267

PiperOrigin-RevId: 335713923
2020-10-06 13:55:16 -07:00
Fabricio Voznika 9e9fec3a09 Enable more VFS2 tests
Updates #1487

PiperOrigin-RevId: 335516732
2020-10-05 15:54:36 -07:00
Kevin Krakauer e73bb6d302 Remove reference to deleted script
PiperOrigin-RevId: 335516625
2020-10-05 15:49:14 -07:00
gVisor bot 5aa75653ab Internal change.
PiperOrigin-RevId: 335429072
2020-10-05 13:17:19 -07:00
Dean Deng e0aaf40e39 Fix kcov enabling and disabling procedures.
- When the KCOV_ENABLE_TRACE ioctl is called with the trace kind KCOV_TRACE_PC,
  the kcov mode should be set to KCOV_*MODE*_TRACE_PC.
- When the owning task of kcov exits, the memory mapping should not be cleared
  so it can be used by other tasks.
- Add more tests (also tested on native Linux kcov).

PiperOrigin-RevId: 335202585
2020-10-03 09:26:25 -07:00
Jamie Liu ed94c0de51 Actually disable nodejs test parallel/test-fs-write-stream-double-close.
PiperOrigin-RevId: 335070320
2020-10-02 11:51:17 -07:00
Adin Scannell ae51aef5bb Ensure proctor is built as pure Go binary.
PiperOrigin-RevId: 334716351
2020-09-30 17:48:52 -07:00
Kevin Krakauer 6f8d64f422 ip6tables: redirect support
Adds support for the IPv6-compatible redirect target. Redirection is a limited
form of DNAT, where the destination is always the localhost.

Updates #3549.

PiperOrigin-RevId: 334698344
2020-09-30 16:04:26 -07:00
Adin Scannell d4d9238c52 Stop depending on go_binary targets.
Closes #3374

PiperOrigin-RevId: 334505627
2020-09-29 18:34:59 -07:00
Fabricio Voznika 4a428b13b2 Add /proc/[pid]/cwd
PiperOrigin-RevId: 334478850
2020-09-29 15:49:27 -07:00
Kevin Krakauer 7fbb45e8ed iptables: refactor to make targets extendable
Like matchers, targets should use a module-like register/lookup system. This
replaces the brittle switch statements we had before.

The only behavior change is supporing IPT_GET_REVISION_TARGET. This makes it
much easier to add IPv6 redirect in the next change.

Updates #3549.

PiperOrigin-RevId: 334469418
2020-09-29 15:02:25 -07:00
gVisor bot b6fb11a290 Migrates uses of deprecated map types to recommended types.
PiperOrigin-RevId: 334419854
2020-09-29 11:13:03 -07:00
Nayana Bidari 237b761f9a Fix lingering of TCP socket in the initial state.
When the socket is set with SO_LINGER and close()'d in the initial state, it
should not linger and return immediately.

PiperOrigin-RevId: 334263149
2020-09-28 16:39:12 -07:00
Ghanan Gowripalan a5acc0616c Support creating protocol instances with Stack ref
Network or transport protocols may want to reach the stack. Support this
by letting the stack create the protocol instances so it can pass a
reference to itself at protocol creation time.

Note, protocols do not yet use the stack in this CL but later CLs will
make use of the stack from protocols.

PiperOrigin-RevId: 334260210
2020-09-28 16:24:04 -07:00
Dean Deng a0e0ba690f Support inotify in overlayfs.
Fixes #1479, #317.

PiperOrigin-RevId: 334258052
2020-09-28 16:11:16 -07:00
Dean Deng 2a60f92291 Clean up kcov.
Previously, we did not check the kcov mode when performing task work. As a
result, disabling kcov did not do anything.

Also avoid expensive atomic RMW when consuming coverage data. We don't need the
swap if the value is already zero (which is most of the time), and it is ok if
there are slight inconsistencies due to a race between coverage data generation
(incrementing the value) and consumption (reading a nonzero value and writing
zero).

PiperOrigin-RevId: 334049207
2020-09-27 15:33:51 -07:00
Jamie Liu d79cf4808d Disable flaky java11 tests.
Regarding ThreadCpuTimeArray.java: The test starts 10 threads, each of which
does some computation, then blocks. When all threads are blocked, the test
sleeps for 200ms, then checks that less than 100ns of CPU time in userspace
elapse over the course of the sleep; AFAICT, the 100ns of slop is because a
thread indicates that it's in the WAITING state before it actually blocks, and
because signals can cause threads to be temporarily woken. gVisor's CPU clocks
have a granularity of 10ms (the interval of Kernel.cpuClockTicker is
//pkg/abi/linux.ClockTick), so a single tick pushes the test over the
threshold.

PiperOrigin-RevId: 333830287
2020-09-25 16:28:00 -07:00
Zach Koopmans c3fc69022a Fix Nginx Startup and Size Benchmarks.
Changes in Nginx Benchmarks in network_tests also affect Startup/Size
Nginx Benchmarks. Make sure the commands line up.

PiperOrigin-RevId: 333543697
2020-09-24 10:32:01 -07:00
Bhasker Hariharan 5d50c91c4d Change segment/pending queue to use receive buffer limits.
segment_queue today has its own standalone limit of MaxUnprocessedSegments but
this can be a problem in UnlockUser() we do not release the lock till there are
segments to be processed. What can happen is as handleSegments dequeues packets
more keep getting queued and we will never release the lock. This can keep
happening even if the receive buffer is full because nothing can read() till we
release the lock.

Further having a separate limit for pending segments makes it harder to track
memory usage etc. Unifying the limits makes it easier to reason about memory in
use and makes the overall buffer behaviour more consistent.

PiperOrigin-RevId: 333508122
2020-09-24 07:15:06 -07:00
Andrei Vagin 0a232a5e8c test/syscall/mknod: Don't use a hard-coded file name
PiperOrigin-RevId: 333461380
2020-09-24 00:48:35 -07:00
Dean Deng 03898a087d Clean up inotify tests.
Mostly simplifies SKIP_IF statements and adds some more documentation.
Also, mknod is now supported by gofer fs, so remove SKIP_IFs related to this.

PiperOrigin-RevId: 333449932
2020-09-23 23:02:04 -07:00
Ayush Ranjan fc1bf0d756 Remove unused scripts.
PiperOrigin-RevId: 333408633
2020-09-23 17:38:02 -07:00
Zeling Feng c3c66ea428 Clean up flag.* usage in packetimpact's runner.RegisterFlags
PiperOrigin-RevId: 333400865
2020-09-23 16:51:34 -07:00
Ghanan Gowripalan 059d90b9f1 Receive ACK when deleting address in syscall tests
PiperOrigin-RevId: 332961666
2020-09-21 16:34:44 -07:00
Zach Koopmans 06dbd5b7bc Fix socket_ipv4_udp_unbound_test_native in opensource.
Calls to recv sometimes fail with EAGAIN, so call select beforehand.

PiperOrigin-RevId: 332943156
2020-09-21 15:06:05 -07:00
Zach Koopmans a129204cf5 Fix proc_net_test_native for native tests.
"DefaultValueEqZero" is only valid if the test is in a
sandbox. Our CI VMs often have "/proc/sys/net/ipv4/ip_forward" set
to 1.

PiperOrigin-RevId: 332910859
2020-09-21 12:46:21 -07:00
Dean Deng d72022373f Add ftruncate test for writeable fd but no write permissions.
PiperOrigin-RevId: 332907453
2020-09-21 12:30:53 -07:00
Zach Koopmans 5ce5882951 Fix flakes in UdpSocketTest
`recv` calls with MSG_DONTWAIT can fail with EAGAIN randomly
in tests. Fix this by calling `select` on sockets with a timeout
prior to attempting a `recv`.

PiperOrigin-RevId: 332873735
2020-09-21 10:05:45 -07:00
gVisor bot ca30874720 Merge pull request #3651 from ianlewis:ip-forwarding
PiperOrigin-RevId: 332760843
2020-09-20 18:17:20 -07:00
Jamie Liu 916751039c Disable vdso_clock_gettime on KVM.
Unfortunately, I think TSC misalignment means that we can't really expect any
consistent correspondence between a TSC-based VDSO and the sentry's view of
time on the KVM platform.

PiperOrigin-RevId: 332576147
2020-09-18 20:53:55 -07:00
Nicolas Lacasse 6c9989cb8c Deflake stat_test with save/restore enabled.
PiperOrigin-RevId: 332546659
2020-09-18 16:13:07 -07:00
Jamie Liu c23e39f419 Implement fsimpl/overlay.filesystem.RenameAt.
Updates #1199

PiperOrigin-RevId: 332539197
2020-09-18 15:29:26 -07:00
Jamie Liu b8ba0893ec Disable PHP test ext/standard/tests/streams/proc_open_bug60120.phpt.
PiperOrigin-RevId: 332521647
2020-09-18 14:00:19 -07:00
Jamie Liu ca4ecf481d Use a tmpfs file for shared anonymous and /dev/zero mmap on VFS2.
This is more consistent with Linux (see comment on MM.NewSharedAnonMappable()).
We don't do the same thing on VFS1 for reasons documented by the updated
comment.

PiperOrigin-RevId: 332514849
2020-09-18 13:25:35 -07:00
Kevin Krakauer f911b43f05 Remove SKIP_IF for now-supported features.
Updates #3549.

PiperOrigin-RevId: 332501660
2020-09-18 12:20:36 -07:00
Mithun Iyer fcf8d7c6dd Enqueue TCP sends arriving in SYN_SENT state.
TCP needs to enqueue any send requests arriving when the connection is in
SYN_SENT state. The data should be sent out soon after completion of the
connection handshake.

Fixes #3995

PiperOrigin-RevId: 332482041
2020-09-18 10:49:21 -07:00
Kevin Krakauer 0b8d306e64 ip6tables: filter table support
`ip6tables -t filter` is now usable. NAT support will come in a future CL.

#3549

PiperOrigin-RevId: 332381801
2020-09-17 21:54:48 -07:00
Nayana Bidari d34bda0273 {Set,Get} SO_LINGER on all endpoints.
SO_LINGER is a socket level option and should be stored on all endpoints even
though it is used to linger only for TCP endpoints.

PiperOrigin-RevId: 332369252
2020-09-17 20:00:33 -07:00
Ayush Ranjan 23fcbd8722 [testing] Use container address to talk to server running inside container.
Docker does not have IPv6 port forwarding as tracked by the following issue:
https://github.com/moby/moby/issues/11518

So when running bazel itself inside a docker container, we can not use the host
port bindings to communicate with sockets inside the container. This was causing
integration tests and image tests to fail when run through our Makefile targets.

PiperOrigin-RevId: 332355051
2020-09-17 17:58:08 -07:00