Commit Graph

4526 Commits

Author SHA1 Message Date
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
gVisor bot 7aab117618 Merge pull request #4543 from lubinszARM:pr_test_sigaltstack
PiperOrigin-RevId: 339459247
2020-10-28 08:00:34 -07:00
gVisor bot 5fe886ab6f Merge pull request #4598 from lubinszARM:pr_kvm_precise_sync
PiperOrigin-RevId: 339404936
2020-10-27 23:47:12 -07:00
Min Le c534c91b86 arm64: need to restore the sentry's TLS when in EL1
Signed-off-by: Min Le <lemin.lm@antgroup.com>
2020-10-28 14:10:35 +08:00
gVisor bot 22ac9b0723 Merge pull request #4587 from lnsp:stacktrace
PiperOrigin-RevId: 339385609
2020-10-27 20:43:02 -07:00
Fabricio Voznika 93d2d37a93 Add more cgroup unit tests
PiperOrigin-RevId: 339380431
2020-10-27 19:46:51 -07:00
Julian Elischer 035b1c8272 Add support for Timestamp and RecordRoute IP options
IPv4 options extend the size of the IP header and have a basic known
format. The framework can process that format without needing to know
about every possible option. We can add more code to handle additional
option types as we need them. Bad options or mangled option entries
can result in ICMP Parameter Problem packets. The first types we
support are the Timestamp option and the Record Route option, included
in this change.

The options are processed at several points in the packet flow within
the Network stack, with slightly different requirements. The framework
includes a mechanism to control this at each point. Support has been
added for such points which are only present in upcoming CLs such as
during packet forwarding and fragmentation.

With this change, 'ping -R' and 'ping -T' work against gVisor and Fuchsia.

$ ping -R 192.168.1.2
PING 192.168.1.2 (192.168.1.2) 56(124) bytes of data.
64 bytes from 192.168.1.2: icmp_seq=1 ttl=64 time=0.990 ms
NOP
RR:     192.168.1.1
        192.168.1.2
        192.168.1.1

$ ping -T tsprespec 192.168.1.2 192.168.1.1 192.168.1.2
PING 192.168.1.2 (192.168.1.2) 56(124) bytes of data.
64 bytes from 192.168.1.2: icmp_seq=1 ttl=64 time=1.20 ms
TS:     192.168.1.2    71486821 absolute
        192.168.1.1    746

Unit tests included for generic options, Timestamp options
and Record Route options.

PiperOrigin-RevId: 339379076
2020-10-27 19:32:09 -07:00
Chong Cai bc91ae17f6 Add SHA512 to merkle tree library
PiperOrigin-RevId: 339377254
2020-10-27 19:12:35 -07:00
Bhasker Hariharan 24c33de748 Wake up any waiters on an ICMP error on UDP socket.
This change wakes up any waiters when we receive an ICMP port unreachable
control packet on an UDP socket as well as sets waiter.EventErr in
the result returned by Readiness() when e.lastError is not nil.

The latter is required where an epoll()/poll() is done after the error
is already handled since we will never notify again in such cases.

PiperOrigin-RevId: 339370469
2020-10-27 18:13:46 -07:00
Lennart 1c2836da37 Implement /proc/[pid]/mem
This PR implements /proc/[pid]/mem for `pkg/sentry/fs` (refer to #2716) and `pkg/sentry/fsimpl`.

@majek

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/gvisor/pull/4060 from lnsp:proc-pid-mem 2caf9021254646f441be618a9bb5528610e44d43
PiperOrigin-RevId: 339369629
2020-10-27 18:07:22 -07:00
gVisor bot 013d79d8e4 Merge pull request #4420 from workato:dev-options
PiperOrigin-RevId: 339363816
2020-10-27 17:22:26 -07:00
Tamir Duberstein 4d9066d1d7 Pass NeighborEntry in NUD callbacks
...instead of passing its fields piecemeal.

PiperOrigin-RevId: 339345899
2020-10-27 15:45:06 -07:00
Jamie Liu 6d50185e7c Assign VFS2 overlay device numbers based on layer device numbers.
In VFS1's overlayfs, files use the device and inode number of the lower layer
inode if one exists, and the upper layer inode otherwise. The former behavior
is inefficient (requiring lower layer lookups even if the file exists and is
otherwise wholly determined by the upper layer), and somewhat dangerous if the
lower layer is also observable (since both the overlay and lower layer file
will have the same device and inode numbers and thus appear to be the same
file, despite being behaviorally different). VFS2 overlayfs imitates Linux
overlayfs (in its default configuration) instead; it always uses the inode
number from the originating layer, but synthesizes a unique device number for
directories and another device number for non-directory files that have not
been copied-up.

As it turns out, the latter is insufficient (in VFS2, and possibly Linux as
well), because a given layer may include files with different device numbers.
If two distinct files on such a layer have device number X and Y respectively,
but share inode number Z, then the overlay will map both files to some private
device number X' and inode number Z, potentially confusing applications. Fix
this by assigning synthetic device numbers based on the lower layer's device
number, rather than the lower layer's vfs.Filesystem.

PiperOrigin-RevId: 339300341
2020-10-27 12:10:24 -07:00
Ian Lewis 59e2c9f16a Add basic address deletion to netlink
Updates #3921

PiperOrigin-RevId: 339195417
2020-10-27 00:18:10 -07:00
Ian Lewis ef9378711b Fix platforms blog post permalink
PiperOrigin-RevId: 339182848
2020-10-26 22:06:49 -07:00
Ian Lewis 3bb5f7164e Update latest install docs to install containerd shim
PiperOrigin-RevId: 339182137
2020-10-26 22:01:56 -07:00
Jing Chen facb2fb9c3 Implement command IPC_STAT for semctl.
PiperOrigin-RevId: 339166854
2020-10-26 19:26:42 -07:00
Konstantin Baranov 2b72da8bf9 Allow overriding mount options for /dev and /dev/pts
This is useful to optionally set /dev ro,noexec.

Treat /dev and /dev/pts the same as /proc and /sys.
Make sure the Type is right though. Many config.json snippets
on the Internet suggest /dev is tmpfs, not devtmpfs.
2020-10-26 18:02:52 -07:00
Chong Cai 528bc38022 Add verity tests for deleted/renamed cases
Also change verity test to use a context with an active task. This is
required to delete/rename the file in the underlying file system.

PiperOrigin-RevId: 339146445
2020-10-26 16:51:58 -07:00
Ayush Ranjan 652f11380e [vfs] kernfs: Implement LRU cache for kernfs dentries.
Much like the VFS2 gofer client, kernfs too now caches dentries. The size of the
LRU cache is configurable via mount options.
Have adopted the same reference semantics from gofer client dentry.

Only sysfs and procfs use this LRU cache. The rest of the kernfs users (devpts,
fusefs, host, pipefs, sockfs) still use the no cache approach.

PiperOrigin-RevId: 339139835
2020-10-26 16:14:53 -07:00
Dean Deng 0bdcee38bd Fix SCM Rights S/R reference leak.
Control messages collected when peeking into a socket were being leaked.

PiperOrigin-RevId: 339114961
2020-10-26 14:15:55 -07:00
Adin Scannell 7926a9e28d Add nogo configuration.
This splits the nogo rules into a separate configuration yaml file, and
allows for multiple files to be provided.

Because attrs cannot be passed down to aspects, this required that all
findings are propagated up the aspect Provider. This doesn't mean that
any extra work must be done, just that this information must be carried
through the graph, and some additional starlark complexity is required.

PiperOrigin-RevId: 339076357
2020-10-26 11:11:46 -07:00
Zach Koopmans e2dce04603 Add parser for open source benchmarks.
Add a parser binary for parsing files containing
Benchmark output and sending data to BigQuery.

PiperOrigin-RevId: 339066396
2020-10-26 10:29:20 -07:00
Chong Cai 73a1863538 Implement Seek in verity fs
PiperOrigin-RevId: 338847417
2020-10-24 12:03:44 -07:00
Dean Deng 4feb5c7c26 Add leak checking to vfs2 structures that cannot use the refs_vfs2 template.
Updates #1486.

PiperOrigin-RevId: 338832085
2020-10-24 07:48:47 -07:00
Jamie Liu bc814b01ab Avoid excessive save/restore cycles in socket_ipv4_udp_unbound tests.
PiperOrigin-RevId: 338805321
2020-10-24 00:23:52 -07:00
Toshi Kikuchi 0a035a1011 Send ICMP error message if IP fragment reassembly fails
Fixes #4427, #4428

PiperOrigin-RevId: 338805047
2020-10-24 00:19:15 -07:00
Chong Cai d1e4813e01 Internal change.
PiperOrigin-RevId: 338798433
2020-10-23 22:42:02 -07:00
Dean Deng 54d2d927ac Direct gvisor.dev/issues to the same place as gvisor.dev/issue.
Also let the Github bug reviver detect both in TODOs.

PiperOrigin-RevId: 338785089
2020-10-23 19:29:26 -07:00
Ting-Yu Wang 8dfbec28a4 Fix nogo tests in //pkg/sentry/socket/...
PiperOrigin-RevId: 338784921
2020-10-23 19:24:09 -07:00
Fabricio Voznika 3ed8ace871 Fix nogo errors in specutils
PiperOrigin-RevId: 338780793
2020-10-23 18:35:45 -07:00
Jamie Liu 9f87400f08 Support VFS2 save/restore.
Inode number consistency checks are now skipped in save/restore tests for
reasons described in greatest detail in StatTest.StateDoesntChangeAfterRename.
They pass in VFS1 due to the bug described in new test case
SimpleStatTest.DifferentFilesHaveDifferentDeviceInodeNumberPairs.

Fixes #1663

PiperOrigin-RevId: 338776148
2020-10-23 17:48:33 -07:00
Zach Koopmans 634e14a094 Fix socket_ipv4_udp_unbound_loopback_test_linux
Handle "Resource temporarily unavailable" EAGAIN errors with a select
call before calling recvmsg.

Also rename similar helper call from "RecvMsgTimeout" to "RecvTimeout",
because it calls "recv".

PiperOrigin-RevId: 338761695
2020-10-23 16:13:46 -07:00
Kevin Krakauer a04c8ad4ce iptables testing: handle EINTR on calls to accept().
This caused test flakes.

PiperOrigin-RevId: 338758723
2020-10-23 16:13:01 -07:00
Jing Chen e5c1b035ab Introduce SemidDs struct for amd64 and arm64.
PiperOrigin-RevId: 338756277
2020-10-23 16:12:12 -07:00
Andrei Vagin d18346e790 tools/parsers: disable nogo checks
There are too many dependencies.

PiperOrigin-RevId: 338746264
2020-10-23 14:35:31 -07:00
Ayush Ranjan ad6d32f226 [bazel] Increase number of jobs back to 300
PiperOrigin-RevId: 338739277
2020-10-23 13:56:52 -07:00
Ayush Ranjan 61b379ee19 [vfs] kernfs: cleanup/refactor.
PiperOrigin-RevId: 338728070
2020-10-23 12:59:10 -07:00
Jamie Liu 227fd9f1b0 //pkg/state fixes for VFS2.
- When encodeState.resolve() determines that the resolved reflect.Value is
  contained by a previously-resolved object, set wire.Ref.Type to the
  containing object's type (existing.obj.Type()) rather than the contained
  value's type (obj.Type()).

- When encodeState.resolve() determines that the resolved reflect.Value
  contains a previously-resolved object, handle cases where the new object
  contains *multiple* previously-resolved objects. (This may cause
  previously-allocated object IDs to become unused; to facilitate this, change
  encodeState.pending to a map, and change the wire format to prefix each
  object with its object ID.)

- Add encodeState.encodedStructs to avoid redundant encoding of structs, since
  deduplication of objects via encodeState.resolve() doesn't work for objects
  instantiated by StateSave() and passed to SaveValue() (i.e. fields tagged
  `state:".(whatever)"`).

- Make unexported array fields deserializable via slices that refer to them by
  casting away their unexportedness in decodeState.decodeObject().

Updates #1663

PiperOrigin-RevId: 338727687
2020-10-23 12:53:20 -07:00
Sam Balana 8db147b554 Wait before transitioning NUD entries from Probe to Failed
Wait an additional RetransmitTimer duration after the last probe before
transitioning to Failed. The previous implementation transitions immediately to
Failed after sending the last probe, which is erroneous behavior.

PiperOrigin-RevId: 338723794
2020-10-23 12:33:12 -07:00
Chong Cai 39e214090b Implement Read in gvisor verity fs
Read is implemented by PRead, with offset obtained from Seek.

PiperOrigin-RevId: 338718587
2020-10-23 12:05:19 -07:00
Ayush Ranjan 6ee3520b61 [vfs] kernfs: Implement remaining InodeAttr fields.
Added the following fields in kernfs.InodeAttr:
- blockSize
- atime
- mtime
- ctime

Also resolved all TODOs for #1193.

Fixes #1193

PiperOrigin-RevId: 338714527
2020-10-23 11:43:32 -07:00
Bhasker Hariharan f73fad834f Fix TestTCPTimeWaitNewSyn.
Drain the notification channel after first accept as in case the first accept
never blocked then the notification for the first accept will still be in the
channel causing the second accept to fail as it will try to wait on the channel
and return immediately due to the older notification even though there is no
connection yet in the accept queue.

PiperOrigin-RevId: 338710062
2020-10-23 11:20:49 -07:00