Commit Graph

4461 Commits

Author SHA1 Message Date
Dean Deng 4e389c7857 Check for nil in kernel.FSContext functions.
Reported-by: syzbot+c0e175d2b10708314eb3@syzkaller.appspotmail.com
PiperOrigin-RevId: 338386575
2020-10-21 19:16:56 -07:00
gVisor bot 1a5eb49a43 Merge pull request #3957 from workato:auto-cgroup
PiperOrigin-RevId: 338372736
2020-10-21 17:24:06 -07:00
gVisor bot 1b2097f84e Merge pull request #4535 from lubinszARM:pr_kvm_exec_binary_1
PiperOrigin-RevId: 338321125
2020-10-21 12:53:11 -07:00
Andrei Vagin b6a0c91aa1 test/runtime: set the NOFILE soft rlimit to 32K
The python:test_subprocess enumerates all possible file descriptors and fails
by timeout if the limit is too high.

There is a know thing about docker that it sets this limit to 1M by default,
but on native linux, this limit will be between 1K to 32K.

PiperOrigin-RevId: 338197239
2020-10-20 21:44:51 -07:00
Konstantin Baranov d579ed8505 Do not even try forcing cgroups in tests 2020-10-20 20:03:04 -07:00
Ting-Yu Wang 7dc108b41f Fix errors when the tagging GitHub releases
When the commit description contains "commit ", it will be wrongly identified
as commit hash.  This commit changes to take only lines begins with "commit "
as a fix, since the description is always indented by `git log`.

Copybara uses merge commit for external contributors, this causes that not all
commits contain a Piper ID. Adding `--first-parent` to `git log` so that it
only lists commits that contain a Piper ID.

PiperOrigin-RevId: 338183812
2020-10-20 19:30:14 -07:00
Ting-Yu Wang 16ba350314 Fix nogo test in //pkg/tcpip/...
PiperOrigin-RevId: 338168977
2020-10-20 17:22:28 -07:00
Ayush Ranjan e36a2b7930 [runtime tests] Update exclude files.
bhaskerh@ fixed a bunch of the EADDRINUSE flakes in #3662 so we should
unexclude them.

I have also tested other flaky tests on this list and removed those that do
not flake anymore.

PiperOrigin-RevId: 338158545
2020-10-20 16:19:15 -07:00
Ghanan Gowripalan 2bfdbfd1fd Fix locking in AddressableEndpointState
PiperOrigin-RevId: 338156438
2020-10-20 16:06:30 -07:00
Ting-Yu Wang 4da10f873e Fix nogo tests.
//pkg/tcpip/stack:stack_x_test_nogo
//pkg/tcpip/transport/raw:raw_nogo

PiperOrigin-RevId: 338153265
2020-10-20 15:47:48 -07:00
gVisor bot d45d57f49e Merge pull request #4524 from lemin9538:lemin_arm64
PiperOrigin-RevId: 338126491
2020-10-20 13:32:18 -07:00
Fabricio Voznika c21d8375d9 Add /dev to mandatory mounts test
PiperOrigin-RevId: 338072845
2020-10-20 09:20:49 -07:00
Andrei Vagin 34a6e9576a loader/elf: validate file offset
Reported-by: syzbot+7406eef8247cb5a20855@syzkaller.appspotmail.com
PiperOrigin-RevId: 337974474
2020-10-19 18:18:24 -07:00
Dean Deng dcc1b71f1b Fix reference counting on kcov mappings.
Reported-by: syzbot+078580ce5dd6d607fcd8@syzkaller.appspotmail.com
Reported-by: syzbot+2096681f6891e7bf8aed@syzkaller.appspotmail.com
PiperOrigin-RevId: 337973519
2020-10-19 18:09:39 -07:00
gVisor bot 2a4ec9cf76 Merge pull request #4510 from btw616:fix/issue-4509
PiperOrigin-RevId: 337971497
2020-10-19 17:52:56 -07:00
Jamie Liu cd86bd4931 Fix runsc tests on VFS2 overlay.
- Check the sticky bit in overlay.filesystem.UnlinkAt(). Fixes
  StickyTest.StickyBitPermDenied.

- When configuring a VFS2 overlay in runsc, copy the lower layer's root
  owner/group/mode to the upper layer's root (as in the VFS1 equivalent,
  boot.addOverlay()). This makes the overlay root owned by UID/GID 65534 with
  mode 0755 rather than owned by UID/GID 0 with mode 01777. Fixes
  CreateTest.CreateFailsOnUnpermittedDir, which assumes that the test cannot
  create files in /.

- MknodTest.UnimplementedTypesReturnError assumes that the creation of device
  special files is not supported. However, while the VFS2 gofer client still
  doesn't support device special files, VFS2 tmpfs does, and in the overlay
  test dimension mknod() targets a tmpfs upper layer. The test initially has
  all capabilities, including CAP_MKNOD, so its creation of these files
  succeeds. Constrain these tests to VFS1.

- Rename overlay.nonDirectoryFD to overlay.regularFileFD and only use it for
  regular files, using the original FD for pipes and device special files. This
  is more consistent with Linux (which gets the original inode_operations, and
  therefore file_operations, for these file types from ovl_fill_inode() =>
  init_special_inode()) and fixes remaining mknod and pipe tests.

- Read/write 1KB at a time in PipeTest.Streaming, rather than 4 bytes. This
  isn't strictly necessary, but it makes the test less obnoxiously slow on
  ptrace.

Fixes #4407

PiperOrigin-RevId: 337971042
2020-10-19 17:48:02 -07:00
Adin Scannell 8f29b8d252 Remove now unused remote3 configurations.
PiperOrigin-RevId: 337968219
2020-10-19 17:26:28 -07:00
Adin Scannell 54e989ec3a Remove legacy bazel configurations.
Using the newer bazel rules necessitates a transition from proto1 to
proto2. In order to resolve the incompatibility between proto2 and
gogoproto, the cri runtimeoptions proto must be vendored.

Further, some of the semantics of bazel caching changed during the
transition. It is now necessary to:

- Ensure that :gopath depends only on pure library targets, as the
  propagation of go_binary build attributes (pure, static) will
  affected the generated files (though content remains the same,
  there are conflicts with respect to the gopath).
- Update bazel.mk to include the possibility of binaries in the
  bazel-out directory, as it will now put runsc and others there.
  This required some refinements to the mechanism of extracting
  paths, since some the existing regex resulted in false positives.
- Change nogo rules to prevent escape generation on binary targets.
  For some reason, the newer version of bazel attempted to run the
  nogo analysis on the binary targets, which fails due to the fact
  that objdump does not work on the final binary. This must be due
  to a change in the semantics of aspects in bazel3.

PiperOrigin-RevId: 337958324
2020-10-19 16:28:40 -07:00
Fabricio Voznika 4b4d12d5bb Fixes to cgroups
There were a few problems with cgroups:
- cleanup loop what breaking too early
- parse of /proc/[pid]/cgroups was skipping "name=systemd"
  because "name=" was not being removed from name.
- When no limits are specified, fillFromAncestor was not being
  called, causing a failure to set cpuset.mems

Updates #4536

PiperOrigin-RevId: 337947356
2020-10-19 15:32:50 -07:00
Dean Deng 63f4cef4d1 [vfs2] Fix fork reference leaks.
PiperOrigin-RevId: 337919424
2020-10-19 13:20:13 -07:00
Andrei Vagin cd108432a5 splice: return EINVAL is len is negative
Reported-by: syzbot+0268cc591c0f517a1de0@syzkaller.appspotmail.com
PiperOrigin-RevId: 337901664
2020-10-19 11:52:51 -07:00
Ayush Ranjan c206fcbfc2 pgalloc: Do not hold MemoryFile.mu while calling mincore.
This change makes the following changes:
- Unlocks MemoryFile.mu while calling mincore (checkCommitted) because mincore
  can take a really long time. Accordingly looks up the segment in the tree
  tree again and handles changes to the segment.
- MemoryFile.UpdateUsage() can now only be called at frequency at most 100Hz.
  100 Hz = linux.CLOCKS_PER_SEC.

Co-authored-by: Jamie Liu <jamieliu@google.com>
PiperOrigin-RevId: 337865250
2020-10-19 09:02:19 -07:00
Bin Lu 3b735c8fec arm64 kvm: handle exception from accessing undefined instruction
Consistent with the linux approach, we will produce a sigill to handle
el0_undef.

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

Signed-off-by: Bin Lu <bin.lu@arm.com>
2020-10-18 21:47:12 -04:00
Adin Scannell 9a3d8973c4 Refactor shared starlark files.
PiperOrigin-RevId: 337581114
2020-10-16 14:44:03 -07:00
Dean Deng 4ddb58f6ef Use POSIX interval timers in flock test.
ualarm(2) is obsolete. Move IntervalTimer into a test util, where it can be
used by flock tests.

These tests were flaky with TSAN, probably because it slowed the tests down
enough that the alarm was expiring before flock() was called. Use an interval
timer so that even if we miss the first alarm (or more), flock() is still
guaranteed to be interrupted.

PiperOrigin-RevId: 337578751
2020-10-16 14:32:49 -07:00
Ghanan Gowripalan dffa4c6690 Don't include link header when forwarding packets
Before this change, if a link header was included in an incoming packet
that is forwarded, the packet that gets sent out will take the original
packet and add a link header to it while keeping the old link header.
This would make the sent packet look like:

   OUTGOING LINK HDR | INCOMING LINK HDR | NETWORK HDR | ...

Obviously this is incorrect as we should drop the incoming link header
and only include the outgoing link header. This change fixes this bug.

Test: integration_test.TestForwarding
PiperOrigin-RevId: 337571447
2020-10-16 13:54:00 -07:00
Julian Elischer 4d27f33b09 Make IPv4 check the IP header checksum
The IPv4 header checksum has not been checked, at least in recent times,
so add code to do so. Fix all the tests that fail because they never
needed to set the checksum.

Fixes #4484

PiperOrigin-RevId: 337556243
2020-10-16 12:31:05 -07:00
Arthur Sfez edc1068244 Enable IPv4 fragmentation for every code path.
Currently, fragmentation can only occur during WritePacket(). This enables
it for WritePackets() and WriteIncludedHeaderPacket() as well.

IPv4 unit tests were refactored to be consistent with the IPv6 unit tests.

This removes the extraHeaderReserveLength field and the related
"prependable bytes" unit tests (for both IPv4 and IPv6) because it was only
testing a panic condition when the value was too low.

Fixes #3796

PiperOrigin-RevId: 337550061
2020-10-16 11:57:27 -07:00
gVisor bot b491712e11 Merge pull request #4387 from lubinszARM:pr_tls_host_sentry_1
PiperOrigin-RevId: 337544656
2020-10-16 11:32:38 -07:00
Adin Scannell b0da31b921 Refactor nogo to better support ARM.
PiperOrigin-RevId: 337544107
2020-10-16 11:26:58 -07:00
Ghanan Gowripalan fbfcf8144c Enable IPv6 WriteHeaderIncludedPacket
Allow writing an IPv6 packet where the IPv6 header is a provided by
the user.

* Introduce an error to let callers know a header is malformed.
We previously useed tcpip.ErrInvalidOptionValue but that did not seem
appropriate for generic malformed header errors.

* Populate network header in WriteHeaderIncludedPacket
IPv4's implementation of WriteHeaderIncludedPacket did not previously
populate the packet buffer's network header. This change fixes that.

Fixes #4527

Test: ip_test.TestWriteHeaderIncludedPacket
PiperOrigin-RevId: 337534548
2020-10-16 10:42:34 -07:00
Adin Scannell 14a003c60f Cache errors when processing stdlib with nogo.
PiperOrigin-RevId: 337515664
2020-10-16 09:05:18 -07:00
Andrei Vagin c002fc36f9 sockets: ignore io.EOF from view.ReadAt
Reported-by: syzbot+5466463b7604c2902875@syzkaller.appspotmail.com
PiperOrigin-RevId: 337451896
2020-10-15 23:15:48 -07:00
Fabricio Voznika fc40ead685 `runsc do` fallback to internal network on failure
In case setting up network fails, log a warning and fallback to internal
network.

Closes #4498

PiperOrigin-RevId: 337442632
2020-10-15 21:51:02 -07:00
Adin Scannell 0a7e32bd17 Add easier-to-use docker_image target.
PiperOrigin-RevId: 337415009
2020-10-15 17:21:24 -07:00
Zeling Feng 0d54b41e55 Syncing packetimpact tests in different directories
By exposing an ALL_TESTS list in defs.bzl we can make sure all packetimpact
users get to agree on the list of all tests. A defect in this approach is that
we have to keep a list of packetimpact_testbench rules in the BUILD file. An
helper validate_all_tests has been added to help keep BUILD and .bzl files in
sync.

PiperOrigin-RevId: 337411839
2020-10-15 17:02:00 -07:00
Sam Balana 3269cefd6f Process NAs without target link-layer addresses
RFC 4861 section 4.4 comments the Target link-layer address option is sometimes
optional in a Neighbor Advertisement packet:

  "When responding to a unicast Neighbor Solicitation this option SHOULD be
  included."

Tests:
 pkg/tcpip/stack:stack_test
 - TestEntryStaleToReachableWhenSolicitedConfirmationWithoutAddress
 - TestEntryDelayToReachableWhenSolicitedConfirmationWithoutAddress
 - TestEntryProbeToReachableWhenSolicitedConfirmationWithoutAddress
 pkg/tcpip/network/ipv6:ipv6_test
 - TestCallsToNeighborCache
PiperOrigin-RevId: 337396493
2020-10-15 15:37:01 -07:00
Chong Cai f0f7431ea2 Change verity isEnable to be a member of dentry
PiperOrigin-RevId: 337384146
2020-10-15 14:35:15 -07:00
Arthur Sfez 8f70c6ef35 Refactor compareFragments to follow Go style
Test helpers should be used for test setup/teardown, not actual
testing. Use cmp.Diff instead of bytes.Equal to improve readability.

PiperOrigin-RevId: 337323242
2020-10-15 09:29:01 -07:00
Min Le 4f077b9a7e arm64: the ASID offset of TTBR register is 48
Signed-off-by: Min Le <lemin.lm@antgroup.com>
2020-10-15 13:48:06 +08:00
Ghanan Gowripalan 6e6a9d3f3d Find route before sending NA response
This change also brings back the stack.Route.ResolveWith method so that
we can immediately resolve a route when sending an NA in response to a
a NS with a source link layer address option.

Test: ipv6_test.TestNeighorSolicitationResponse
PiperOrigin-RevId: 337185461
2020-10-14 15:29:47 -07:00
Dean Deng fc1e653973 Fix SCM Rights reference leaks.
Control messages should be released on Read (which ignores the control message)
or zero-byte Send. Otherwise, open fds sent through the control messages will
be leaked.

PiperOrigin-RevId: 337110774
2020-10-14 09:54:05 -07:00
Dean Deng a7b7b7b980 Fix shm reference leak.
All shm segments in an IPC namespace should be released once that namespace is
destroyed. Add reference counting to IPCNamespace so that once the last task
with a reference on it exits, we can trigger a destructor that will clean up
all shm segments that have not been explicitly freed by the application.

PiperOrigin-RevId: 337032977
2020-10-14 00:13:21 -07:00
Tiwei Bie ca731934fe Disable strace+debug when explicitly requested
Currently strace+debug is always enabled as the setting from
the upper layer isn't passed to _syscall_test(). And it will
negatively affect the performance tests. This patch fixes this
issue.

The "debug" argument of _syscall_test() is also made mandatory
to prevent this happening again.

//test/perf:getpid_benchmark_runsc_kvm

-----------------------------------------------------
Benchmark           Time             CPU   Iterations
-----------------------------------------------------
Before:
BM_Getpid       28119 ns        28157 ns        25926

After:
BM_Getpid         947 ns          939 ns       777778

Fixes #4509

Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
2020-10-14 14:41:23 +08:00
Ian Lewis 631dd5330d Various website fixes
- Formatting on the most recent blog post
- Add a link to faq from containerd docs
- Fix code in FAQ

PiperOrigin-RevId: 337001738
2020-10-13 18:59:45 -07:00
gVisor bot 7eeeff4268 Merge pull request #4482 from lemin9538:lemin_arm64
PiperOrigin-RevId: 336976081
2020-10-13 16:12:20 -07:00
gVisor bot 443e3cad4a Merge pull request #4486 from patr0nus:master_udp_ep_fix
PiperOrigin-RevId: 336974095
2020-10-13 16:01:58 -07:00
gVisor bot dbe122c92f Merge pull request #4386 from lubinszARM:pr_testutil_tls_usr
PiperOrigin-RevId: 336970511
2020-10-13 15:42:24 -07:00
gVisor bot b99f15e06d Merge pull request #4374 from lubinszARM:pr_ffmpeg_kvm_01
PiperOrigin-RevId: 336962937
2020-10-13 15:02:57 -07:00
Sam Balana 51913ba400 Correct NA minimum size
Remove the duplicate NA size variable while I'm here.

See https://tools.ietf.org/html/rfc4861#section-4.4 for the packet format.

PiperOrigin-RevId: 336943206
2020-10-13 13:28:26 -07:00