Commit Graph

5813 Commits

Author SHA1 Message Date
Andrei Vagin 47f025461e runsc: Wait child processes without timeouts
* First, we don't need to poll child processes.
* Second, the 5 seconds timeout is too small if a host is overloaded.
* Third, this can hide bugs in the code when we wait a process that
  isn't going to exit.

PiperOrigin-RevId: 386337586
2021-07-22 15:40:40 -07:00
gVisor bot 8daeda2072 Merge pull request #6108 from sudo-sturbia:msgqueue/syscalls
PiperOrigin-RevId: 386323389
2021-07-22 14:33:18 -07:00
Kevin Krakauer 70626b3da2 buildkite: move golang installation to VM boot
Rather than re-downloading and installing Go for each pipeline run, we should
just do it at boot.

PiperOrigin-RevId: 386320005
2021-07-22 14:17:52 -07:00
Jamie Liu d5fb4623ea Replace kernel package types for clone and unshare with linux package types.
PiperOrigin-RevId: 386312456
2021-07-22 13:41:46 -07:00
Zyad A. Ali cbc0b4e126 Delete unnecessary function.
Since cgroupfs.dir embedes cgroupfs.implStatFS, and dir.StatFS and
implStatFS.StatFS are identical, dir.StatFS is not needed.
2021-07-22 21:20:12 +02:00
Nayana Bidari f1f746dddc Add metric to count number of segments acknowledged by DSACK.
- Creates new metric "/tcp/segments_acked_with_dsack" to count the number of
segments acked with DSACK.
- Added check to verify the metric is getting incremented when a DSACK is sent
in the unit tests.

PiperOrigin-RevId: 386135949
2021-07-21 18:06:31 -07:00
Kevin Krakauer bc0ab8ea0f buildkite: update Go
#6322 tried to update Go to 1.16, but existing nodes fail to upgrade due to the
presence of old Go [1]. Specifically when trying to add Go to `/usr/bin`:

```
ln: failed to create symbolic link '/usr/bin/go': File exists
```

Also:
- Removing `golang-go` also removes apt installs of `gcc` and `pkg-config`, so
  those are installed explicitly.
- Add `-c` to wget, which will prevent re-downloading Go for each run.
- Disable GO111MODULE when building cri-tools and containerd, since we're using
  pre-module versions of each.

1 - https://buildkite.com/gvisor/pipeline/builds/7285#3593244c-e411-472d-804a-9c7fbbd24762

PiperOrigin-RevId: 386106881
2021-07-21 15:20:19 -07:00
Ian Lewis c259978dbd Fix required Linux version in networking docs.
PiperOrigin-RevId: 386093826
2021-07-21 14:19:59 -07:00
Jamie Liu a89b2f005b Use atomics when checking for parent setgid in VFS2 tmpfs file creation.
Reported-by: syzbot+59550b48e06cc0d3b638@syzkaller.appspotmail.com
PiperOrigin-RevId: 386075453
2021-07-21 12:54:34 -07:00
Nayana Bidari a4d743db59 Enable RACK by default in netstack.
PiperOrigin-RevId: 385944428
2021-07-20 23:15:05 -07:00
Ghanan Gowripalan 9e805ce937 Expose local address from raw sockets
PiperOrigin-RevId: 385940836
2021-07-20 22:50:16 -07:00
Fabricio Voznika 0184f1a662 Add fsstress test to goferfs
PiperOrigin-RevId: 385937353
2021-07-20 22:21:24 -07:00
Fabricio Voznika 990cd1a950 Don't kill container when volume is unmounted
The gofer session is killed when a gofer backed volume is unmounted. The
gofer monitor catches the disconnect and kills the container. This changes
the gofer monitor to only care about the rootfs connections, which cannot
be unmounted.

Fixes #6259

PiperOrigin-RevId: 385929039
2021-07-20 20:57:09 -07:00
gVisor bot 49d9ef4987 Merge pull request #6220 from laijs:disconnect-fp
PiperOrigin-RevId: 385919423
2021-07-20 19:16:17 -07:00
Jamie Liu 1ad3822200 Add go:build directives as required by Go 1.17's gofmt.
PiperOrigin-RevId: 385894869
2021-07-20 16:28:45 -07:00
Andrei Vagin 7ced03b383 ring0: Initialize sentryXCR0 from Kernel.init()
Fixes #6300

PiperOrigin-RevId: 385840917
2021-07-20 12:07:23 -07:00
Kevin Krakauer 5ad30cac2e Automated rollback of changelist 385029528
PiperOrigin-RevId: 385200993
2021-07-16 12:33:24 -07:00
Fabricio Voznika 628d7d3a46 Fix refcount increments in gofer.filesystem.Sync.
fs.renameMu is released and reacquired in `dentry.destroyLocked()` allowing
a dentry to be in `fs.syncableDentries` with a negative reference count.

Fixes #5263

PiperOrigin-RevId: 385054337
2021-07-15 18:53:17 -07:00
Etienne Perot b6baa377d8 Update gVisor release signing key to a version that does not expire.
PiperOrigin-RevId: 385051420
2021-07-15 18:28:33 -07:00
Kevin Krakauer 6415efa514 buildkite: bump Go version to 1.16
We're currently on 1.13, which can cause build issues with code targeting later
versions.

PiperOrigin-RevId: 385029528
2021-07-15 16:09:04 -07:00
Kevin Krakauer cd45d7b6c8 netstack: support SO_RCVBUFFORCE
TCP is fully supported. As with SO_RCVBUF, other transport protocols perform
no-ops per DefaultSocketOptionsHandler.OnSetReceiveBufferSize.

PiperOrigin-RevId: 385023239
2021-07-15 15:34:34 -07:00
gVisor bot 67d9050752 Merge pull request #6320 from kevinGC:issues-template
PiperOrigin-RevId: 385019550
2021-07-15 15:15:07 -07:00
Chong Cai 5c20fd3bbd Add verity symlink tests
PiperOrigin-RevId: 384823097
2021-07-14 17:47:02 -07:00
Fabricio Voznika d02be7858a Replace whitelist with allowlist from docs
PiperOrigin-RevId: 384796852
2021-07-14 15:23:12 -07:00
Tamir Duberstein e963657e7c Set tcp endpoint state atomically
PiperOrigin-RevId: 384776517
2021-07-14 13:57:15 -07:00
Kevin Krakauer a1044cb881 testing: shrink exhaustion test size to avoid timeouts
Tested via:
```
bazel test \
  //test/syscalls:socket_ipv4_udp_unbound_loopback_nogotsan_test_runsc_ptrace
  --runs_per_test=2000
```

PiperOrigin-RevId: 384773477
2021-07-14 13:43:04 -07:00
Kevin Krakauer e55fb66ecd use github issue templates 2021-07-14 13:10:55 -07:00
Fabricio Voznika 85a0a353ad Replace whitelist with allowlist
PiperOrigin-RevId: 384586164
2021-07-13 17:20:41 -07:00
Chong Cai d4dce953b7 Do not require O_PATH flag to enable verity
Remove the hack in gVisor vfs that allows verity to bypass the O_PATH
check, since ioctl is not allowed on fds opened with O_PATH in linux.

Verity still opens the lowerFD with O_PATH to open it as a symlink, but
the API no longer expects O_PATH to open a fd to be verity enabled.

Now only O_FOLLOW should be specified when opening and enabling verity
features.

PiperOrigin-RevId: 384567833
2021-07-13 15:44:54 -07:00
Zyad A. Ali 4a874557f5 Implement stubs for msgget(2) and msgctl(IPC_RMID).
Add support for msgget, and msgctl(IPC_RMID), and enable msgqueue
syscall tests.

Updates #135
2021-07-13 22:12:02 +02:00
Zyad A. Ali 084aa4fa51 Implement Registry.Remove.
Remove implements the behaviour or msgctl(IPC_RMID).

Updates #135
2021-07-13 22:12:02 +02:00
Zyad A. Ali 7eae6402c1 Implement Registry.FindOrCreate.
FindOrCreate implements the behaviour of msgget(2).

Updates #135
2021-07-13 22:12:02 +02:00
Zyad A. Ali 7c488fcfe8 Create package msgqueue.
Create package msgqueue, define primitives to be used for message
queues, and add a msgqueue.Registry to IPCNamespace.

Updates #135
2021-07-13 22:12:02 +02:00
Zyad A. Ali c8851be593 Add initial test cases for msgget(2).
Updates #135
2021-07-13 22:12:02 +02:00
Zyad A. Ali 44c8766d2e Add abi definitions for sysv message queues.
Updates #135
2021-07-13 22:12:02 +02:00
Zyad A. Ali 35a1ff8d39 Create ipc.Registry.
Create ipc.Registry to hold fields, and define functionality common to
all SysV registries, and have registries use it.
2021-07-13 22:12:02 +02:00
Zyad A. Ali 7a73169229 Create ipc package and ipc.Object.
Create ipc.Object to define fields and functionality used in SysV
mechanisms, and have them use it.
2021-07-13 22:09:41 +02:00
Fabricio Voznika c16e69a9d5 Use consistent naming for subcontainers
It was confusing to find functions relating to root and non-root
containers. Replace "non-root" and "subcontainer" and make naming
consistent in Sandbox and controller.

PiperOrigin-RevId: 384512518
2021-07-13 11:36:13 -07:00
Kevin Krakauer 1fe6db8c54 netstack: atomically update buffer sizes
Previously, two calls to set the send or receive buffer size could have raced
and left state wherein:
- The actual size depended on one call
- The value returned by getsockopt() depended on the other

PiperOrigin-RevId: 384508720
2021-07-13 11:20:54 -07:00
Ghanan Gowripalan b4caeaf78f Deflake TestRouterSolicitation
Before this change, transmission of the first router solicitation races
with the adding of an IPv6 link-local address. This change creates the
NIC in the disabled state and is only enabled after the address is added
(if required) to avoid this race.

PiperOrigin-RevId: 384493553
2021-07-13 10:22:05 -07:00
Howard Zhang c8d252466f apply bitmap for fd_table
Apply bitmap in fd_table to record open file fd. It can
accelerate the speed of allocating or removing fd from
fdtable.

Signed-off-by: Howard Zhang <howard.zhang@arm.com>
2021-07-13 14:16:07 +08:00
Howard Zhang 79b7fb3348 add bitmap
provides the implementation of bitmap.

Signed-off-by: Howard Zhang <howard.zhang@arm.com>
2021-07-13 14:16:07 +08:00
Kevin Krakauer e35d20f79c netstack: move SO_SNDBUF/RCVBUF clamping logic out of //pkg/tcpip
- Keeps Linux-specific behavior out of //pkg/tcpip
- Makes it clearer that clamping is done only for setsockopt calls from users
- Removes code duplication

PiperOrigin-RevId: 384389809
2021-07-12 22:37:11 -07:00
Fabricio Voznika 520795aaad Fix deadlock in procfs
Kernfs provides an internal mechanism to defer calls to `DecRef()` because
on the last reference `Filesystem.mu` must be held and most places that
need to call `DecRef()` are inside the lock. The same can be true for
filesystems that extend kernfs. procfs needs to look up files and `DecRef()`
them inside the `kernfs.Filesystem.mu`. If the files happen to be procfs
files, it can deadlock trying to decrement if it's the last reference.
This change extends the mechanism to external callers to defer DecRefs
to `vfs.FileDescription` and `vfs.VirtualDentries`.

PiperOrigin-RevId: 384361647
2021-07-12 18:30:46 -07:00
Adin Scannell 275932bf08 Drop dedicated benchmark lifecycle.
Instead, roll the output scraping into the main runner. Pass a perf flag to
the runner in order to control leak checking, apply tags via the macro and
appropriately disable logging. This may be removed in the future.

PiperOrigin-RevId: 384348035
2021-07-12 17:00:51 -07:00
Fabricio Voznika f51e0486d4 Fix stdios ownership
Set stdio ownership based on the container's user to ensure the
user can open/read/write to/from stdios.

1. stdios in the host are changed to have the owner be the same
uid/gid of the process running the sandbox. This ensures that the
sandbox has full control over it.
2. stdios owner owner inside the sandbox is changed to match the
container's user to give access inside the container and make it
behave the same as runc.

Fixes #6180

PiperOrigin-RevId: 384347009
2021-07-12 16:55:40 -07:00
Fabricio Voznika 7132b9a07b Fix GoLand analyzer errors under runsc/...
PiperOrigin-RevId: 384344990
2021-07-12 16:45:33 -07:00
Zach Koopmans e3fdd15932 [syserror] Update syserror to linuxerr for more errors.
Update the following from syserror to the linuxerr equivalent:
EEXIST
EFAULT
ENOTDIR
ENOTTY
EOPNOTSUPP
ERANGE
ESRCH

PiperOrigin-RevId: 384329869
2021-07-12 15:26:20 -07:00
Andrei Vagin ebe99977a4 Mark all functions that are called from a forked child with go:norace
PiperOrigin-RevId: 384305599
2021-07-12 13:34:03 -07:00
Jamie Liu 9c09db654e Fix async-signal-unsafety in chroot test.
PiperOrigin-RevId: 384295543
2021-07-12 12:49:48 -07:00