Merge branch 'master' into iptables-1-pkg

Change-Id: I7457a11de4725e1bf3811420c505d225b1cb6943
This commit is contained in:
Kevin Krakauer
2019-06-12 15:21:22 -07:00
216 changed files with 9020 additions and 4728 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright 2019 Google LLC
# Copyright 2019 The gVisor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
+7
View File
@@ -1,6 +1,7 @@
package(licenses = ["notice"]) # Apache 2.0
load("@io_bazel_rules_go//go:def.bzl", "go_path")
load("@bazel_gazelle//:def.bzl", "gazelle")
# The sandbox filegroup is used for sandbox-internal dependencies.
package_group(
@@ -22,3 +23,9 @@ go_path(
"//runsc",
],
)
# gazelle is a set of build tools.
#
# To update the WORKSPACE from go.mod, use:
# bazel run //:gazelle -- update-repos -from_file=go.mod
gazelle(name = "gazelle")
+4 -3
View File
@@ -1,5 +1,8 @@
![gVisor](g3doc/logo.png)
[![Status](https://storage.googleapis.com/gvisor-build-badges/build.svg)](https://storage.googleapis.com/gvisor-build-badges/build.html)
[![gVisor chat](https://badges.gitter.im/gvisor/community.png)](https://gitter.im/gvisor/community)
## What is gVisor?
**gVisor** is a user-space kernel, written in Go, that implements a substantial
@@ -36,8 +39,6 @@ be found at [gvisor.dev][gvisor-dev].
## Installing from source
[![Status](https://storage.googleapis.com/gvisor-build-badges/build.svg)](https://storage.googleapis.com/gvisor-build-badges/build.html)
gVisor currently requires x86\_64 Linux to build, though support for other
architectures may become available in the future.
@@ -83,7 +84,7 @@ sudo cp ./bazel-bin/runsc/linux_amd64_pure_stripped/runsc /usr/local/bin
The test suite can be run with Bazel:
```
bazel test ...
bazel test //...
```
or in a Docker container:
+49 -18
View File
@@ -6,6 +6,7 @@ http_archive(
sha256 = "a82a352bffae6bee4e95f68a8d80a70e87f42c4741e6a448bec11998fcc82329",
url = "https://github.com/bazelbuild/rules_go/releases/download/0.18.5/rules_go-0.18.5.tar.gz",
)
http_archive(
name = "bazel_gazelle",
sha256 = "3c681998538231a2d24d0c07ed5a7658cb72bfb5fd4bf9911157c0e9ac6a2687",
@@ -37,86 +38,116 @@ http_archive(
# External repositories, in sorted order.
go_repository(
name = "com_github_cenkalti_backoff",
commit = "66e726b43552c0bab0539b28e640b89fd6862115",
commit = "2146c9339422",
importpath = "github.com/cenkalti/backoff",
)
go_repository(
name = "com_github_gofrs_flock",
commit = "886344bea0798d02ff3fae16a922be5f6b26cee0",
commit = "886344bea079",
importpath = "github.com/gofrs/flock",
)
go_repository(
name = "com_github_golang_mock",
commit = "600781dde9cca80734169b9e969d9054ccc57937",
importpath = "github.com/golang/mock",
tag = "v1.3.1",
)
go_repository(
name = "com_github_google_go-cmp",
commit = "3af367b6b30c263d47e8895973edcca9a49cf029",
importpath = "github.com/google/go-cmp",
tag = "v0.2.0",
)
go_repository(
name = "com_github_google_subcommands",
commit = "ce3d4cfc062faac7115d44e5befec8b5a08c3faa",
commit = "636abe8753b8",
importpath = "github.com/google/subcommands",
)
go_repository(
name = "com_github_google_uuid",
commit = "dec09d789f3dba190787f8b4454c7d3c936fed9e",
commit = "dec09d789f3d",
importpath = "github.com/google/uuid",
)
go_repository(
name = "com_github_kr_pty",
commit = "282ce0e5322c82529687d609ee670fac7c7d917c",
importpath = "github.com/kr/pty",
tag = "v1.1.1",
)
go_repository(
name = "com_github_opencontainers_runtime-spec",
commit = "b2d941ef6a780da2d9982c1fb28d77ad97f54fc7",
commit = "b2d941ef6a78",
importpath = "github.com/opencontainers/runtime-spec",
)
go_repository(
name = "com_github_syndtr_gocapability",
commit = "d98352740cb2c55f81556b63d4a1ec64c5a319c2",
commit = "d98352740cb2",
importpath = "github.com/syndtr/gocapability",
)
go_repository(
name = "com_github_vishvananda_netlink",
commit = "adb577d4a45e341da53c4d9196ad4222c9a23e69",
commit = "adb577d4a45e",
importpath = "github.com/vishvananda/netlink",
)
go_repository(
name = "com_github_vishvananda_netns",
commit = "be1fbeda19366dea804f00efff2dd73a1642fdcc",
commit = "be1fbeda1936",
importpath = "github.com/vishvananda/netns",
)
go_repository(
name = "org_golang_x_crypto",
commit = "c2843e01d9a2",
importpath = "golang.org/x/crypto",
)
go_repository(
name = "org_golang_x_net",
commit = "b3c676e531a6dc479fa1b35ac961c13f5e2b4d2e",
commit = "d8887717615a",
importpath = "golang.org/x/net",
)
go_repository(
name = "org_golang_x_text",
importpath = "golang.org/x/text",
tag = "v0.3.0",
)
go_repository(
name = "org_golang_x_tools",
commit = "36563e24a262",
importpath = "golang.org/x/tools",
)
go_repository(
name = "org_golang_x_sync",
commit = "112230192c58",
importpath = "golang.org/x/sync",
)
go_repository(
name = "org_golang_x_sys",
commit = "0dd5e194bbf5eb84a39666eb4c98a4d007e4203a",
commit = "d0b11bdaac8a",
importpath = "golang.org/x/sys",
)
go_repository(
name = "com_github_google_btree",
commit = "4030bb1f1f0c35b30ca7009e9ebd06849dd45306",
importpath = "github.com/google/btree",
tag = "v1.0.0",
)
go_repository(
name = "com_github_golang_protobuf",
importpath = "github.com/golang/protobuf",
tag = "v1.3.1",
)
# System Call test dependencies.
@@ -142,10 +173,10 @@ http_archive(
http_archive(
name = "com_google_googletest",
sha256 = "574e884a41f0a9b76f849a5cdd89c393651e7537e5daa725cf12511232cbd74b",
strip_prefix = "googletest-61cdca569b1f7e4629f8b949f0a9606c28281a6b",
sha256 = "db657310d3c5ca2d3f674e3a4b79718d1d39da70604568ee0568ba8e39065ef4",
strip_prefix = "googletest-31200def0dec8a624c861f919e86e4444e6e6ee7",
urls = [
"https://mirror.bazel.build/github.com/google/googletest/archive/61cdca569b1f7e4629f8b949f0a9606c28281a6b.tar.gz",
"https://github.com/google/googletest/archive/61cdca569b1f7e4629f8b949f0a9606c28281a6b.tar.gz",
"https://mirror.bazel.build/github.com/google/googletest/archive/31200def0dec8a624c861f919e86e4444e6e6ee7.tar.gz",
"https://github.com/google/googletest/archive/31200def0dec8a624c861f919e86e4444e6e6ee7.tar.gz",
],
)
+2
View File
@@ -0,0 +1,2 @@
FROM ubuntu
RUN apt-get -q update && apt-get install -qqy git rsync
+22
View File
@@ -0,0 +1,22 @@
steps:
- name: 'gcr.io/cloud-builders/git'
args: ['fetch', '--all', '--unshallow']
- name: 'gcr.io/cloud-builders/bazel'
args: ['build', ':gopath']
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/go-branch', '-f', 'cloudbuild/go.Dockerfile', '.']
- name: 'gcr.io/$PROJECT_ID/go-branch'
args: ['tools/go_branch.sh']
- name: 'gcr.io/cloud-builders/git'
args: ['checkout', 'go']
- name: 'gcr.io/cloud-builders/git'
args: ['clean', '-f']
- name: 'golang'
args: ['go', 'build', './...']
- name: 'gcr.io/cloud-builders/git'
entrypoint: 'bash'
args:
- '-c'
- 'if [[ "$BRANCH_NAME" == "master" ]]; then git push "${_ORIGIN}" go:go; fi'
substitutions:
_ORIGIN: origin
+21
View File
@@ -0,0 +1,21 @@
module gvisor.googlesource.com/gvisor
go 1.12
require (
github.com/cenkalti/backoff v0.0.0-20190506075156-2146c9339422
github.com/gofrs/flock v0.6.1-0.20180915234121-886344bea079
github.com/golang/mock v1.3.1
github.com/golang/protobuf v1.3.1
github.com/google/btree v1.0.0
github.com/google/go-cmp v0.2.0
github.com/google/subcommands v0.0.0-20190508160503-636abe8753b8
github.com/google/uuid v0.0.0-20171129191014-dec09d789f3d
github.com/kr/pty v1.1.1
github.com/opencontainers/runtime-spec v0.1.2-0.20171211145439-b2d941ef6a78
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2
github.com/vishvananda/netlink v1.0.1-0.20190318003149-adb577d4a45e
github.com/vishvananda/netns v0.0.0-20171111001504-be1fbeda1936
golang.org/x/net v0.0.0-20190311183353-d8887717615a
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
)
+1 -1
View File
@@ -11,7 +11,7 @@ before_action {
# Configure bazel to access RBE.
bazel_setting {
# Our GCP project name
project_id: "copybara-shentu"
project_id: "gvisor-rbe"
# Use RBE for execution as well as caching.
local_execution: false
-42
View File
@@ -1,42 +0,0 @@
#!/bin/bash
# Copyright 2018 The gVisor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Fail on any error.
set -e
# Display commands to stderr.
set -x
# Install the latest version of Bazel.
use_bazel.sh latest
# Log the bazel path and version.
which bazel
bazel version
cd git/repo
# Build runsc.
bazel build //runsc
# Move the runsc binary into "latest" directory, and also a directory with the
# current date.
latest_dir="${KOKORO_ARTIFACTS_DIR}"/latest
today_dir="${KOKORO_ARTIFACTS_DIR}"/"$(date -Idate)"
mkdir -p "${latest_dir}" "${today_dir}"
cp bazel-bin/runsc/linux_amd64_pure_stripped/runsc "${latest_dir}"
sha512sum "${latest_dir}"/runsc | awk '{print $1 " runsc"}' > "${latest_dir}"/runsc.sha512
cp bazel-bin/runsc/linux_amd64_pure_stripped/runsc "${today_dir}"
sha512sum "${today_dir}"/runsc | awk '{print $1 " runsc"}' > "${today_dir}"/runsc.sha512
+1
View File
@@ -0,0 +1 @@
../tools/run_build.sh
-258
View File
@@ -1,258 +0,0 @@
#!/bin/bash
# Copyright 2018 The gVisor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Fail on any error. Treat unset variables as error. Print commands as executed.
set -eux
###################
# GLOBAL ENV VARS #
###################
readonly WORKSPACE_DIR="${PWD}/git/repo"
# Used to configure RBE.
readonly CLOUD_PROJECT_ID="copybara-shentu"
readonly RBE_PROJECT_ID="projects/${CLOUD_PROJECT_ID}/instances/default_instance"
# Random runtime name to avoid collisions.
readonly RUNTIME="runsc_test_$((RANDOM))"
# Packages that will be built and tested.
readonly BUILD_PACKAGES=("//...")
readonly TEST_PACKAGES=("//pkg/..." "//runsc/..." "//tools/...")
#######################
# BAZEL CONFIGURATION #
#######################
# Install the latest version of Bazel, and log the location and version.
use_bazel.sh latest
which bazel
bazel version
# Load the kvm module
sudo -n -E modprobe kvm
# General Bazel build/test flags.
BAZEL_BUILD_FLAGS=(
"--show_timestamps"
"--test_output=errors"
"--keep_going"
"--verbose_failures=true"
)
# Bazel build/test for RBE, a super-set of BAZEL_BUILD_FLAGS.
BAZEL_BUILD_RBE_FLAGS=(
"${BAZEL_BUILD_FLAGS[@]}"
"--config=remote"
"--project_id=${CLOUD_PROJECT_ID}"
"--remote_instance_name=${RBE_PROJECT_ID}"
"--auth_credentials=${KOKORO_BAZEL_AUTH_CREDENTIAL}"
)
####################
# Helper Functions #
####################
build_everything() {
FLAVOR="${1}"
cd ${WORKSPACE_DIR}
bazel build \
-c "${FLAVOR}" "${BAZEL_BUILD_RBE_FLAGS[@]}" \
"${BUILD_PACKAGES[@]}"
}
# Run simple tests runs the tests that require no special setup or
# configuration.
run_simple_tests() {
cd ${WORKSPACE_DIR}
bazel test \
"${BAZEL_BUILD_FLAGS[@]}" \
"${TEST_PACKAGES[@]}"
}
install_runtime() {
cd ${WORKSPACE_DIR}
sudo -n ${WORKSPACE_DIR}/runsc/test/install.sh --runtime ${RUNTIME}
}
# Install dependencies for the crictl tests.
install_crictl_test_deps() {
# Install containerd.
sudo -n -E apt-get update
sudo -n -E apt-get install -y btrfs-tools libseccomp-dev
# go get will exit with a status of 1 despite succeeding, so ignore errors.
go get -d github.com/containerd/containerd || true
cd ${GOPATH}/src/github.com/containerd/containerd
git checkout v1.2.2
make
sudo -n -E make install
# Install crictl.
# go get will exit with a status of 1 despite succeeding, so ignore errors.
go get -d github.com/kubernetes-sigs/cri-tools || true
cd ${GOPATH}/src/github.com/kubernetes-sigs/cri-tools
git checkout tags/v1.11.0
make
sudo -n -E make install
# Install gvisor-containerd-shim.
local latest=/tmp/gvisor-containerd-shim-latest
local shim_path=/tmp/gvisor-containerd-shim
wget --no-verbose https://storage.googleapis.com/cri-containerd-staging/gvisor-containerd-shim/latest -O ${latest}
wget --no-verbose https://storage.googleapis.com/cri-containerd-staging/gvisor-containerd-shim/gvisor-containerd-shim-$(cat ${latest}) -O ${shim_path}
chmod +x ${shim_path}
sudo -n -E mv ${shim_path} /usr/local/bin
# Configure containerd-shim.
local shim_config_path=/etc/containerd
local shim_config_tmp_path=/tmp/gvisor-containerd-shim.toml
sudo -n -E mkdir -p ${shim_config_path}
cat > ${shim_config_tmp_path} <<-EOF
runc_shim = "/usr/local/bin/containerd-shim"
[runsc_config]
debug = "true"
debug-log = "/tmp/runsc-logs/"
strace = "true"
file-access = "shared"
EOF
sudo mv ${shim_config_tmp_path} ${shim_config_path}
# Configure CNI.
sudo -n -E env PATH=${PATH} ${GOPATH}/src/github.com/containerd/containerd/script/setup/install-cni
}
# Run the tests that require docker.
run_docker_tests() {
cd ${WORKSPACE_DIR}
# Run tests with a default runtime (runc).
bazel test \
"${BAZEL_BUILD_FLAGS[@]}" \
--test_env=RUNSC_RUNTIME="" \
--test_output=all \
//runsc/test/image:image_test
# These names are used to exclude tests not supported in certain
# configuration, e.g. save/restore not supported with hostnet.
declare -a variations=("" "-kvm" "-hostnet" "-overlay")
for v in "${variations[@]}"; do
# Run runsc tests with docker that are tagged manual.
bazel test \
"${BAZEL_BUILD_FLAGS[@]}" \
--test_env=RUNSC_RUNTIME="${RUNTIME}${v}" \
--test_output=all \
//runsc/test/image:image_test \
//runsc/test/integration:integration_test
done
}
# Run the tests that require root.
run_root_tests() {
cd ${WORKSPACE_DIR}
bazel build //runsc/test/root:root_test
local root_test=$(find -L ./bazel-bin/ -executable -type f -name root_test | grep __main__)
if [[ ! -f "${root_test}" ]]; then
echo "root_test executable not found"
exit 1
fi
sudo -n -E RUNSC_RUNTIME="${RUNTIME}" RUNSC_EXEC=/tmp/"${RUNTIME}"/runsc ${root_test}
}
# Run syscall unit tests.
run_syscall_tests() {
cd ${WORKSPACE_DIR}
bazel test "${BAZEL_BUILD_RBE_FLAGS[@]}" \
--test_tag_filters=runsc_ptrace //test/syscalls/...
}
run_runsc_do_tests() {
local runsc=$(find bazel-bin/runsc -type f -executable -name "runsc" | head -n1)
# run runsc do without root privileges.
unshare -Ur ${runsc} --network=none --TESTONLY-unsafe-nonroot do true
unshare -Ur ${runsc} --TESTONLY-unsafe-nonroot --network=host do --netns=false true
# run runsc do with root privileges.
sudo -n -E ${runsc} do true
}
# Find and rename all test xml and log files so that Sponge can pick them up.
# XML files must be named sponge_log.xml, and log files must be named
# sponge_log.log. We move all such files into KOKORO_ARTIFACTS_DIR, in a
# subdirectory named with the test name.
upload_test_artifacts() {
cd ${WORKSPACE_DIR}
find -L "bazel-testlogs" -name "test.xml" -o -name "test.log" -o -name "outputs.zip" |
tar --create --files-from - --transform 's/test\./sponge_log./' |
tar --extract --directory ${KOKORO_ARTIFACTS_DIR}
if [[ -d "/tmp/${RUNTIME}/logs" ]]; then
tar --create --gzip "--file=${KOKORO_ARTIFACTS_DIR}/runsc-logs.tar.gz" -C /tmp/ ${RUNTIME}/logs
fi
}
# Finish runs at exit, even in the event of an error, and uploads all test
# artifacts.
finish() {
# Grab the last exit code, we will return it.
local exit_code=${?}
upload_test_artifacts
exit ${exit_code}
}
# Run bazel in a docker container
build_in_docker() {
cd ${WORKSPACE_DIR}
bazel clean
bazel shutdown
make
make runsc
make bazel-shutdown
}
########
# MAIN #
########
main() {
# Register finish to run at exit.
trap finish EXIT
# Build and run the simple tests.
build_everything opt
run_simple_tests
# So far so good. Install more deps and run the integration tests.
install_runtime
install_crictl_test_deps
run_docker_tests
run_root_tests
run_syscall_tests
run_runsc_do_tests
# Build other flavors too.
build_everything dbg
build_in_docker
# No need to call "finish" here, it will happen at exit.
}
# Kick it off.
main
+1
View File
@@ -0,0 +1 @@
../tools/run_tests.sh
+84
View File
@@ -69,6 +69,90 @@ func (cp Capability) Ok() bool {
return cp >= 0 && cp <= MaxCapability
}
// String returns the capability name.
func (cp Capability) String() string {
switch cp {
case CAP_CHOWN:
return "CAP_CHOWN"
case CAP_DAC_OVERRIDE:
return "CAP_DAC_OVERRIDE"
case CAP_DAC_READ_SEARCH:
return "CAP_DAC_READ_SEARCH"
case CAP_FOWNER:
return "CAP_FOWNER"
case CAP_FSETID:
return "CAP_FSETID"
case CAP_KILL:
return "CAP_KILL"
case CAP_SETGID:
return "CAP_SETGID"
case CAP_SETUID:
return "CAP_SETUID"
case CAP_SETPCAP:
return "CAP_SETPCAP"
case CAP_LINUX_IMMUTABLE:
return "CAP_LINUX_IMMUTABLE"
case CAP_NET_BIND_SERVICE:
return "CAP_NET_BIND_SERVICE"
case CAP_NET_BROADCAST:
return "CAP_NET_BROADCAST"
case CAP_NET_ADMIN:
return "CAP_NET_ADMIN"
case CAP_NET_RAW:
return "CAP_NET_RAW"
case CAP_IPC_LOCK:
return "CAP_IPC_LOCK"
case CAP_IPC_OWNER:
return "CAP_IPC_OWNER"
case CAP_SYS_MODULE:
return "CAP_SYS_MODULE"
case CAP_SYS_RAWIO:
return "CAP_SYS_RAWIO"
case CAP_SYS_CHROOT:
return "CAP_SYS_CHROOT"
case CAP_SYS_PTRACE:
return "CAP_SYS_PTRACE"
case CAP_SYS_PACCT:
return "CAP_SYS_PACCT"
case CAP_SYS_ADMIN:
return "CAP_SYS_ADMIN"
case CAP_SYS_BOOT:
return "CAP_SYS_BOOT"
case CAP_SYS_NICE:
return "CAP_SYS_NICE"
case CAP_SYS_RESOURCE:
return "CAP_SYS_RESOURCE"
case CAP_SYS_TIME:
return "CAP_SYS_TIME"
case CAP_SYS_TTY_CONFIG:
return "CAP_SYS_TTY_CONFIG"
case CAP_MKNOD:
return "CAP_MKNOD"
case CAP_LEASE:
return "CAP_LEASE"
case CAP_AUDIT_WRITE:
return "CAP_AUDIT_WRITE"
case CAP_AUDIT_CONTROL:
return "CAP_AUDIT_CONTROL"
case CAP_SETFCAP:
return "CAP_SETFCAP"
case CAP_MAC_OVERRIDE:
return "CAP_MAC_OVERRIDE"
case CAP_MAC_ADMIN:
return "CAP_MAC_ADMIN"
case CAP_SYSLOG:
return "CAP_SYSLOG"
case CAP_WAKE_ALARM:
return "CAP_WAKE_ALARM"
case CAP_BLOCK_SUSPEND:
return "CAP_BLOCK_SUSPEND"
case CAP_AUDIT_READ:
return "CAP_AUDIT_READ"
default:
return "UNKNOWN"
}
}
// Version numbers used by the capget/capset syscalls, defined in Linux's
// include/uapi/linux/capability.h.
const (
+9
View File
@@ -114,3 +114,12 @@ const (
MPOL_MODE_FLAGS = (MPOL_F_STATIC_NODES | MPOL_F_RELATIVE_NODES)
)
// Flags for mbind(2).
const (
MPOL_MF_STRICT = 1 << 0
MPOL_MF_MOVE = 1 << 1
MPOL_MF_MOVE_ALL = 1 << 2
MPOL_MF_VALID = MPOL_MF_STRICT | MPOL_MF_MOVE | MPOL_MF_MOVE_ALL
)
+7
View File
@@ -155,3 +155,10 @@ const (
ARCH_GET_GS = 0x1004
ARCH_SET_CPUID = 0x1012
)
// Flags for prctl(PR_SET_DUMPABLE), defined in include/linux/sched/coredump.h.
const (
SUID_DUMP_DISABLE = 0
SUID_DUMP_USER = 1
SUID_DUMP_ROOT = 2
)
+27 -7
View File
@@ -102,15 +102,19 @@ const (
SOL_NETLINK = 270
)
// A SockType is a type (as opposed to family) of sockets. These are enumerated
// below as SOCK_* constants.
type SockType int
// Socket types, from linux/net.h.
const (
SOCK_STREAM = 1
SOCK_DGRAM = 2
SOCK_RAW = 3
SOCK_RDM = 4
SOCK_SEQPACKET = 5
SOCK_DCCP = 6
SOCK_PACKET = 10
SOCK_STREAM SockType = 1
SOCK_DGRAM = 2
SOCK_RAW = 3
SOCK_RDM = 4
SOCK_SEQPACKET = 5
SOCK_DCCP = 6
SOCK_PACKET = 10
)
// SOCK_TYPE_MASK covers all of the above socket types. The remaining bits are
@@ -200,6 +204,22 @@ const (
SS_DISCONNECTING = 4 // In process of disconnecting.
)
// TCP protocol states, from include/net/tcp_states.h.
const (
TCP_ESTABLISHED uint32 = iota + 1
TCP_SYN_SENT
TCP_SYN_RECV
TCP_FIN_WAIT1
TCP_FIN_WAIT2
TCP_TIME_WAIT
TCP_CLOSE
TCP_CLOSE_WAIT
TCP_LAST_ACK
TCP_LISTEN
TCP_CLOSING
TCP_NEW_SYN_RECV
)
// SockAddrMax is the maximum size of a struct sockaddr, from
// uapi/linux/socket.h.
const SockAddrMax = 128
+11
View File
@@ -0,0 +1,11 @@
load("//tools/go_stateify:defs.bzl", "go_library")
package(licenses = ["notice"])
go_library(
name = "memutil",
srcs = ["memutil_unsafe.go"],
importpath = "gvisor.googlesource.com/gvisor/pkg/memutil",
visibility = ["//visibility:public"],
deps = ["@org_golang_x_sys//unix:go_default_library"],
)
@@ -12,6 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// +build linux
// Package memutil provides a wrapper for the memfd_create() system call.
package memutil
import (
@@ -9,8 +9,8 @@ go_library(
"procid_amd64.s",
"procid_arm64.s",
],
importpath = "gvisor.googlesource.com/gvisor/pkg/sentry/platform/procid",
visibility = ["//pkg/sentry:internal"],
importpath = "gvisor.googlesource.com/gvisor/pkg/procid",
visibility = ["//visibility:public"],
)
go_test(

Some files were not shown because too many files have changed in this diff Show More