Commit Graph
245 Commits
Author SHA1 Message Date
Adin ScannellandgVisor bot 3564d5aea6 Remove remote execution support.
PiperOrigin-RevId: 349616845
2020-12-30 16:54:16 -08:00
Adin ScannellandgVisor bot 2876132f6f Add BuildKite annotations for failures and profiles.
This change cleans up some minor Makefile issues, and adds support for
BuildKite annotations on failure and on profiles being generated. These
annotations will make failures very clear and link to the artifacts.

This change is a stepping stone for aggregating coverage data from all
individual test jobs, as this will also happen in .buildkite/annotate.sh.

PiperOrigin-RevId: 349606598
2020-12-30 15:09:12 -08:00
Adin ScannellandgVisor bot 57607409ea Use a stable ordering for generated types.
Otherwise this pollutes the 'go' branch and doesn't conform to standards
for generate bazel files.

PiperOrigin-RevId: 349605037
2020-12-30 14:53:03 -08:00
Adin ScannellandgVisor bot 5d92e45191 Exclude changing generated file from go_branch.
PiperOrigin-RevId: 349491589
2020-12-29 17:46:00 -08:00
Adin ScannellandgVisor bot 69f0412910 Remove existing nogo exceptions.
PiperOrigin-RevId: 347047550
2020-12-11 12:06:49 -08:00
Zach KoopmansandgVisor bot 096c60d707 Fix parser to include iterations.
PiperOrigin-RevId: 347038652
2020-12-11 11:26:42 -08:00
Dean DengandgVisor bot 04d60822d9 Fix typo in go template error messages.
PiperOrigin-RevId: 346878344
2020-12-10 15:31:24 -08:00
Adin ScannellandgVisor bot 727b2adc2f Tweak aarch64 support.
A few images were broken with respect to aarch64. We should now
be able to run push-all-images with ARCH=aarch64 as part of the
regular continuous integration builds, and add aarch64 smoke tests
(via user emulation for now) to the regular test suite (future).

PiperOrigin-RevId: 346685462
2020-12-09 18:51:17 -08:00
Jamie LiuandShentubot 5547dde644 Add //pkg/sync:generic_atomicptrmap.
AtomicPtrMap is a generic concurrent map from arbitrary keys to arbitrary
pointer values.

Benchmarks:
name                                                            time/op
StoreDelete/RWMutexMap-12                                        335ns ± 1%
StoreDelete/SyncMap-12                                           705ns ± 3%
StoreDelete/AtomicPtrMap-12                                      287ns ± 4%
StoreDelete/AtomicPtrMapSharded-12                               289ns ± 1%
LoadOrStoreDelete/RWMutexMap-12                                  342ns ± 2%
LoadOrStoreDelete/SyncMap-12                                     662ns ± 2%
LoadOrStoreDelete/AtomicPtrMap-12                                290ns ± 7%
LoadOrStoreDelete/AtomicPtrMapSharded-12                         293ns ± 2%
LookupPositive/RWMutexMap-12                                     101ns ±26%
LookupPositive/SyncMap-12                                        202ns ± 2%
LookupPositive/AtomicPtrMap-12                                  71.1ns ± 2%
LookupPositive/AtomicPtrMapSharded-12                           73.2ns ± 1%
LookupNegative/RWMutexMap-12                                     119ns ± 1%
LookupNegative/SyncMap-12                                        154ns ± 1%
LookupNegative/AtomicPtrMap-12                                  84.7ns ± 3%
LookupNegative/AtomicPtrMapSharded-12                           86.8ns ± 1%
Concurrent/FixedKeys_1PercentWrites_RWMutexMap-12               1.32µs ± 2%
Concurrent/FixedKeys_1PercentWrites_SyncMap-12                  52.7ns ±10%
Concurrent/FixedKeys_1PercentWrites_AtomicPtrMap-12             31.8ns ±20%
Concurrent/FixedKeys_1PercentWrites_AtomicPtrMapSharded-12      24.0ns ±15%
Concurrent/FixedKeys_10PercentWrites_RWMutexMap-12               860ns ± 3%
Concurrent/FixedKeys_10PercentWrites_SyncMap-12                 68.8ns ±20%
Concurrent/FixedKeys_10PercentWrites_AtomicPtrMap-12            98.6ns ± 7%
Concurrent/FixedKeys_10PercentWrites_AtomicPtrMapSharded-12     42.0ns ±25%
Concurrent/FixedKeys_50PercentWrites_RWMutexMap-12              1.17µs ± 3%
Concurrent/FixedKeys_50PercentWrites_SyncMap-12                  136ns ±34%
Concurrent/FixedKeys_50PercentWrites_AtomicPtrMap-12             286ns ± 3%
Concurrent/FixedKeys_50PercentWrites_AtomicPtrMapSharded-12      115ns ±35%
Concurrent/ChangingKeys_1PercentWrites_RWMutexMap-12            1.27µs ± 2%
Concurrent/ChangingKeys_1PercentWrites_SyncMap-12               5.01µs ± 3%
Concurrent/ChangingKeys_1PercentWrites_AtomicPtrMap-12          38.1ns ± 3%
Concurrent/ChangingKeys_1PercentWrites_AtomicPtrMapSharded-12   22.6ns ± 2%
Concurrent/ChangingKeys_10PercentWrites_RWMutexMap-12           1.08µs ± 2%
Concurrent/ChangingKeys_10PercentWrites_SyncMap-12              5.97µs ± 1%
Concurrent/ChangingKeys_10PercentWrites_AtomicPtrMap-12          390ns ± 2%
Concurrent/ChangingKeys_10PercentWrites_AtomicPtrMapSharded-12  93.6ns ± 1%
Concurrent/ChangingKeys_50PercentWrites_RWMutexMap-12           1.77µs ± 2%
Concurrent/ChangingKeys_50PercentWrites_SyncMap-12              8.07µs ± 2%
Concurrent/ChangingKeys_50PercentWrites_AtomicPtrMap-12         1.61µs ± 2%
Concurrent/ChangingKeys_50PercentWrites_AtomicPtrMapSharded-12   386ns ± 1%

Updates #231

PiperOrigin-RevId: 346614776
2020-12-09 15:57:02 -08:00
Adin ScannellandShentubot 0bcbf188c6 Refactor the Makefile to avoid recursive Make.
Recursive make is difficult to follow and debug. Drop this by using
internal functions, which, while difficult, are easier than trying to
following recursive invokations.

Further simplify the Makefile by collapsing the image bits and removing
the tools/vm directory, which is effectively unused.

Fixes #4952

PiperOrigin-RevId: 346569133
2020-12-09 15:53:23 -08:00
Andrei VaginandShentubot 45d6d18370 Prepare for supporting cross compilation.
PiperOrigin-RevId: 346496532
2020-12-09 15:51:33 -08:00
Adin ScannellandgVisor bot 0d1d872f7f Support partitions for other tests.
PiperOrigin-RevId: 345399936
2020-12-03 01:00:21 -08:00
Adin ScannellandgVisor bot dc560beb44 Fix containerd.sh for later Ubuntu and Debian-based distributions.
PiperOrigin-RevId: 345245285
2020-12-02 09:15:58 -08:00
Adin ScannellandgVisor bot 3dc6b1b1c2 Ensure containerd is used from installed location.
Currently, if containerd is installed locally via tools/installers/containerd,
then it will not necessarily be used if containerd is installed in the system
path. This means that the existing containerd tests are all likely broken.

Also, use libbtrfs-dev instead of btrfs-tools, which is not actually required.

PiperOrigin-RevId: 344879109
2020-11-30 13:40:23 -08:00
Adin ScannellandgVisor bot d5304e056d Fix bad Makefile variable reference.
PiperOrigin-RevId: 343946859
2020-11-23 16:04:29 -08:00
Adin ScannellandgVisor bot 6e17891ac5 Clean up build output.
This change also simplifies and documents the build_cmd pipeline, and
reduces general noise for debugging Makefile issues.

It also drops the mapping for /etc/docker/daemon.json, which if it
does not exist initially will create this as a directory (causing lots
of confusion and breaks).

PiperOrigin-RevId: 343932456
2020-11-23 14:45:34 -08:00
Adin ScannellandgVisor bot 667adef3a6 Don't rely on HOME for tools/go_branch.sh
PiperOrigin-RevId: 343885770
2020-11-23 11:05:23 -08:00
Zach KoopmansandgVisor bot a629c3d159 Add debug logs to startup benchmark.
PiperOrigin-RevId: 341757694
2020-11-10 21:20:52 -08:00
Jamie LiuandgVisor bot ae6a0213d3 Internal change
PiperOrigin-RevId: 341732791
2020-11-10 17:39:31 -08:00
Zach KoopmansandgVisor bot af8d0efdcc Internal Change
PiperOrigin-RevId: 340941898
2020-11-05 15:43:14 -08:00
Ting-Yu WangandgVisor bot ec5fb69513 Fix more nogo tests
PiperOrigin-RevId: 340536306
2020-11-03 15:23:32 -08:00
Kevin KrakauerandgVisor bot 9e00769820 Add the gVisor admission webhook
PiperOrigin-RevId: 339913577
2020-10-30 12:02:09 -07:00
Adin ScannellandgVisor bot e561fe5c8b Avoid creating users if user is root already.
PiperOrigin-RevId: 339886754
2020-10-30 09:41:04 -07:00
Ayush RanjanandgVisor bot 63d68bd767 [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
Ayush RanjanandgVisor bot d13663d7f7 [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
Adin ScannellandgVisor bot d5f3e6bd72 Traversal embedded libraries, even for go_library rules.
PiperOrigin-RevId: 339570821
2020-10-28 17:28:03 -07:00
Adin ScannellandgVisor bot 90b43e7a2c 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 KoopmansandgVisor bot 46a5b279a6 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
Dean DengandgVisor bot 039fc0fa3d 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 WangandgVisor bot d99406cbd8 Fix nogo tests in //pkg/sentry/socket/...
PiperOrigin-RevId: 338784921
2020-10-23 19:24:09 -07:00
Andrei VaginandgVisor bot 6b81bbe52b tools/parsers: disable nogo checks
There are too many dependencies.

PiperOrigin-RevId: 338746264
2020-10-23 14:35:31 -07:00
Jamie LiuandgVisor bot 5fdf2d0f19 //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
Dean DengandgVisor bot f6aa673ece Rewrite reference leak checker without finalizers.
Our current reference leak checker uses finalizers to verify whether an object
has reached zero references before it is garbage collected. There are multiple
problems with this mechanism, so a rewrite is in order.

With finalizers, there is no way to guarantee that a finalizer will run before
the program exits. When an unreachable object with a finalizer is garbage
collected, its finalizer will be added to a queue and run asynchronously. The
best we can do is run garbage collection upon sandbox exit to make sure that
all finalizers are enqueued.

Furthermore, if there is a chain of finalized objects, e.g. A points to B
points to C, garbage collection needs to run multiple times before all of the
finalizers are enqueued. The first GC run will register the finalizer for A but
not free it. It takes another GC run to free A, at which point B's finalizer
can be registered. As a result, we need to run GC as many times as the length
of the longest such chain to have a somewhat reliable leak checker.

Finally, a cyclical chain of structs pointing to one another will never be
garbage collected if a finalizer is set. This is a well-known issue with Go
finalizers (https://github.com/golang/go/issues/7358). Using leak checking on
filesystem objects that produce cycles will not work and even result in memory
leaks.

The new leak checker stores reference counted objects in a global map when
leak check is enabled and removes them once they are destroyed. At sandbox
exit, any remaining objects in the map are considered as leaked. This provides
a deterministic way of detecting leaks without relying on the complexities of
finalizers and garbage collection.

This approach has several benefits over the former, including:
- Always detects leaks of objects that should be destroyed very close to
  sandbox exit. The old checker very rarely detected these leaks, because it
  relied on garbage collection to be run in a short window of time.
- Panics if we forgot to enable leak check on a ref-counted object (we will try
  to remove it from the map when it is destroyed, but it will never have been
  added).
- Can store extra logging information in the map values without adding to the
  size of the ref count struct itself. With the size of just an int64, the ref
  count object remains compact, meaning frequent operations like IncRef/DecRef
  are more cache-efficient.
- Can aggregate leak results in a single report after the sandbox exits.
  Instead of having warnings littered in the log, which were
  non-deterministically triggered by garbage collection, we can print all
  warning messages at once. Note that this could also be a limitation--the
  sandbox must exit properly for leaks to be detected.

Some basic benchmarking indicates that this change does not significantly
affect performance when leak checking is enabled, which is understandable
since registering/unregistering is only done once for each filesystem object.

Updates #1486.

PiperOrigin-RevId: 338685972
2020-10-23 09:17:02 -07:00
Ting-Yu WangandgVisor bot 69bd41abd4 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 WangandgVisor bot 30e05b8895 Fix nogo test in //pkg/tcpip/...
PiperOrigin-RevId: 338168977
2020-10-20 17:22:28 -07:00
Adin ScannellandgVisor bot 56dd1e2544 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
Adin ScannellandgVisor bot d7ae3575c6 Refactor shared starlark files.
PiperOrigin-RevId: 337581114
2020-10-16 14:44:03 -07:00
Adin ScannellandgVisor bot fef2c86789 Refactor nogo to better support ARM.
PiperOrigin-RevId: 337544107
2020-10-16 11:26:58 -07:00
Adin ScannellandgVisor bot 91b31f53dd Cache errors when processing stdlib with nogo.
PiperOrigin-RevId: 337515664
2020-10-16 09:05:18 -07:00
Zach KoopmansandgVisor bot 384dabc619 Add parsers golang benchmarks.
Add parser and formatting for golang benchmarks for docker benchmarks.
Change adds a library for printing and parsing Test parameters and metrics.
Benchmarks use the library to print parameters in the Benchmark title
(e.g. the name field in b.Run()), and to report CustomMetrics. Parser
uses the library to parse printed data from benchmark output and
put it into BigQuery structs.

PiperOrigin-RevId: 336365628
2020-10-09 14:29:21 -07:00
Adin ScannellandgVisor bot baaab0c127 Minor nogo restructuring.
PiperOrigin-RevId: 336343819
2020-10-09 12:33:44 -07:00
Adin ScannellandgVisor bot 55d7103ff4 Infer receiver name for stateify.
PiperOrigin-RevId: 336340035
2020-10-09 12:14:28 -07:00
Adin ScannellandgVisor bot e0b72735d6 Minor nogo cleanup.
PiperOrigin-RevId: 336126583
2020-10-08 11:24:21 -07:00
Adin ScannellandgVisor bot bc736093c5 Add staticcheck and staticstyle analyzers.
This change also adds support to go_stateify for detecting an appropriate
receiver name, avoiding a large number of false positives.

PiperOrigin-RevId: 335994587
2020-10-07 18:29:05 -07:00
gVisor bot 63ef2e5e70 Internal change.
PiperOrigin-RevId: 335960488
2020-10-07 15:04:13 -07:00
Dean DengandgVisor bot 317e34c514 Fix text processing in bazel build command.
The extraction of the build target was overfitted before, making build_cmd fail
in some environments.

PiperOrigin-RevId: 335916651
2020-10-07 11:45:26 -07:00
gVisor bot 835c08c4d1 Internal change.
PiperOrigin-RevId: 335429072
2020-10-05 13:17:19 -07:00
Andrei Vagin 0d924ccd0d tools/checkescape: trim the "(SB)" before searching it in the allowed list
Signed-off-by: Andrei Vagin <[email protected]>
2020-10-02 14:27:49 -07:00
Adin ScannellandgVisor bot 9bed26f8b4 Save addresses for "allowed" functions.
PiperOrigin-RevId: 335086850
2020-10-02 13:14:16 -07:00
Rahat MahmoodandgVisor bot 1969e092cb go-marshal tests should respect build tags.
Previously, the go-marshal-generated tests did not respect build
tags. This can cause the test to unbuildable under some build
configurations, as the original types the tests refer to may not be
defined.

This CL copies the build tags from the input files to the test,
similar to the generated library; however test packages have an
additional constraint. A test package cannot be totally empty
(i.e. have no test/example/benchmark defined), otherwise the go
compiler returns an error. To ensure the generated test package always
contains a testable entity under all build configurations, we now emit
an extra test file with no build tags that contains a single no-op
example.

PiperOrigin-RevId: 334496821
2020-09-29 17:29:08 -07:00