Commit Graph

2404 Commits

Author SHA1 Message Date
gVisor bot c98e1bc23f Merge pull request #1459 from lubinszARM:pr_save_util
PiperOrigin-RevId: 290273702
2020-01-17 09:08:47 -08:00
gVisor bot 989b611f5a Merge pull request #1541 from nybidari:iptables
PiperOrigin-RevId: 290273561
2020-01-17 08:38:25 -08:00
Dean Deng 345df7cab4 Add explanation for implementation of BSD full file locks.
PiperOrigin-RevId: 290272560
2020-01-17 08:11:52 -08:00
Haibo Xu 82ae857877 Enable build of test/syscall tests on arm64.
Signed-off-by: Haibo Xu <haibo.xu@arm.com>
Change-Id: I277d6c708bbf5c3edd7c3568941cfd01dc122e17
2020-01-17 07:39:57 +00:00
Adin Scannell 19b4653147 Remove unused rpcinet.
PiperOrigin-RevId: 290198756
2020-01-16 20:21:09 -08:00
Dean Deng 7a45ae7e67 Implement setxattr for overlays.
PiperOrigin-RevId: 290186303
2020-01-16 18:15:02 -08:00
Dean Deng 1e7f0c822b Bump p9 version, adding corresponding checks to client_file.go.
PiperOrigin-RevId: 290145451
2020-01-16 15:39:19 -08:00
Fabricio Voznika ab48112e41 Add IfChange/ThenChange reminders in fs/proc
There is a lot of code duplication for VFSv2 and this
serves as remind to keep the copies in sync.

Updates #1195

PiperOrigin-RevId: 290139234
2020-01-16 15:05:40 -08:00
Nicolas Lacasse 70d7c52bd7 Implement tmpfs.SetStat with a size argument.
This is similar to 'Truncate' in vfs1.

Updates https://github.com/google/gvisor/issues/1197

PiperOrigin-RevId: 290139140
2020-01-16 14:39:55 -08:00
Fabricio Voznika 3dd3275da7 Add more files to /proc/[pid]/*
Files not implemented require VFSv2 plumbing into the kernel.
Also, cgroup is not implemented yet.

Updates #1195

PiperOrigin-RevId: 290129176
2020-01-16 14:10:05 -08:00
Zach Koopmans 94be30a18d Add run-gcp command.
Add command to run benchmarks on GCP backed machines
using the gcloud producer.

Run with:
`bazel run :benchmarks -- run-gcp [BENCHMARK_NAME]`

Tested with the startup benchmark.

PiperOrigin-RevId: 290126444
2020-01-16 13:42:08 -08:00
Dean Deng c50efc8c70 Disable xattr tests.
These can remain disabled until we actually support extended attributes.

The following modifications were also made:
1. Disable save/restore on tests that change file permissions. Restore will not
work properly for these tests, since it will try to open the file with
read-write after it has been read- or write-only.
2. Change user.abc to user.test.

PiperOrigin-RevId: 290123941
2020-01-16 13:11:47 -08:00
Dean Deng 07f2584979 Plumb getting/setting xattrs through InodeOperations and 9p gofer interfaces.
There was a very bare get/setxattr in the InodeOperations interface. Add
context.Context to both, size to getxattr, and flags to setxattr.
Note that extended attributes are passed around as strings in this
implementation, so size is automatically encoded into the value. Size is
added in getxattr so that implementations can return ERANGE if a value is larger
than can fit in the user-allocated buffer. This prevents us from unnecessarily
passing around an arbitrarily large xattr when the user buffer is actually too
small.

Don't use the existing xattrwalk and xattrcreate messages and define our
own, mainly for the sake of simplicity.

Extended attributes will be implemented in future commits.

PiperOrigin-RevId: 290121300
2020-01-16 12:56:33 -08:00
Fabricio Voznika 7b7c31820b Add remaining /proc/* and /proc/sys/* files
Except for one under /proc/sys/net/ipv4/tcp_sack.
/proc/pid/* is still incomplete.

Updates #1195

PiperOrigin-RevId: 290120438
2020-01-16 12:30:21 -08:00
gVisor bot fea1ce655d Merge pull request #1272 from lubinszARM:pr_ring0_2
PiperOrigin-RevId: 290113719
2020-01-16 11:56:09 -08:00
Haibo Xu 420d335fc9 Enable clone syscall support on arm64.
sys_clone has many flavors in Linux, and amd64 chose
a different one from x86(different arguments order).
Ref kernel/fork.c for more info.

Signed-off-by: Haibo Xu <haibo.xu@arm.com>
Change-Id: I6c8cbc685f4a6e786b171715ab68292fc95cbf48
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/gvisor/pull/1545 from xiaobo55x:clone 156bd2dfbc63ef5291627b0578ddea77997393b2
PiperOrigin-RevId: 290093953
2020-01-16 10:28:11 -08:00
Ghanan Gowripalan a7a1f00425 Support upgrading expired/removed IPv6 addresses to permanent SLAAC addresses
If a previously added IPv6 address (statically or via SLAAC) was removed, it
would be left in an expired state waiting to be cleaned up if any references to
it were still held. During this time, the same address could be regenerated via
SLAAC, which should be allowed. This change supports this scenario.

When upgrading an endpoint from temporary or permanentExpired to permanent,
respect the new configuration type (static or SLAAC) and deprecated status,
along with the new PrimaryEndpointBehavior (which was already supported).

Test: stack.TestAutoGenAddrAfterRemoval
PiperOrigin-RevId: 289990168
2020-01-15 20:23:06 -08:00
Ghanan Gowripalan 815df2959a Solicit IPv6 routers when a NIC becomes enabled as a host
This change adds support to send NDP Router Solicitation messages when a NIC
becomes enabled as a host, as per RFC 4861 section 6.3.7.

Note, Router Solicitations will only be sent when the stack has forwarding
disabled.

Tests: Unittests to make sure that the initial Router Solicitations are sent
as configured. The tests also validate the sent Router Solicitations' fields.
PiperOrigin-RevId: 289964095
2020-01-15 17:10:48 -08:00
Nicolas Lacasse d6fb1ec6c7 Add timestamps to VFS2 tmpfs, and implement some of SetStat.
PiperOrigin-RevId: 289962040
2020-01-15 16:32:55 -08:00
Zach Koopmans 7b7ce29af3 Update commandline and get local runs working.
PiperOrigin-RevId: 289937063
2020-01-15 14:26:15 -08:00
gVisor bot 2ebd21478e Merge pull request #1540 from laijs:fix-PCIDs
PiperOrigin-RevId: 289925133
2020-01-15 13:48:51 -08:00
Bhasker Hariharan 275ac8ce1d Bugfix to terminate the protocol loop on StateError.
The change to introduce worker goroutines can cause the endpoint
to transition to StateError and we should terminate the loop rather
than let the endpoint transition to a CLOSED state as we do
in case the endpoint enters TIME-WAIT/CLOSED. Moving to a closed
state would cause the actual error to not be propagated to
any read() calls etc.

PiperOrigin-RevId: 289923568
2020-01-15 13:21:50 -08:00
Bhasker Hariharan f874723e64 Bump SO_SNDBUF for fdbased endpoint used by runsc.
Updates #231

PiperOrigin-RevId: 289897881
2020-01-15 11:19:06 -08:00
lubinszARM ff78a72170 enable pkg/sentry/arch to support arm64 basically
Signed-off-by: Bin Lu <bin.lu@arm.com>
Change-Id: I9cce23db4e5caec82ce42b4970fdb7f7e8c08f1d
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/gvisor/pull/773 from lubinszARM:pr_arch_basic 3fe2fd8e6286766bbe489ef971dce204f924feba
PiperOrigin-RevId: 289795569
2020-01-14 22:24:28 -08:00
chris.zn 376a777c55 Fix "unlock of unlocked mutex" crash when getting tty
This patch holds taskset.mu when getting tty. If we don't
do this, it may cause a "unlock of unlocked mutex" problem,
since signalHandlers may be replaced by CopyForExec() in
runSyscallAfterExecStop after the signalHandlers.mu has
been holded in TTY().

The problem is easy to reproduce with keeping to do "runsc ps".

The crash log is :

fatal error: sync: unlock of unlocked mutex

goroutine 5801304 [running]:
runtime.throw(0xfd019c, 0x1e)
        GOROOT/src/runtime/panic.go:774 +0x72 fp=0xc001ba47b0 sp=0xc001ba4780 pc=0x431702
sync.throw(0xfd019c, 0x1e)
        GOROOT/src/runtime/panic.go:760 +0x35 fp=0xc001ba47d0 sp=0xc001ba47b0 pc=0x431685
sync.(*Mutex).unlockSlow(0xc00cf94a30, 0xc0ffffffff)
        GOROOT/src/sync/mutex.go:196 +0xd6 fp=0xc001ba47f8 sp=0xc001ba47d0 pc=0x4707d6
sync.(*Mutex).Unlock(0xc00cf94a30)
        GOROOT/src/sync/mutex.go:190 +0x48 fp=0xc001ba4818 sp=0xc001ba47f8 pc=0x4706e8
gvisor.dev/gvisor/pkg/sentry/kernel.(*ThreadGroup).TTY(0xc011a9e800, 0x0)
        pkg/sentry/kernel/tty.go:38 +0x88 fp=0xc001ba4868 sp=0xc001ba4818 pc=0x835fa8
gvisor.dev/gvisor/pkg/sentry/control.Processes(0xc00025ae00, 0xc013e397c0, 0x40, 0xc0137b9800, 0x1, 0x7f292e9a4cc0)
        pkg/sentry/control/proc.go:366 +0x355 fp=0xc001ba49a0 sp=0xc001ba4868 pc=0x9ac4a5
gvisor.dev/gvisor/runsc/boot.(*containerManager).Processes(0xc0003b62c0, 0xc0051423d0, 0xc0137b9800, 0x0, 0x0)
        runsc/boot/controller.go:228 +0xdf fp=0xc001ba49e8 sp=0xc001ba49a0 pc=0xaf06cf

Signed-off-by: chris.zn <chris.zn@antfin.com>
2020-01-15 13:00:59 +08:00
Kevin Krakauer 95e9de31d2 Address Nic's comments. 2020-01-14 17:54:02 -08:00
Bhasker Hariharan a611fdaee3 Changes TCP packet dispatch to use a pool of goroutines.
All inbound segments for connections in ESTABLISHED state are delivered to the
endpoint's queue but for every segment delivered we also queue the endpoint for
processing to a selected processor. This ensures that when there are a large
number of connections in ESTABLISHED state the inbound packets are all handled
by a small number of goroutines and significantly reduces the amount of work the
goscheduler has to perform.

We let connections in other states follow the current path where the
endpoint's goroutine directly handles the segments.

Updates #231

PiperOrigin-RevId: 289728325
2020-01-14 14:15:50 -08:00
Tamir Duberstein 50625cee59 Implement {g,s}etsockopt(IP_RECVTOS) for UDP sockets
PiperOrigin-RevId: 289718534
2020-01-14 13:33:23 -08:00
Ghanan Gowripalan 1ad8381eac Do Source Address Selection when choosing an IPv6 source address
Do Source Address Selection when choosing an IPv6 source address as per RFC 6724
section 5 rules 1-3:
1) Prefer same address
2) Prefer appropriate scope
3) Avoid deprecated addresses.

A later change will update Source Address Selection to follow rules 4-8.

Tests:
Rule 1 & 2: stack.TestIPv6SourceAddressSelectionScopeAndSameAddress,
Rule 3:     stack.TestAutoGenAddrTimerDeprecation,
            stack.TestAutoGenAddrDeprecateFromPI
PiperOrigin-RevId: 289559373
2020-01-13 17:58:28 -08:00
Kevin Krakauer bd29289409 Protocol filtering works. 2020-01-13 16:10:00 -08:00
Kevin Krakauer d51eaa59c0 Merge branch 'iptables-write-input-drop' into iptables-write-filter-proto 2020-01-13 16:06:29 -08:00
Kevin Krakauer 1c3d3c70b9 Fix test building. 2020-01-13 14:54:32 -08:00
Tamir Duberstein debd213da6 Allow dual stack sockets to operate on AF_INET
Fixes #1490
Fixes #1495

PiperOrigin-RevId: 289523250
2020-01-13 14:47:22 -08:00
Kevin Krakauer 36641a2195 Only allow INPUT modifications. 2020-01-13 14:14:49 -08:00
Andrei Vagin fff0476951 benchmarks/tcp: set a number of channels to GOMAXPROCS
Updates #231

PiperOrigin-RevId: 289502669
2020-01-13 13:10:38 -08:00
Kevin Krakauer 31e49f4b19 Merge branch 'master' into iptables-write-input-drop 2020-01-13 12:22:15 -08:00
gVisor bot b30cfb1df7 Merge pull request #1528 from kevinGC:iptables-write
PiperOrigin-RevId: 289479774
2020-01-13 11:26:26 -08:00
Andrei Vagin f54b9c0ee6 tests: fix errors detected by asan.
PiperOrigin-RevId: 289467083
2020-01-13 10:16:07 -08:00
Nayana Bidari 98327a94cc Add test for iptables TCP rule
Added tests for tcp protocol with input and output rules including options sport and dport
Increased timeout in iptables_test as TCP tests were timing out with existing value.
2020-01-13 09:11:40 -08:00
Kevin Krakauer d793677cd4 I think INPUT works with protocol 2020-01-10 18:07:15 -08:00
Brad Burlage bf6429b944 Don't set RWF_HIPRI on InvalidOffset test.
This test fails on ubuntu 18.04 because preadv2 for some reason returns
EOPNOTSUPP instead of EINVAL. Instead of root-causing the failure, I'm dropping
the flag in the preadv2 call since it isn't under test in this scenario.

PiperOrigin-RevId: 289188358
2020-01-10 16:36:34 -08:00
Ghanan Gowripalan d27208463e Automated rollback of changelist 288990597
PiperOrigin-RevId: 289169518
2020-01-10 14:58:47 -08:00
Ghanan Gowripalan bcedf6a8e4 Put CancellableTimer tests in the tcpip_test package
CancellableTimer tests were in a timer_test package but lived within the
tcpip directory. This caused issues with go tools.

PiperOrigin-RevId: 289166345
2020-01-10 14:32:17 -08:00
Kevin Krakauer d147e6d1b2 Cleaned up logs. 2020-01-10 13:58:46 -08:00
Ian Gudger 6b83111499 goid: new package
Allows retrieving the goroutine ID for concurrency testing when the race
detector is enabled.

Updates #1472

PiperOrigin-RevId: 289155308
2020-01-10 13:34:48 -08:00
Nayana Bidari 9aeb053bba Add tests for redirect port
Fix indentation and change function names.
2020-01-10 09:05:25 -08:00
Bhasker Hariharan dacd349d6f panic fix in retransmitTimerExpired.
This is a band-aid fix for now to prevent panics.

PiperOrigin-RevId: 289078453
2020-01-10 06:03:02 -08:00
Bin Lu ebd25099bf enable //test/syscalls:proc_test support on Arm64
Problems with different platform architectures have been solved.

Signed-off-by: Bin Lu <bin.lu@arm.com>
2020-01-10 16:45:48 +08:00
Ian Gudger 27500d529f New sync package.
* Rename syncutil to sync.
* Add aliases to sync types.
* Replace existing usage of standard library sync package.

This will make it easier to swap out synchronization primitives. For example,
this will allow us to use primitives from github.com/sasha-s/go-deadlock to
check for lock ordering violations.

Updates #1472

PiperOrigin-RevId: 289033387
2020-01-09 22:02:24 -08:00
gVisor bot b08da42285 Merge pull request #1523 from majek:fix-1522-silly-window-rx
PiperOrigin-RevId: 289019953
2020-01-09 19:35:27 -08:00