Commit Graph

2628 Commits

Author SHA1 Message Date
Tamir Duberstein ac05043525 Implement heap.Interface on pointer receiver
PiperOrigin-RevId: 300467253
2020-03-11 20:38:05 -07:00
Tamir Duberstein 538e35f61b Fix race condition (*tcp.endpoint).Close
Atomically close the endpoint. Before this change, it was possible for
multiple callers to perform duplicate work.

PiperOrigin-RevId: 300462110
2020-03-11 19:57:25 -07:00
Adin Scannell 61051f2268 Clean-up buffer implementation.
This also adds substantial test cases.

The Read/Write interfaces are dropped as they are not necessary.

PiperOrigin-RevId: 300461547
2020-03-11 19:52:14 -07:00
gVisor bot a9c6135ed7 Merge pull request #2108 from kevinGC:prepare-ipt-tests
PiperOrigin-RevId: 300449422
2020-03-11 18:17:20 -07:00
Bhasker Hariharan 81675b850e Fix memory leak in danglingEndpoints.
Endpoints which were being terminated in an ERROR state or were moved to CLOSED
by the worker goroutine do not run cleanupLocked() as that should already be run
by the worker termination. But when making that change we made the mistake of
not removing the endpoint from the danglingEndpoints which is normally done in
cleanupLocked().

As a result these endpoints are leaked since a reference is held to them in the
danglingEndpoints array forever till Stack is torn down.

PiperOrigin-RevId: 300438426
2020-03-11 17:03:57 -07:00
Kevin Krakauer 4054b021f0 iptables: ready tests to be enabled in kokoro
Fixed flakes (tested via --runs_per_test=100) and added skips for
not-yet-implemented features. Once submitted, the iptables tests will be
ready to enable in kokoro.
2020-03-11 15:13:58 -07:00
Zach Koopmans fd84cddab0 Internal change
PiperOrigin-RevId: 300410856
2020-03-11 14:46:17 -07:00
Michael Pratt 5ee9bbb15d Upgrade Kythe
PiperOrigin-RevId: 300409401
2020-03-11 14:39:21 -07:00
Andrei Vagin 22d89ef5cb Import "unsafe" in bluepill_arm64_unsafe.go
This fixes a compile time error:
pkg/sentry/platform/kvm/bluepill_arm64_unsafe.go:45:35: undefined: unsafe

PiperOrigin-RevId: 300375687
2020-03-11 12:01:46 -07:00
Andrei Vagin d3fa741fb5 runsc: Set asyncpreemptoff for the kvm platform
The asynchronous goroutine preemption is a new feature of Go 1.14.

When we switched to go 1.14 (cl/297915917) in the bazel config,
the kokoro syscall-kvm job started permanently failing. Lets
temporary set asyncpreemptoff for the kvm platform to unblock tests.

PiperOrigin-RevId: 300372387
2020-03-11 11:45:50 -07:00
gVisor bot 2c2622b942 Merge pull request #1975 from nybidari:iptables
PiperOrigin-RevId: 300362789
2020-03-11 11:02:04 -07:00
Andrei Vagin 2aa9514a06 runsc: don't redirect SIGURG which is used by Go's runtime scheduler
Go 1.14+ sends SIGURG to Ms to attempt asynchronous preemption of a G. Since it
can't guarantee that a SIGURG is only related to preemption, it continues to
forward them to signal.Notify (see runtime.sighandler).

When runsc is running a container, there are three processes: a parent process
and two children (sandbox and gopher). A parent process sets a signal handler
for all signals and redirect them to the container init process. This logic
should ignore SIGURG signals. We already ignore them in the Sentry, but it will
be better to not notify about them when this is possible.

PiperOrigin-RevId: 300345286
2020-03-11 09:50:06 -07:00
gVisor bot 7bca09107b Automated rollback of changelist 300217972
PiperOrigin-RevId: 300308974
2020-03-11 06:08:56 -07:00
gVisor bot 24e7005ab6 Merge pull request #1832 from xiaobo55x:tls_ptrace
PiperOrigin-RevId: 300270894
2020-03-11 01:06:19 -07:00
Ghanan Gowripalan f56fe66b13 Honour the link's MaxHeaderLength when forwarding
This change also updates where the IP packet buffer is held in an
outbound tcpip.PacketBuffer from Header to Data. This change removes
unncessary copying of the IP packet buffer when forwarding.

Test: stack_test.TestNICForwarding
PiperOrigin-RevId: 300217972
2020-03-10 17:52:31 -07:00
gVisor bot d6440ec5a1 The packet forwarding should resolve the link address if necessary.
Fixes #1510

Test:
- stack_test.TestForwardingWithStaticResolver
- stack_test.TestForwardingWithFakeResolver
- stack_test.TestForwardingWithNoResolver
- stack_test.TestForwardingWithFakeResolverPartialTimeout
- stack_test.TestForwardingWithFakeResolverTwoPackets
- stack_test.TestForwardingWithFakeResolverManyPackets
- stack_test.TestForwardingWithFakeResolverManyResolutions
PiperOrigin-RevId: 300182570
2020-03-10 14:50:13 -07:00
Ian Lewis 0990ef7517 Make checkpoint/restore e2e test less flaky
PiperOrigin-RevId: 300171916
2020-03-10 13:59:49 -07:00
Ting-Yu Wang b36de6e7be Move /proc/net to /proc/PID/net, and make /proc/net -> /proc/self/net.
Issue #1833

PiperOrigin-RevId: 299998105
2020-03-09 19:59:09 -07:00
Andrei Vagin 2446161b3f perf/signal: rewrite code in assembly to avoid compiler optimizations
Without this change, the assembly code of this test compiled without
optimizations:

mov    -0x150(%rbp),%rax
movl   $0x77777777,(%rax)
lea    -0x128(%rbp),%rax

with optimizations:

movl   $0x77777777,0x0

This code doesn't work properly, because the test changes rax in the segv
handler.

PiperOrigin-RevId: 299896117
2020-03-09 11:53:28 -07:00
Haibo Xu c04958e2fa Enable thread local storage support on arm64.
Linux use the task.thread.uw.tp_value field to store the
TLS pointer on arm64 platform, and we use a similar way
in gvisor to store it in the arch/State struct.

Signed-off-by: Haibo Xu <haibo.xu@arm.com>
Change-Id: Ie76b5c6d109bc27ccfd594008a96753806db7764
2020-03-09 01:04:55 +00:00
gVisor bot ddfc7239be Merge pull request #2055 from google:dependabot/bundler/benchmarks/workloads/ruby/puma-3.12.4
PiperOrigin-RevId: 299485340
2020-03-06 19:08:16 -08:00
dependabot[bot] bc319d29e1
Bump puma from 3.12.2 to 3.12.4 in /benchmarks/workloads/ruby
Bumps [puma](https://github.com/puma/puma) from 3.12.2 to 3.12.4.
- [Release notes](https://github.com/puma/puma/releases)
- [Changelog](https://github.com/puma/puma/blob/master/History.md)
- [Commits](https://github.com/puma/puma/compare/v3.12.2...v3.12.4)

Signed-off-by: dependabot[bot] <support@github.com>
2020-03-07 02:31:42 +00:00
gVisor bot bfbfaf325b Merge pull request #2056 from google:dependabot/bundler/benchmarks/workloads/ruby_template/puma-3.12.4
PiperOrigin-RevId: 299480247
2020-03-06 18:30:33 -08:00
Fabricio Voznika b23999f3e4 Fix runsc permissions for "dev.sh --refresh"
PiperOrigin-RevId: 299466906
2020-03-06 17:01:51 -08:00
Dean Deng 228813fd26 Update comments and debug level for profiling options.
PiperOrigin-RevId: 299448307
2020-03-06 15:23:46 -08:00
Dean Deng 960f6a975b Add plumbing for importing fds in VFS2, along with non-socket, non-TTY impl.
In VFS2, imported file descriptors are stored in a kernfs-based filesystem.
Upon calling ImportFD, the host fd can be accessed in two ways:
1. a FileDescription that can be added to the FDTable, and
2. a Dentry in the host.filesystem mount, which we will want to access through
magic symlinks in /proc/[pid]/fd/.

An implementation of the kernfs.Inode interface stores a unique host fd. This
inode can be inserted into file descriptions as well as dentries.

This change also plumbs in three FileDescriptionImpls corresponding to fds for
sockets, TTYs, and other files (only the latter is implemented here).
These implementations will mostly make corresponding syscalls to the host.
Where possible, the logic is ported over from pkg/sentry/fs/host.

Updates #1672

PiperOrigin-RevId: 299417263
2020-03-06 12:59:49 -08:00
Tamir Duberstein 6fa5cee82c Prevent memory leaks in ilist
When list elements are removed from a list but not discarded, it becomes
important to invalidate the references they hold to their former
neighbors to prevent memory leaks.

PiperOrigin-RevId: 299412421
2020-03-06 12:31:43 -08:00
gVisor bot 18d41cf153 Merge pull request #1963 from xiaobo55x:kvm_common
PiperOrigin-RevId: 299405855
2020-03-06 12:05:30 -08:00
gVisor bot 56c4272568 Merge pull request #1946 from xiaobo55x:dieTramp
PiperOrigin-RevId: 299405663
2020-03-06 12:01:23 -08:00
Eyal Soha d5dbe366bf shutdown(s, SHUT_WR) in TIME-WAIT returns ENOTCONN
From RFC 793 s3.9 p61 Event Processing:

CLOSE Call during TIME-WAIT: return with "error: connection closing"

Fixes #1603

PiperOrigin-RevId: 299401353
2020-03-06 11:42:34 -08:00
Ghanan Gowripalan f50d9a31e9 Specify the source of outgoing NDP RS
If the NIC has a valid IPv6 address assigned, use it as the
source address for outgoing NDP Router Solicitation packets.

Test: stack_test.TestRouterSolicitation
PiperOrigin-RevId: 299398763
2020-03-06 11:33:28 -08:00
Eyal Soha 20170d4fd5 Move packetdrill tests to open-source
PiperOrigin-RevId: 299396286
2020-03-06 11:24:11 -08:00
gVisor bot 006e2223a4 Merge pull request #2069 from andrew-d:andrew/rules_python
PiperOrigin-RevId: 299383276
2020-03-06 10:22:19 -08:00
Nayana Bidari 1e8c0bcedb Add nat table support for iptables. 2020-03-06 09:25:32 -08:00
Ghanan Gowripalan d6f5e71df2 Get strings for stack.DHCPv6ConfigurationFromNDPRA
Useful for logs to print the string representation of the value
instead of the integer value.

PiperOrigin-RevId: 299356847
2020-03-06 08:02:45 -08:00
Ian Lewis da48fc6cca Stub oom_score_adj and oom_score.
Adds an oom_score_adj and oom_score proc file stub. oom_score_adj accepts
writes of values -1000 to 1000 and persists the value with the task. New tasks
inherit the parent's oom_score_adj.

oom_score is a read-only stub that always returns the value '0'.

Issue #202

PiperOrigin-RevId: 299245355
2020-03-05 18:23:01 -08:00
Ting-Yu Wang 9b64b658c1 Fix S/R on inet.Namespace.
PiperOrigin-RevId: 299238067
2020-03-05 17:40:18 -08:00
gVisor bot 6367963c14 Merge pull request #1951 from moricho:moricho/add-profiler-option
PiperOrigin-RevId: 299233818
2020-03-05 17:16:54 -08:00
Ian Gudger 9b3aad33c4 Use a pool of arrays to avoid slice headers from escaping in TCP options pool.
By putting slices into the pool, the slice header escapes. This can be avoided
by not putting the slice header into the pool.

This removes an allocation from the TCP segment send path.

PiperOrigin-RevId: 299215480
2020-03-05 15:56:42 -08:00
Andrei Vagin 6ec669631f tests: Don't print log messages on stdout
A parser of test results doesn't expect to see any extra messages.

PiperOrigin-RevId: 299174138
2020-03-05 13:08:04 -08:00
gVisor bot b1576e5332 Merge pull request #2036 from xiaobo55x:syscall_test
PiperOrigin-RevId: 299151227
2020-03-05 11:34:09 -08:00
Andrew Dunham 2cf974117d WORKSPACE: bump rules_python to include reproducibility fix 2020-03-04 22:54:32 -08:00
Andrei Vagin 80b40bbb06 tests: Don't print log messages on stdout
A parser of test results doesn't expect to see any extra messages.

PiperOrigin-RevId: 298966577
2020-03-04 16:16:35 -08:00
gVisor bot 4f43d5ecad Merge pull request #2054 from avagin:gvisor-test
PiperOrigin-RevId: 298951909
2020-03-04 15:12:26 -08:00
Jamie Liu a690b57624 Ensure that safemem.BlockSeqOf(safemem.Block{}) produces an empty BlockSeq.
PiperOrigin-RevId: 298941855
2020-03-04 14:30:27 -08:00
Andrei Vagin 504c9e14d6 test/runner: use proper filters for test cases
The benchmark_filter options accepts regex-s, but
the gtest-filter option accepts shell-like wildcards.

Fixes #2034

Signed-off-by: Andrei Vagin <avagin@gmail.com>
2020-03-04 12:52:13 -08:00
gVisor bot 20a412ba44 Merge pull request #2031 from google:dependabot/bundler/benchmarks/workloads/ruby/rake-12.3.3
PiperOrigin-RevId: 298894164
2020-03-04 11:15:11 -08:00
Eyal Soha ef1219c145 Use shuf instead of $RANDOM everywhere.
$RANDOM can cause collisions but shuf uses /dev/urandom so it ought to cause
fewer.

PiperOrigin-RevId: 298786344
2020-03-04 00:15:49 -08:00
gVisor bot d949c33143 Merge pull request #2009 from lubinszARM:pr_syscall_getres
PiperOrigin-RevId: 298740246
2020-03-03 18:13:56 -08:00
dependabot[bot] 9b26d2fa0d
Bump puma from 3.12.2 to 3.12.4 in /benchmarks/workloads/ruby_template
Bumps [puma](https://github.com/puma/puma) from 3.12.2 to 3.12.4.
- [Release notes](https://github.com/puma/puma/releases)
- [Changelog](https://github.com/puma/puma/blob/master/History.md)
- [Commits](https://github.com/puma/puma/compare/v3.12.2...v3.12.4)

Signed-off-by: dependabot[bot] <support@github.com>
2020-03-04 01:22:58 +00:00