Commit Graph

3409 Commits

Author SHA1 Message Date
gVisor bot 6260304179 Merge pull request #2788 from lubinszARM:pr_exec_2
PiperOrigin-RevId: 315166991
2020-06-07 09:56:53 -07:00
gVisor bot 427d208216 Merge pull request #2872 from kevinGC:ipt-skip-prerouting
PiperOrigin-RevId: 315041419
2020-06-05 20:44:01 -07:00
Rahat Mahmood 21b6bc7280 Implement mount(2) and umount2(2) for VFS2.
This is mostly syscall plumbing, VFS2 already implements the internals of
mounts. In addition to the syscall defintions, the following mount-related
mechanisms are updated:

- Implement MS_NOATIME for VFS2, but only for tmpfs and goferfs. The other VFS2
  filesystems don't implement node-level timestamps yet.

- Implement the 'mode', 'uid' and 'gid' mount options for VFS2's tmpfs.

- Plumb mount namespace ownership, which is necessary for checking appropriate
  capabilities during mount(2).

Updates #1035

PiperOrigin-RevId: 315035352
2020-06-05 19:12:03 -07:00
Adin Scannell 527d08f6af Add +checkescape annotations to kvm/ring0.
This analysis also catches a potential bug, which is a split on mapPhysical.
This would have led to potential guest-exit during Mapping (although this
would have been handled by the now-unecessary retryInGuest loop).

PiperOrigin-RevId: 315025106
2020-06-05 17:25:28 -07:00
Adin Scannell 8d8dce418f Add stale issue & PR cleanup.
PiperOrigin-RevId: 315020368
2020-06-05 16:51:58 -07:00
Kevin Krakauer 74a7d76c97 iptables: loopback traffic skips prerouting chain
Loopback traffic is not affected by rules in the PREROUTING chain.

This change is also necessary for istio's envoy to talk to other
components in the same pod.
2020-06-05 16:43:50 -07:00
Adin Scannell f385e581a5 Drop flaky tag.
PiperOrigin-RevId: 315018295
2020-06-05 16:39:08 -07:00
Adin Scannell 9aaca5a6da Use top-down allocation for pgalloc.
This change has multiple small components.

First, the chunk size is bumped to 1GB in order to avoid creating excessive
VMAs in the Sentry, which can lead to VMA exhaustion (and hitting limits).

Second, gap-tracking is added to the usage set in order to efficiently scan
for available regions.

Third, reclaim is moved to a simple segment set. This is done to allow the
order of reclaim to align with the Allocate order (which becomes much more
complex when trying to track a "max page" as opposed to "min page", so we
just track explicit segments instead, which should make reclaim scanning
faster anyways).

Finally, the findAvailable function attempts to scan from the top-down, in
order to maximize opportunities for VMA merging in applications (hopefully
preventing the same VMA exhaustion that can affect the Sentry).

PiperOrigin-RevId: 315009249
2020-06-05 15:39:57 -07:00
Andrei Vagin 8c1f5b5cd8 Unshare files on exec
The current task can share its fdtable with a few other tasks,
but after exec, this should be a completely separate process.

PiperOrigin-RevId: 314999565
2020-06-05 14:45:32 -07:00
Nicolas Lacasse e4e11f2798 Expand syscall filters to support MSAN.
PiperOrigin-RevId: 314997564
2020-06-05 14:33:50 -07:00
Rahat Mahmood 6d9a68ca41 Centralize the categories of endpoint states.
PiperOrigin-RevId: 314996457
2020-06-05 14:28:05 -07:00
Bhasker Hariharan 526df4f52a Fix error code returned due to Port exhaustion.
For TCP sockets gVisor incorrectly returns EAGAIN when no ephemeral ports are
available to bind during a connect. Linux returns EADDRNOTAVAIL. This change
fixes gVisor to return the correct code and adds a test for the same.

This change also fixes a minor bug for ping sockets where connect() would fail
with EINVAL unless the socket was bound first.

Also added tests for testing UDP Port exhaustion and Ping socket port
exhaustion.

PiperOrigin-RevId: 314988525
2020-06-05 13:43:01 -07:00
gVisor bot 45bf7492ef Merge pull request #2879 from avagin:test-hostinet
PiperOrigin-RevId: 314970516
2020-06-05 12:05:07 -07:00
Nicolas Lacasse d208bb86ac Merge pull request #2789 from Rajpratik71:optimization/git-clone
PiperOrigin-RevId: 314855924
2020-06-05 11:29:53 -07:00
Ting-Yu Wang 41da7a568b Fix copylocks error about copying IPTables.
IPTables.connections contains a sync.RWMutex. Copying it will trigger copylocks
analysis. Tested by manually enabling nogo tests.

sync.RWMutex is added to IPTables for the additional race condition discovered.

PiperOrigin-RevId: 314817019
2020-06-05 11:29:09 -07:00
Mithun Iyer f766366091 Handle TCP segment split cases as per MSS.
- Always split segments larger than MSS.
  Currently, we base the segment split decision as a function of the
  send congestion window and MSS, which could be greater than the MSS
  advertised by remote.
- While splitting segments, ensure the PSH flag is reset when there
  are segments that are queued to be sent.
- With TCP_CORK, hold up segments up until MSS. Fix a bug in computing
  available send space before attempting to coalesce segments.

Fixes #2832

PiperOrigin-RevId: 314802928
2020-06-05 11:28:24 -07:00
Andrei Vagin d61e88e342 Remove gvisor/pkg/tmutex
It isn't used.

PiperOrigin-RevId: 314775492
2020-06-05 11:27:39 -07:00
Ian Lewis 51c61cb2dc Add back gitter badge.
PiperOrigin-RevId: 314630516
2020-06-05 11:26:50 -07:00
Andrei Vagin 9e66ac4c20 test/syscall: run hostnet tests in separate network namespaces
A few tests use hard coded port numbers, so we need to guruantee that
these ports will not be used for somthing else.
2020-06-04 18:23:45 -07:00
Ting-Yu Wang d3a8bffe04 Pass PacketBuffer as pointer.
Historically we've been passing PacketBuffer by shallow copying through out
the stack. Right now, this is only correct as the caller would not use
PacketBuffer after passing into the next layer in netstack.

With new buffer management effort in gVisor/netstack, PacketBuffer will
own a Buffer (to be added). Internally, both PacketBuffer and Buffer may
have pointers and shallow copying shouldn't be used.

Updates #2404.

PiperOrigin-RevId: 314610879
2020-06-03 15:00:42 -07:00
Zach Koopmans d8d86f0f3a Add test for O_TRUNC
b/36576592 calls out an edge case previously not supported
by HostFS. HostFS is currently being removed, meaning gVisor
supports this feature. Simply add the test to open_test.

PiperOrigin-RevId: 314610226
2020-06-03 14:56:04 -07:00
Nicolas Lacasse 7da69fe971 Fix data race on f.offset.
We must hold f.mu to write f.offset.

PiperOrigin-RevId: 314582968
2020-06-03 12:35:13 -07:00
Michael Pratt b2e2a081a8 Add metric for startup watchdog timeout
PiperOrigin-RevId: 314570894
2020-06-03 11:37:10 -07:00
Adin Scannell fa9c905505 Fix test release commands to work with older GPG.
The --quick-generate-key command wasn't added until recently.

PiperOrigin-RevId: 314570297
2020-06-03 11:32:11 -07:00
Jamie Liu c8e7968389 Take Mount reference in VFS.connectLocked.
Updates #179

PiperOrigin-RevId: 314563830
2020-06-03 11:02:57 -07:00
Mithun Iyer 162848e129 Avoid TCP segment split when out of sender window.
If the entire segment cannot be accommodated in the receiver advertised
window and if there are still unacknowledged pending segments, skip
splitting the segment. The segment transmit would get retried by the
retransmit handler.

PiperOrigin-RevId: 314538523
2020-06-03 08:49:49 -07:00
Andrei Vagin e6334e81ca Check that two sockets with different types can't be connected to each other
PiperOrigin-RevId: 314450191
2020-06-02 19:19:15 -07:00
gVisor bot c615faaee4 Merge pull request #2855 from ridwanmsharif:ridwanmsharif/fuse-doc-edit
PiperOrigin-RevId: 314449030
2020-06-02 19:08:49 -07:00
Michael Pratt 43279c6734 Fix typos
PiperOrigin-RevId: 314415253
2020-06-02 15:29:26 -07:00
gVisor bot b062821d3e Merge pull request #2837 from avagin:make-startup-option
PiperOrigin-RevId: 314415164
2020-06-02 15:24:33 -07:00
Ridwan Sharif 5173c96021 Add some detail to milestone #1
This change adds more information about what needs to be done
to implement `/dev/fuse`
2020-06-02 22:13:21 +00:00
Andrei Vagin 5e4d7072a6 make: Allow to specify bazel startup options.
And don't parse binary paths for the build target.

Signed-off-by: Andrei Vagin <avagin@gmail.com>
2020-06-02 11:30:26 -07:00
Fabricio Voznika 4b5eae39f2 Enable VFS2 to runsc syscall tests
Updates #1487

PiperOrigin-RevId: 314271995
2020-06-01 23:03:20 -07:00
Fabricio Voznika ca5912d13c More runsc changes for VFS2
- Add /tmp handling
- Apply mount options
- Enable more container_test tests
- Forward signals to child process when test respaws process
  to run as root inside namespace.

Updates #1487

PiperOrigin-RevId: 314263281
2020-06-01 21:32:09 -07:00
Dean Deng 050d8e6e33 Add inotify events for extended attributes and splice.
Splice, setxattr and removexattr should generate events. Note that VFS2 already
generates events for extended attributes.

Updates #1479.

PiperOrigin-RevId: 314244261
2020-06-01 18:31:59 -07:00
Jamie Liu 49a9b78f74 Fix VFS2 gofer open(O_CREAT) reference leak.
gofer.filesystem.createAndOpenChildLocked() doesn't need to take a reference on
the new dentry since vfs.FileDescription.Init() will do so.

PiperOrigin-RevId: 314242127
2020-06-01 18:13:01 -07:00
Jamie Liu 3a987160aa Handle gofer blocking opens of host named pipes in VFS2.
Using tee instead of read to detect when a O_RDONLY|O_NONBLOCK pipe FD has a
writer circumvents the problem of what to do with the byte read from the pipe,
avoiding much of the complexity of the fdpipe package.

PiperOrigin-RevId: 314216146
2020-06-01 15:33:30 -07:00
Nicolas Lacasse 6ef5924725 Deflake pty_test_linux.
PiperOrigin-RevId: 314208973
2020-06-01 14:55:42 -07:00
Michael Pratt 12f74bd6f6 Include runtime goroutines in panics
SetTraceback("all") does not include all goroutines in panics (you didn't think
it was that simple, did you?). It includes all _user_ goroutines; those started
by the runtime (such as GC workers) are excluded.

Switch to "system" to additionally include runtime goroutines, which are useful
to track down bugs in the runtime itself.

PiperOrigin-RevId: 314204473
2020-06-01 14:32:19 -07:00
Dean Deng 35a3f462d9 Fix inotify test.
PiperOrigin-RevId: 314192441
2020-06-01 13:35:30 -07:00
Dean Deng 07c3b1dc55 Skip proc/pid/fd socket test for VFS1 only.
PiperOrigin-RevId: 314192359
2020-06-01 13:30:39 -07:00
gVisor bot 288a1ca6f0 Merge pull request #2689 from lubinszARM:pr_prot_none
PiperOrigin-RevId: 314186752
2020-06-01 13:02:14 -07:00
Fabricio Voznika 16100d18cb Make gofer mount readonly when overlay is enabled
No writes are expected to the underlying filesystem when
using --overlay.

PiperOrigin-RevId: 314171457
2020-06-01 11:44:32 -07:00
gVisor bot 474d9b2609 Internal change.
PiperOrigin-RevId: 314157710
2020-06-01 10:41:57 -07:00
Adin Scannell 2c6c4365ea Move to make for tag release workflow.
This will make tag & release workflows idempotent.

PiperOrigin-RevId: 314154888
2020-06-01 10:31:26 -07:00
Bhasker Hariharan 839208f118 Enable TCP Receive buffer moderation in gonet and benchmark.
Fixes #1666

PiperOrigin-RevId: 314148384
2020-06-01 10:29:47 -07:00
Zeling Feng a9b47390c8 Test TCP should queue RECEIVE request in SYN-SENT
PiperOrigin-RevId: 313878910
2020-05-29 17:24:20 -07:00
Nicolas Lacasse 93edb36cbb Refactor the ResolveExecutablePath logic.
PiperOrigin-RevId: 313871804
2020-05-29 16:35:21 -07:00
Michael Pratt 65569cfca0 Update Go version build tags
None of the dependencies have changed in 1.15. It may be possible to simplify
some of the wrappers in rawfile following 1.13, but that can come in a later
change.

PiperOrigin-RevId: 313863264
2020-05-29 15:44:07 -07:00
Kevin Krakauer 790811f757 Fix copied comment mistakes.
PiperOrigin-RevId: 313862843
2020-05-29 15:39:17 -07:00