Commit Graph

4569 Commits

Author SHA1 Message Date
Jamie Liu a00c5df98b Deflake semaphore_test.
- Disable saving in tests that wait for EINTR.

- Do not execute async-signal-unsafe code after fork() (see fork(2)'s manpage,
  "After a fork in a multithreaded program ...")

- Check for errors returned by semctl(GETZCNT).

PiperOrigin-RevId: 340901353
2020-11-05 12:07:12 -08:00
Dean Deng 771e9ce8e1 Unlock tcp endpoint mutex before blocking forever.
This was occasionally causing tests to get stuck due to races with the save
process, during which the same mutex is acquired.

PiperOrigin-RevId: 340789616
2020-11-04 22:46:51 -08:00
Zeling Feng e29972ec04 Make the regex for inet6Line in packetimpact/netdevs more accurate
PiperOrigin-RevId: 340763455
2020-11-04 18:19:44 -08:00
Chong Cai a15562c019 Include file size in Merkle hash
The file size can now also be verified. Also, since we are zero-padding
the last block of the data, we cannot differentiate the cases between
zero-padded block from the blocks that are ends with zeroes. With the
size included this can be addressed, as those cases would have different
file size.

PiperOrigin-RevId: 340695510
2020-11-04 11:41:38 -08:00
Ian Lewis 3b18bdbd3c Update WORKSPACE to use Go 1.15.2
Updates #2785

PiperOrigin-RevId: 340566576
2020-11-03 19:00:16 -08:00
Ting-Yu Wang 1cfa8d58f6 Fix more nogo tests
PiperOrigin-RevId: 340536306
2020-11-03 15:23:32 -08:00
Dean Deng 580bbb7497 [vfs2] Do not drop inotify waiters across S/R.
The waits-for relationship between an epoll instance and an inotify fd should
be restored.

This fixes flaky inotify vfs2 tests.

PiperOrigin-RevId: 340531367
2020-11-03 14:56:35 -08:00
Nicolas Lacasse 723464ec55 Make pipe min/max sizes match linux.
The default pipe size already matched linux, and is unchanged.

Furthermore `atomicIOBytes` is made a proper constant (as it is in Linux). We
were plumbing usermem.PageSize everywhere, so this is no functional change.

PiperOrigin-RevId: 340497006
2020-11-03 12:12:06 -08:00
gVisor bot 861c11bfa7 Merge pull request #3617 from laijs:upperhalf
PiperOrigin-RevId: 340484823
2020-11-03 11:19:04 -08:00
Dean Deng 66d24bb692 Release mutex before blocking during TCP handshake route resolution.
Without releasing the mutex, operations on the endpoint following a
nonblocking connect will not make progress until connect is complete.

PiperOrigin-RevId: 340467654
2020-11-03 10:03:30 -08:00
lubinszARM 0e96f8065e arm64 kvm: inject sError to trigger sigbus
Use an sErr injection to trigger sigbus when we receive EFAULT from the
run ioctl.

After applying this patch, mmap_test_runsc_kvm will be passed on
Arm64.

Signed-off-by: Bin Lu <bin.lu@arm.com>
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/gvisor/pull/4542 from lubinszARM:pr_kvm_mmap_1 f81bd42466d1d60a581e5fb34de18b78878c68c1
PiperOrigin-RevId: 340461239
2020-11-03 09:34:39 -08:00
Jing Chen 1a3f417f4a Implement command GETZCNT for semctl.
PiperOrigin-RevId: 340389884
2020-11-02 23:58:45 -08:00
Dean Deng 1321f837bd [vfs2] Refactor kernfs checkCreateLocked.
Don't return the filename, since it can already be determined by the caller.
This was causing a panic in RenameAt, which relied on the name to be nonempty
even if the error was EEXIST.

Reported-by: syzbot+e9f117d000301e42361f@syzkaller.appspotmail.com
PiperOrigin-RevId: 340381946
2020-11-02 22:32:22 -08:00
Sam Balana c22067d3d4 Send NUD probes in a separate gorountine
Send NUD probes in another gorountine to free the thread of execution for
finishing the state transition. This is necessary to avoid deadlock where
sending and processing probes are done in the same call stack, such as loopback
and integration tests.

Fixes #4701

PiperOrigin-RevId: 340362481
2020-11-02 19:20:47 -08:00
Dean Deng 51b062f6cd Skip log.Sprintfs when leak check logging is not enabled.
PiperOrigin-RevId: 340361998
2020-11-02 19:15:41 -08:00
Andrei Vagin 9efaf67518 Clean up the code of setupTimeWaitClose
The active_closefd has to be shutdown only for write,
otherwise the second poll will always return immediately.

The second poll should not be called from a separate thread.

PiperOrigin-RevId: 340319071
2020-11-02 14:42:03 -08:00
Chong Cai ed4f857343 Pass hashing algorithms in verity fs opts
PiperOrigin-RevId: 340275942
2020-11-02 11:17:29 -08:00
Dean Deng 2eb3ee586b Automated rollback of changelist 339945377
PiperOrigin-RevId: 340274194
2020-11-02 11:09:43 -08:00
Andrei Vagin 73f980e97e Block external network for tests
And in this case, tests will run in separate network namespaces
and will not affect each other.

PiperOrigin-RevId: 340267734
2020-11-02 10:41:52 -08:00
Lai Jiangshan 3425485b7c kvm: share upper halves among all pagtables
Fixes: #509

Signed-off-by: Lai Jiangshan <jiangshan.ljs@antfin.com>
Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com>
2020-11-03 00:10:32 +08:00
Ian Lewis 5e606844df Fix returned error when deleting non-existant address
PiperOrigin-RevId: 340149214
2020-11-01 18:03:43 -08:00
Andrei Vagin df88f223bb net/tcpip: connect to unset loopback address has to return EADDRNOTAVAIL
In the docker container, the ipv6 loopback address is not set,
and connect("::1") has to return ENEADDRNOTAVAIL in this case.

Without this fix, it returns EHOSTUNREACH.

PiperOrigin-RevId: 340002915
2020-10-31 01:19:40 -07:00
Dean Deng 4eb1c87e80 Adjust error handling in kernfs rename.
Read-only directories (e.g. under /sys, /proc) should return EPERM for rename.

PiperOrigin-RevId: 339979022
2020-10-30 19:39:28 -07:00
Dean Deng 1f25697cfe Fix rename error handling for VFS2 kernfs.
The non-errno error was causing panics before.

PiperOrigin-RevId: 339969348
2020-10-30 17:42:57 -07:00
Dean Deng ba05c6845d Automated rollback of changelist 339750876
PiperOrigin-RevId: 339945377
2020-10-30 14:58:43 -07:00
Jamie Liu 9ad864628d Separate kernel.Task.AsCopyContext() into CopyContext() and OwnCopyContext().
kernel.copyContext{t} cannot be used outside of t's task goroutine, for three
reasons:

- t.CopyScratchBuffer() is task-goroutine-local.

- Calling t.MemoryManager() without running on t's task goroutine or locking
  t.mu violates t.MemoryManager()'s preconditions.

- kernel.copyContext passes t as context.Context to MM IO methods, which is
  illegal outside of t's task goroutine (cf. kernel.Task.Value()).

Fix this by splitting AsCopyContext() into CopyContext() (which takes an
explicit context.Context and is usable outside of the task goroutine) and
OwnCopyContext() (which uses t as context.Context, but is only usable by t's
task goroutine).

PiperOrigin-RevId: 339933809
2020-10-30 13:54:47 -07:00
gVisor bot c94bf137da Merge pull request #4564 from zhlhahaha:1981
PiperOrigin-RevId: 339921446
2020-10-30 12:45:24 -07:00
Kevin Krakauer d66aebb15a Add the gVisor admission webhook
PiperOrigin-RevId: 339913577
2020-10-30 12:02:09 -07:00
Adin Scannell 3a6f046ae8 Avoid creating users if user is root already.
PiperOrigin-RevId: 339886754
2020-10-30 09:41:04 -07:00
Arthur Sfez dd056112b7 Add IPv4 reassembly packetimpact test
The IPv6 reassembly test was also refactored to be easily extended with
more cases.

PiperOrigin-RevId: 339768605
2020-10-29 16:22:46 -07:00
Ayush Ranjan 52f1dd5e72 [infra] Deflake Go / generate (pull_request.
#4673 does not seem to work. Try this new approach.

PiperOrigin-RevId: 339754794
2020-10-29 15:07:03 -07:00
Dean Deng a86f988a87 Automated rollback of changelist 339675182
PiperOrigin-RevId: 339750876
2020-10-29 14:48:08 -07:00
Kevin Krakauer 181fea0b58 Make RedirectTarget thread safe
Fixes #4613.

PiperOrigin-RevId: 339746784
2020-10-29 14:28:56 -07:00
Ting-Yu Wang b9f18fe2f1 Fix TCP wildcard bind failure when netstack is v6 only
TCP endpoint unconditionly binds to v4 even when the stack only supports v6.

PiperOrigin-RevId: 339739392
2020-10-29 13:52:50 -07:00
Kevin Krakauer 02fe467b47 Keep magic constants out of netstack
PiperOrigin-RevId: 339721152
2020-10-29 12:22:21 -07:00
Arthur Sfez 337c4b9a19 Add support for bare IPv4 in packetimpact tests
PiperOrigin-RevId: 339699771
2020-10-29 10:44:59 -07:00
Dean Deng 1f0f687cbe Delay goroutine creation during TCP handshake for accept/connect.
Refactor TCP handshake code so that when connect is initiated, the initial SYN
is sent before creating a goroutine to handle the rest of the handshake (which
blocks). Similarly, the initial SYN-ACK is sent inline when SYN is received
during accept.

Some additional cleanup is done as well.

Eventually we would like to complete connections in the dispatcher without
requiring a wakeup to complete the handshake. This refactor makes that easier.

Updates #231

PiperOrigin-RevId: 339675182
2020-10-29 08:46:04 -07:00
Ian Lewis b0b275449b Add url option for blog authors
PiperOrigin-RevId: 339608078
2020-10-28 23:16:30 -07:00
Ayush Ranjan 37b57ecd04 [infra] Deflake Go / generate (pull_request) GitHub action.
As you can see https://github.com/google/gvisor/commits/master, there are a lot
of red commits. This is because the Go / generate GitHub action flakes.

On merge, two variants of this workflow run:
- one triggered by the pull request (copybara force pushes to the PR right
  before merge)
- one triggered by the push (merge)

If the push action ends up finishing before the pull request action can run
go_branch.sh, then the changes that go_branch.sh makes is already pushed to
the remote go branch. Consequently, the pull request action ends up having
nothing to commit causing this action to fail.

This change also fixes lint warnings.

Now we skip running the go_branch.sh if we find that our current working commit
has already been committed to remote.

PiperOrigin-RevId: 339586760
2020-10-28 19:54:15 -07:00
Dean Deng 265f1eb2c7 Add leak checking for kernfs.Dentry.
Updates #1486.

PiperOrigin-RevId: 339581879
2020-10-28 19:02:02 -07:00
Dean Deng 3b4674ffe0 Add logging option to leak checker.
Also refactor the template and CheckedObject interface to make this cleaner.

Updates #1486.

PiperOrigin-RevId: 339577120
2020-10-28 18:23:29 -07:00
Arthur Sfez 906f912b7c Add the payload directly to the ICMPv4 type
This makes handling inbound fragmented packets easier, because a fragmented
packet might not have an actual ICMP header but only a payload. After this
change, the ICMPv4 is the last layer you can get because the payload is
embedded in it.

Note that this makes it consistent with the ICMPv6 implementation.

While I'm here, I've also added the Ident and Sequence fields on the ICMPv4
type. Defaults are still zero.

PiperOrigin-RevId: 339577094
2020-10-28 18:18:18 -07:00
Adin Scannell b4b42a5fce Traversal embedded libraries, even for go_library rules.
PiperOrigin-RevId: 339570821
2020-10-28 17:28:03 -07:00
gVisor bot d20ef61a83 Merge pull request #4630 from lemin9538:lemin_arm64_dev
PiperOrigin-RevId: 339540747
2020-10-28 14:42:18 -07:00
Jamie Liu 9907539d92 Invalidate overlay.dentry.dirents during open() file creation.
Updates #1199

PiperOrigin-RevId: 339528827
2020-10-28 13:43:18 -07:00
Tamir Duberstein b26797a8d5 Avoid time.Now in NUD
Use the stack clock instead. Change NeighborEntry.UpdatedAt to
UpdatedAtNanos.

PiperOrigin-RevId: 339520566
2020-10-28 13:01:56 -07:00
Ayush Ranjan 4cc3894b27 [vfs] Refactor hostfs mmap into kernfs util.
PiperOrigin-RevId: 339505487
2020-10-28 11:50:11 -07:00
gVisor bot 17e0a4adde Merge pull request #2849 from lubinszARM:pr_memory_barrier
PiperOrigin-RevId: 339504677
2020-10-28 11:45:01 -07:00
Ting-Yu Wang 8fa18e8ecb Bump honnef.co/go/tools to v0.0.1-2020.1.6
PiperOrigin-RevId: 339476515
2020-10-28 09:41:11 -07:00
Ayush Ranjan 710a878847 [runtime tests] Unexclude fixed test.
#4641 fixed the PHP runtime test ext/standard/tests/network/bug20134.phpt.
We should start testing it again.

Also excluded another flaky test. Seems like a test bug.

PiperOrigin-RevId: 339475716
2020-10-28 09:35:54 -07:00