81 Commits
Author SHA1 Message Date
gVisor bot cd3cec20c6 Replace outdated select() on --cpu with platform API equivalent.
PiperOrigin-RevId: 733519356
2025-03-04 17:18:31 -08:00
Andrei Vagin f010ae01ac Fix a few typos 2025-01-29 21:16:51 -08:00
Lucas ManningandgVisor bot 2267c24a41 Add support for custom socket options and setting the experiment IP option.
PiperOrigin-RevId: 700011458
2024-11-25 09:43:21 -08:00
Etienne PerotandgVisor bot d18a726e96 Unbreak build failures in Kubernetes benchmarks.
This updates the Google Cloud APIs and their Go libraries to their latest
versions, which adds some of the missing fields of the container cluster
service v1 proto that didn't exist in the version defined in `WORKSPACE`.

This also severs the proto import dependency of `test_range_config.proto` on
the container cluster API proto, both because it shouldn't be GKE-specific
but also because the Go genproto version of the container cluster API is
different (from the Go linker's perspective) from the container cluster
proto that is imported from `test_range_config.proto`. Instead, it is
encoded as an "any" proto for both nodepools and clusters.

Go repositories are re-arranged such that the genproto version imported is
taken from the `WORKSPACE` file rather than the one embedded in other Go
repositories earlier in the file.

The version of this API in Go's genproto library is still missing some of
the TPU node placement fields, so that part is filled in via reflection
when available. That is hacky but that codepath only applies to TPU clusters
so not applicable for most benchmarks.

PiperOrigin-RevId: 688682505
2024-10-22 14:05:01 -07:00
Andrei VaginandgVisor bot 2d0a6f7865 tools/bazeldefs: always pass bazel_cgo to go_library
Its value will be known only on the configuration phase,
before that it can be a select directive.

Updates #9266

PiperOrigin-RevId: 678412518
2024-09-24 15:12:58 -07:00
gVisor bot 079c1a937b Merge pull request #9551 from amysaq2023:support-external-stack
PiperOrigin-RevId: 677933413
2024-09-23 14:12:32 -07:00
Etienne PerotandgVisor bot a7dcce9385 go_library wrapper: Add bazel_cgo and cgo-related arguments.
This adds cgo-only arguments passed to `go_library` rules when the
`bazel_cgo` argument is specified and `True`.

Credits go to @avagin for this change.

Updates #9266
Updates #9551

PiperOrigin-RevId: 677085717
2024-09-20 21:41:06 -07:00
Jamie LiuandgVisor bot d463f4e1d2 tcpip: ensure fdbased/mmap_stub.go uses a stateify-recognized suffix
Our Bazel build infrastructure explicitly recognizes some suffixes that can
appear at the end of filenames (tools/bazeldefs/tags.bzl). It uses these tags
to group files passed to go_stateify (tools/defs.bzl:go_library() =>
calculate_sets()).

Each invocation of go_stateify infers build tags from its input files. Before
this CL, all Go files in pkg/tcpip/link/fdbased (except for fdbased_unsafe.go)
are grouped together to generate fdbased_state_autogen.go, so go_stateify
infers builds tags "!linux !amd64,!arm64" (from mmap_stub.go) and "linux ..."
(from most other files); these contradictory build tags mean that
fdbased_state_autogen.go is never actually compiled, preventing its types from
being registered. After this CL, mmap_nonlinux.go independently generates
fdbased_nonlinux_state_autogen.go.

Fixing this causes fdbased_state_autogen.go to be included for the first time,
exposing a second problem:

```
pkg/tcpip/link/fdbased/endpoint_test.go:80:6: context already declared through import of package context ("context")
        .../pkg/tcpip/link/fdbased/fdbased_state_autogen.go:12:2: other declaration of context
```

(Apparently Go imports are a pessimal hybrid of "shared between files in a
package" and "not shared between files in a package".) To fix this, rename the
test type to testContext.

PiperOrigin-RevId: 663522480
2024-08-15 18:05:29 -07:00
Etienne PerotandgVisor bot d3d82abdc4 gVisor: Run runtime tests locally by default.
PiperOrigin-RevId: 621350009
2024-04-02 18:05:57 -07:00
Jing ChenandgVisor bot db85b6316f Fix Copybara's non-reversible transformations in gVisor.
PiperOrigin-RevId: 619663125
2024-03-27 14:47:38 -07:00
Nayana BidariandgVisor bot 568434b397 Enable S/R for all syscall tests.
Enable S/R by default for all syscall tests.

PiperOrigin-RevId: 607116892
2024-02-14 15:05:19 -08:00
gVisor bot e21ac5489e Change some test targets to use select_gtest() to return the gtest target.
Should be a no-op as select_gtest() returns the same target as before.

PiperOrigin-RevId: 606760041
2024-02-13 15:08:47 -08:00
Kevin KrakauerandgVisor bot dc40c49df4 images: use mulitarch default image instead of hacky workaround
Instead of lying to clang about the targeted system, we can install the
necessary package only on x86_64 machines. Our tooling supports multiarch
packages (see tools/images.mk).

PiperOrigin-RevId: 591385576
2023-12-15 16:14:40 -08:00
Kevin KrakauerandgVisor bot 2ae19ffb72 xdp: install libbpf-dev and work around arch build issue
PiperOrigin-RevId: 590826409
2023-12-13 23:00:29 -08:00
Andrei VaginandgVisor bot 4b00385927 tests: don't change malloc for tests
system_malloc is causing test flakes.

The issue with tcmalloc is it isn't fork-safe and any allocations in forked
sub-processes can stuck.

PiperOrigin-RevId: 581372831
2023-11-10 14:38:59 -08:00
Andrei VaginandgVisor bot b92f900240 tests: change the default platfrom from ptrace to systrap
PiperOrigin-RevId: 578944483
2023-11-02 12:35:46 -07:00
gVisor bot 7594667507 Internal change.
PiperOrigin-RevId: 568695436
2023-09-26 17:35:33 -07:00
Lucas ManningandgVisor bot ad275a100e Fix debug builds.
This change also adds instructions for using a debugger with syscall tests.

Fixes #9039

PiperOrigin-RevId: 563576842
2023-09-07 16:28:00 -07:00
Andrei Vagin a95d591ab9 Stop using go_embed_data
It will be depricated in the next rules_go.
2023-03-08 15:05:58 -08:00
Adin ScannellandgVisor bot 1ceb814544 Add default_applicable_licenses rules to packages.
PiperOrigin-RevId: 513581243
2023-03-02 10:50:04 -08:00
Ayush RanjanandgVisor bot a625ba1d0a Use build tags to conditionally enable vfs.checkInvariants.
We don't want these checks in the production binary at all. Even though the
hardware branch predictor will do away with any runtime costs of the if
condition, the code under the "if checkInvariants {...}" could force escapes
to the heap. It could also increase function complexity, making it no longer
inlinable. And these invariant checks lie on hot code paths.

PiperOrigin-RevId: 513398208
2023-03-01 18:32:51 -08:00
Andrei VaginandgVisor bot 192bfb03fb Open-sourcing the systrap platform.
The systrap platform like the ptrace platform uses stub processes to manage
the user address space. The difference is how they intercept system calls and
other events like memory faults, exceptions, etc.

In case of systrap, all events that have to be handled by the Sentry trigger
signals that are handled by a custom signal handler installed on stub
processes. The signal handler switches control to the Sentry.

Here are a few other optimizations:
* On x86, system calls can be replaced with a function call to remove overhead
  of signals.
* For fast interactions of sentry and stub processes, futex wait/wake can
  be a bottle neck, so we use a polling mode.

The platform is launched for the purpose of testing and gathering initial
feedback. It is not yet ready for use in production.

PiperOrigin-RevId: 511650064
2023-02-22 18:22:49 -08:00
Adin ScannellandgVisor bot 6a4908b262 Process nogo targets across all architectures.
PiperOrigin-RevId: 511343590
2023-02-21 17:06:02 -08:00
Ayush RanjanandgVisor bot 7b8b9527ef Statically link benchmark test binaries.
After update to Go 1.20 in 5572ab2f7d ("Bump go version to 1.20"), the
benchmark jobs have been failing on BuildKite. This seems to be happening
because benchmark test binaries are built in Docker containers but are run on
the host. On some hosts, the glibc isn't compatible with glibc in our docker
container. So dynamically linked binaries may fail. Linking them statically
resolves this glibc compatibility issue.

As a result, this change also adds support for static test binaries to
tools/bazeldefs/go.bzl.

PiperOrigin-RevId: 510455271
2023-02-17 09:59:36 -08:00
Andrei Vagin 5572ab2f7d Bump go version to 1.20
Signed-off-by: Andrei Vagin <avagin@gmail.com>
2023-02-10 08:32:17 -08:00