Commit Graph

190 Commits

Author SHA1 Message Date
Rahat Mahmood 9ef1c79922 Rename marshal.Task to marshal.CopyContext.
CopyContext is a better name for the interface because from
go-marshal's perspective, the interface has nothing to do with a
task. A kernel.Task happens to implement the interface, but so can
other things like MemoryManager and IO sequences.

PiperOrigin-RevId: 331959678
2020-09-16 02:10:12 -07:00
Rahat Mahmood d201feb8c5 Enable automated marshalling for the syscall package.
PiperOrigin-RevId: 331940975
2020-09-15 23:38:57 -07:00
Rahat Mahmood 3ca73841d7 Move the 'marshal' and 'primitive' packages to the 'pkg' directory.
PiperOrigin-RevId: 331256608
2020-09-11 17:42:49 -07:00
Michael Pratt 490e5c83bd Make nogo more robust to variety of stdlib layouts.
PiperOrigin-RevId: 331206424
2020-09-11 13:07:30 -07:00
Ayush Ranjan fada564c83 Fix make_apt script.
This change makes the following fixes:
- When creating a test repo.key, create a secret keyring as other workflows
  also use secret keyrings only.
- We should not be using both --keyring and --secret-keyring options. Just use
  --secret-keyring.
- Pass homedir to all gpg commands. dpkg-sig takes an arg -g which stands for
  gpgopts. So we need to pass the homedir there too.

PiperOrigin-RevId: 330443280
2020-09-07 21:18:22 -07:00
Ayush Ranjan b6d6a120d0 Fix the release workflow.
PiperOrigin-RevId: 330049242
2020-09-03 21:45:10 -07:00
Adin Scannell 101c97d6f8 Change nogo failures to test failures, instead of build failures.
PiperOrigin-RevId: 329408633
2020-08-31 17:09:20 -07:00
Adin Scannell 983a55aa06 Support stdlib analyzers with nogo.
This immediately revealed an escape analysis violation (!), where
the sync.Map was being used in a context that escapes were not
allowed. This is a relatively minor fix and is included.

PiperOrigin-RevId: 328611237
2020-08-26 14:42:35 -07:00
Adin Scannell e650890299 Provide --secret-keyring parameter (for newer gpg).
PiperOrigin-RevId: 328403914
2020-08-25 14:29:55 -07:00
Adin Scannell b0c53f8475 Add nogo support to go_binary and go_test targets.
Updates #3374

PiperOrigin-RevId: 328378700
2020-08-25 12:18:25 -07:00
Ayush Ranjan 46485f9d47 [go-marshal] Support marshalling for structs with names starting with W.
Due to how marshallable interface implementation was generated, we could not
marshal a struct whose named started with W because there was a naming
collision with parameter (w io.Writer) and type (w *StuctName).

Used "writer" as parameter name to avoid collision.

PiperOrigin-RevId: 328343930
2020-08-25 09:23:41 -07:00
Ian Lewis 3f523b3bbc Handle URLs better in issue reviver
- Handle urls ending in /
- Add some url parsing tests

PiperOrigin-RevId: 326750183
2020-08-14 16:23:34 -07:00
gVisor bot 977618c8e1 Merge pull request #3520 from boyuan-he:marshal-impl
PiperOrigin-RevId: 325546935
2020-08-07 18:43:12 -07:00
Zach Koopmans 80c80a1410 Remove old benchmark tools.
Remove the old benchmark-tools directory, including
imports in the WORKSPACE file and associated bazel rules.

The new Golang benchmark-tools can be found at //test/benchmarks
and it is functionally equivalent, excepting syscall_test
which can be found in //test/perf/linux.

PiperOrigin-RevId: 325529075
2020-08-07 16:18:51 -07:00
Boyuan He 92c0643587 add stub go marshallable implementation 2020-08-07 00:29:07 +00:00
Adin Scannell 90021e775a Add bzl_library rules for .bzl files without one.
PiperOrigin-RevId: 325280924
2020-08-06 12:10:49 -07:00
Adin Scannell c5f5806fe6 Enable "make packetimpact-tests" to work.
This required minor fixes to the bazel wrapper. The "dut_platform" is
also changed to "native" to line-up with the system call tests and
remove the hard-coded "linux" and "netstack" strings.
2020-08-04 20:49:00 -07:00
Adin Scannell 10f6c41bbd Include shim binaries in the Go branch.
PiperOrigin-RevId: 324615016
2020-08-03 09:09:51 -07:00
Adin Scannell 877fac4864 Allocate a pseudo-tty for exec.
Otherwise Ctrl-C will kill the 'docker exec' as opposed to killing
the bazel command being run inside the container.

PiperOrigin-RevId: 324079339
2020-07-30 14:11:09 -07:00
Adin Scannell 61b3e05f40 Drop complex awk step.
PiperOrigin-RevId: 324023425
2020-07-30 09:59:03 -07:00
gVisor bot 7c1c5917da Merge pull request #2797 from Rajpratik71:optimization/pip-no-cache
PiperOrigin-RevId: 323508910
2020-07-27 22:18:37 -07:00
Bhasker Hariharan 4d076ec152 Fix for gvisor-builder image.
As it happens
gvisor/tools/bazel.mk:88
 useradd --uid $(UID) --non-unique --no-create-home \
adds the user-id to /var/log/lastlog which happens to be a sparse file except
Go's tar support can't handle sparse files so it actually tries to allocate
the file to seek to the end causing the VM to run out of disk space.

See:
https://github.com/moby/moby/issues/5419#issuecomment-193876183

The fix is to pass -l to useradd to prevent it from trying to add to lastlog.

Fixes #3397

PiperOrigin-RevId: 323492591
2020-07-27 19:38:35 -07:00
Adin Scannell 4b336f16b8 Enable RBE for standard-tests.
PiperOrigin-RevId: 323454998
2020-07-27 15:36:21 -07:00
Adin Scannell d0fd97541a Clean-up bazel wrapper.
The bazel server was being started as the wrong user, leading to issues
where the container would suddenly exit during a build.

We can also simplify the waiting logic by starting the container in two
separate steps: those that must complete first, then the asynchronous bit.

PiperOrigin-RevId: 323391161
2020-07-27 10:40:29 -07:00
Pratik raj b9d9418334 optimize size and time using "--no-cache-dir"
Using "--no-cache-dir" flag in pip install ,make sure dowloaded packages
by pip don't cached on system . This is a best practise which make sure
to fetch ftom repo instead of using local cached one . Further , in case
of Docker Containers , by restricing caching , we can reduce image size.
In term of stats , it depends upon the number of python packages
multiplied by their respective size . e.g for heavy packages with a lot
of dependencies it reduce a lot by don't caching pip packages.

Further , more detail information can be found at

https://medium.com/sciforce/strategies-of-docker-images-optimization-2ca9cc5719b6
2020-07-25 13:26:52 +05:30
gVisor bot ea0342d470 Merge pull request #3356 from amscanne:generics_tests
PiperOrigin-RevId: 323066414
2020-07-24 13:59:45 -07:00
Ayush Ranjan c59b792f53 [go-marshal] Update API
- All Marshal* and Unmarshal* methods now require buffers to be correctly sized
- Only the Copy{In/Out} variants can handle smaller buffers (or address spaces)

PiperOrigin-RevId: 322953881
2020-07-24 01:19:34 -07:00
Adin Scannell ab0262bd94 Convert go_generics tests to starlark.
For some reason these tests were broken when run via the bazel docker
container. The mechanism used was a bit crazy (self-extracting bundle),
so convert them to use straight-forward starlark rules. This has the
added advantaged that they are now independent tests.
2020-07-23 18:00:12 -07:00
Kevin Krakauer 3a2fac0ab9 Automated rollback of changelist 321227330
PiperOrigin-RevId: 322888057
2020-07-23 16:17:27 -07:00
Ayush Ranjan 6f7f739967 Marshallable socket opitons.
Socket option values are now required to implement marshal.Marshallable.

Co-authored-by: Rahat Mahmood <rahat@google.com>
PiperOrigin-RevId: 322831612
2020-07-23 11:45:10 -07:00
Michael Pratt 14839e027f Internal change
PiperOrigin-RevId: 322788791
2020-07-23 08:14:26 -07:00
Ayush Ranjan c9399797d8 Fix kokoro presubmits!
Fixed the following error:
tools/bazel.mk:119: *** Destination not provided..  Stop.
The issue was that we were running all make commands in a subshell so variables
like $T were not passed on.

The other issue was related to credentials. The test passed locally but not on
kokoro, the only difference in the workflow was the credentials bit.

Also fixed up some other tiny issues I came across, were not blockers.

PiperOrigin-RevId: 322782457
2020-07-23 07:29:06 -07:00
Adin Scannell e1a04f84e8 Add standard entrypoints for test targets.
PiperOrigin-RevId: 322265513
2020-07-20 18:05:05 -07:00
Ian Lewis feb1d3d5a7 Clean up html on the website.
- Fixes some html validation issues.
- Fixes links on security basics blog post.
- Adds rel=noopener to links with target=_blank and adds a check to
  htmlproofer.
- Add favicon check to htmlproofer.

Fixes #3286
Fixes #3284

PiperOrigin-RevId: 321892602
2020-07-17 18:27:41 -07:00
Ting-Yu Wang 1d11c40378 Fix errors not getting caught when building vm image.
`set -e` does not catch errors in bash command substituions like
`echo $(bad cmd)` so bazel thinks it succeeded and cached the result.

PiperOrigin-RevId: 321412327
2020-07-15 12:20:23 -07:00
Kevin Krakauer 8a0082f5f3 remove IPv6 docker
Will re-submit when ICMP dest unreachable is handled correctly and it can be
turned back on.

PiperOrigin-RevId: 321227330
2020-07-14 13:49:15 -07:00
Ting-Yu Wang 87c33be9af Enable experimental features in docker.
PiperOrigin-RevId: 321062975
2020-07-13 17:02:32 -07:00
gVisor bot c81ac8ec3b Merge pull request #2672 from amscanne:shim-integrated
PiperOrigin-RevId: 321053634
2020-07-13 16:10:58 -07:00
Kevin Krakauer 3fe9be138c iptables: remove useless ip6tables VM rules
This rule isn't restored when the Kokoro VM is restarted, so it's not doing
anything. And the problem it was meant to solved is instead addressed by
https://github.com/google/gvisor/pull/3207.

PiperOrigin-RevId: 321026846
2020-07-13 13:54:54 -07:00
Adin Scannell 60dc5a4479 Automated rollback of changelist 320972241
PiperOrigin-RevId: 320999851
2020-07-13 11:43:28 -07:00
Adin Scannell 7ff4649b3c Use host networking for build container.
This will allow the use of default credentials.

PiperOrigin-RevId: 320972241
2020-07-13 09:39:06 -07:00
Adin Scannell 2afff44403 Update shim to build using bazel.
The go.mod dependency tree for the shim was somehow contradictory. After
resolving these issues (e.g. explicitly imported k8s 1.14, pulling a
specific dbus version), and adding all dependencies, the shim can now be
build as part of the regular bazel tree.

As part of this process, minor cleanup was done in all the source files:
headers were standardized (and include "The gVisor Authors" in addition
to the "The containerd Authors" if originally derived from containerd
sources), and comments were cleaned up to meet coding standards.

This change makes the containerd installation dynamic, so that multiple
versions can be tested, and drops the static installer for the VM image
itself.

This change also updates test/root/crictl_test.go and related utilities,
so that the containerd tests can be run on any version (and in cases
where it applies, they can be run on both v1 and v2 as parameterized
tests).
2020-07-09 17:39:47 -07:00
Adin Scannell 2f24ab3397 Allow arbitrary Go commands for go_mod.sh. 2020-07-09 16:59:43 -07:00
Kevin Krakauer 47ac142dc9 Enable docker IPv6 in kokoro
We need docker IPv6 for ip6tables tests. Docker has spotty IPv6 support, so just
enabling IPv6 in daemon.json breaks the Ruby image test (AFAICT it breaks
anything that tries to use IPv6 to reach the internet). An ip6tables NAT rule is
added to handle this.

We could make these changes as part of scripts/, but these would overwrite
global values and possibly break users' systems.

PiperOrigin-RevId: 318508209
2020-06-26 11:19:12 -07:00
Adin Scannell 364ac92baf Support for saving pointers to fields in the state package.
Previously, it was not possible to encode/decode an object graph which
contained a pointer to a field within another type. This was because the
encoder was previously unable to disambiguate a pointer to an object and a
pointer within the object.

This CL remedies this by constructing an address map tracking the full memory
range object occupy. The encoded Refvalue message has been extended to allow
references to children objects within another object. Because the encoding
process may learn about object structure over time, we cannot encode any
objects under the entire graph has been generated.

This CL also updates the state package to use standard interfaces intead of
reflection-based dispatch in order to improve performance overall. This
includes a custom wire protocol to significantly reduce the number of
allocations and take advantage of structure packing.

As part of these changes, there are a small number of minor changes in other
places of the code base:

* The lists used during encoding are changed to use intrusive lists with the
  objectEncodeState directly, which required that the ilist Len() method is
  updated to work properly with the ElementMapper mechanism.

* A bug is fixed in the list code wherein Remove() called on an element that is
  already removed can corrupt the list (removing the element if there's only a
  single element). Now the behavior is correct.

* Standard error wrapping is introduced.

* Compressio was updated to implement the new wire.Reader and wire.Writer
  inteface methods directly. The lack of a ReadByte and WriteByte caused issues
  not due to interface dispatch, but because underlying slices for a Read or
  Write call through an interface would always escape to the heap!

* Statify has been updated to support the new APIs.

See README.md for a description of how the new mechanism works.

PiperOrigin-RevId: 318010298
2020-06-23 23:34:06 -07:00
Michael Pratt 3970c12743 Remove various uses of 'whitelist'
Updates #2972

PiperOrigin-RevId: 317113059
2020-06-18 09:03:39 -07:00
Michael Pratt 6d806ee719 Remove various uses of 'blacklist'
Updates #2972

PiperOrigin-RevId: 316942245
2020-06-17 12:34:33 -07:00
Fabricio Voznika fbe41987c9 Enable nogo again
PiperOrigin-RevId: 316011323
2020-06-11 17:34:02 -07:00
Michael Pratt 0c7a5bc69c Add nogo TODO.
PiperOrigin-RevId: 315911025
2020-06-11 09:13:01 -07:00
gVisor bot ac37979ca8 Merge pull request #1875 from zhiqiangxu:fix_scope_add
PiperOrigin-RevId: 315341669
2020-06-08 13:34:58 -07:00