Merge branch 'iptables-write-input-drop' into iptables-write-filter-proto
This commit is contained in:
commit
d51eaa59c0
21
WORKSPACE
21
WORKSPACE
|
@ -290,6 +290,27 @@ go_repository(
|
|||
version = "v1.3.1",
|
||||
)
|
||||
|
||||
go_repository(
|
||||
name = "com_github_google_go-github",
|
||||
importpath = "github.com/google/go-github",
|
||||
sum = "h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY=",
|
||||
version = "v17.0.0",
|
||||
)
|
||||
|
||||
go_repository(
|
||||
name = "org_golang_x_oauth2",
|
||||
importpath = "golang.org/x/oauth2",
|
||||
sum = "h1:pE8b58s1HRDMi8RDc79m0HISf9D4TzseP40cEA6IGfs=",
|
||||
version = "v0.0.0-20191202225959-858c2ad4c8b6",
|
||||
)
|
||||
|
||||
go_repository(
|
||||
name = "com_github_google_go-querystring",
|
||||
importpath = "github.com/google/go-querystring",
|
||||
sum = "h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=",
|
||||
version = "v1.0.0",
|
||||
)
|
||||
|
||||
# System Call test dependencies.
|
||||
http_archive(
|
||||
name = "com_google_absl",
|
||||
|
|
|
@ -5,5 +5,6 @@ py_binary(
|
|||
srcs = ["run.py"],
|
||||
main = "run.py",
|
||||
python_version = "PY3",
|
||||
srcs_version = "PY3",
|
||||
deps = ["//benchmarks/runner"],
|
||||
)
|
||||
|
|
|
@ -24,6 +24,7 @@ py_library(
|
|||
name = "container",
|
||||
srcs = ["container.py"],
|
||||
deps = [
|
||||
"//benchmarks/workloads",
|
||||
requirement("asn1crypto", False),
|
||||
requirement("chardet", False),
|
||||
requirement("certifi", False),
|
||||
|
@ -45,6 +46,7 @@ py_library(
|
|||
"//benchmarks/harness:container",
|
||||
"//benchmarks/harness:ssh_connection",
|
||||
"//benchmarks/harness:tunnel_dispatcher",
|
||||
"//benchmarks/harness/machine_mocks",
|
||||
requirement("asn1crypto", False),
|
||||
requirement("chardet", False),
|
||||
requirement("certifi", False),
|
||||
|
@ -53,6 +55,7 @@ py_library(
|
|||
requirement("idna", False),
|
||||
requirement("ptyprocess", False),
|
||||
requirement("requests", False),
|
||||
requirement("six", False),
|
||||
requirement("urllib3", False),
|
||||
requirement("websocket-client", False),
|
||||
],
|
||||
|
@ -64,7 +67,7 @@ py_library(
|
|||
deps = [
|
||||
"//benchmarks/harness",
|
||||
requirement("bcrypt", False),
|
||||
requirement("cffi", False),
|
||||
requirement("cffi", True),
|
||||
requirement("paramiko", True),
|
||||
requirement("cryptography", False),
|
||||
],
|
||||
|
|
|
@ -20,6 +20,7 @@ py_library(
|
|||
srcs = ["mock_producer.py"],
|
||||
deps = [
|
||||
"//benchmarks/harness:machine",
|
||||
"//benchmarks/harness/machine_producers:gcloud_producer",
|
||||
"//benchmarks/harness/machine_producers:machine_producer",
|
||||
],
|
||||
)
|
||||
|
@ -38,3 +39,42 @@ py_library(
|
|||
name = "gcloud_mock_recorder",
|
||||
srcs = ["gcloud_mock_recorder.py"],
|
||||
)
|
||||
|
||||
py_library(
|
||||
name = "gcloud_producer",
|
||||
srcs = ["gcloud_producer.py"],
|
||||
deps = [
|
||||
"//benchmarks/harness:machine",
|
||||
"//benchmarks/harness/machine_producers:gcloud_mock_recorder",
|
||||
"//benchmarks/harness/machine_producers:machine_producer",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "test_data",
|
||||
srcs = [
|
||||
"testdata/get_five.json",
|
||||
"testdata/get_one.json",
|
||||
],
|
||||
)
|
||||
|
||||
py_library(
|
||||
name = "gcloud_producer_test_lib",
|
||||
srcs = ["gcloud_producer_test.py"],
|
||||
deps = [
|
||||
"//benchmarks/harness/machine_producers:machine_producer",
|
||||
"//benchmarks/harness/machine_producers:mock_producer",
|
||||
],
|
||||
)
|
||||
|
||||
py_test(
|
||||
name = "gcloud_producer_test",
|
||||
srcs = [":gcloud_producer_test_lib"],
|
||||
data = [
|
||||
":test_data",
|
||||
],
|
||||
python_version = "PY3",
|
||||
tags = [
|
||||
"local",
|
||||
],
|
||||
)
|
||||
|
|
|
@ -0,0 +1,250 @@
|
|||
# python3
|
||||
# Copyright 2019 Google LLC
|
||||
#
|
||||
# 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.
|
||||
"""A machine producer which produces machine objects using `gcloud`.
|
||||
|
||||
Machine producers produce valid harness.Machine objects which are backed by
|
||||
real machines. This producer produces those machines on the given user's GCP
|
||||
account using the `gcloud` tool.
|
||||
|
||||
GCloudProducer creates instances on the given GCP account named like:
|
||||
`machine-XXXXXXX-XXXX-XXXX-XXXXXXXXXXXX` in a randomized fashion such that name
|
||||
collisions with user instances shouldn't happen.
|
||||
|
||||
Typical usage example:
|
||||
|
||||
producer = GCloudProducer(args)
|
||||
machines = producer.get_machines(NUM_MACHINES)
|
||||
# run stuff on machines with machines[i].run(CMD)
|
||||
producer.release_machines(NUM_MACHINES)
|
||||
"""
|
||||
import datetime
|
||||
import getpass
|
||||
import json
|
||||
import subprocess
|
||||
import threading
|
||||
from typing import List, Dict, Any
|
||||
import uuid
|
||||
|
||||
from benchmarks.harness import machine
|
||||
from benchmarks.harness.machine_producers import gcloud_mock_recorder
|
||||
from benchmarks.harness.machine_producers import machine_producer
|
||||
|
||||
DEFAULT_USER = getpass.getuser()
|
||||
|
||||
|
||||
class GCloudProducer(machine_producer.MachineProducer):
|
||||
"""Implementation of MachineProducer backed by GCP.
|
||||
|
||||
Produces Machine objects backed by GCP instances.
|
||||
|
||||
Attributes:
|
||||
project: The GCP project name under which to create the machines.
|
||||
ssh_key_path: path to a valid ssh key. See README on vaild ssh keys.
|
||||
image: image name as a string.
|
||||
image_project: image project as a string.
|
||||
zone: string to a valid GCP zone.
|
||||
ssh_user: string of user name for ssh_key
|
||||
ssh_password: string of password for ssh key
|
||||
mock: a mock printer which will print mock data if required. Mock data is
|
||||
recorded output from subprocess calls (returncode, stdout, args).
|
||||
condition: mutex for this class around machine creation and deleteion.
|
||||
"""
|
||||
|
||||
def __init__(self,
|
||||
project: str,
|
||||
ssh_key_path: str,
|
||||
image: str,
|
||||
image_project: str,
|
||||
zone: str,
|
||||
ssh_user: str,
|
||||
mock: gcloud_mock_recorder.MockPrinter = None):
|
||||
self.project = project
|
||||
self.ssh_key_path = ssh_key_path
|
||||
self.image = image
|
||||
self.image_project = image_project
|
||||
self.zone = zone
|
||||
self.ssh_user = ssh_user if ssh_user else DEFAULT_USER
|
||||
self.mock = mock
|
||||
self.condition = threading.Condition()
|
||||
|
||||
def get_machines(self, num_machines: int) -> List[machine.Machine]:
|
||||
"""Returns requested number of machines backed by GCP instances."""
|
||||
if num_machines <= 0:
|
||||
raise ValueError(
|
||||
"Cannot ask for {num} machines!".format(num=num_machines))
|
||||
with self.condition:
|
||||
names = self._get_unique_names(num_machines)
|
||||
self._build_instances(names)
|
||||
instances = self._start_command(names)
|
||||
self._add_ssh_key_to_instances(names)
|
||||
return self._machines_from_instances(instances)
|
||||
|
||||
def release_machines(self, machine_list: List[machine.Machine]):
|
||||
"""Releases the requested number of machines, deleting the instances."""
|
||||
if not machine_list:
|
||||
return
|
||||
with self.condition:
|
||||
cmd = "gcloud compute instances delete --quiet".split(" ")
|
||||
names = [str(m) for m in machine_list]
|
||||
cmd.extend(names)
|
||||
cmd.append("--zone={zone}".format(zone=self.zone))
|
||||
self._run_command(cmd)
|
||||
|
||||
def _machines_from_instances(
|
||||
self, instances: List[Dict[str, Any]]) -> List[machine.Machine]:
|
||||
"""Creates Machine Objects from json data describing created instances."""
|
||||
machines = []
|
||||
for instance in instances:
|
||||
name = instance["name"]
|
||||
kwargs = {
|
||||
"hostname":
|
||||
instance["networkInterfaces"][0]["accessConfigs"][0]["natIP"],
|
||||
"key_path":
|
||||
self.ssh_key_path,
|
||||
"username":
|
||||
self.ssh_user
|
||||
}
|
||||
machines.append(machine.RemoteMachine(name=name, **kwargs))
|
||||
return machines
|
||||
|
||||
def _get_unique_names(self, num_names) -> List[str]:
|
||||
"""Returns num_names unique names based on data from the GCP project."""
|
||||
curr_machines = self._list_machines()
|
||||
curr_names = set([machine["name"] for machine in curr_machines])
|
||||
ret = []
|
||||
while len(ret) < num_names:
|
||||
new_name = "machine-" + str(uuid.uuid4())
|
||||
if new_name not in curr_names:
|
||||
ret.append(new_name)
|
||||
curr_names.update(new_name)
|
||||
return ret
|
||||
|
||||
def _build_instances(self, names: List[str]) -> List[Dict[str, Any]]:
|
||||
"""Creates instances using gcloud command.
|
||||
|
||||
Runs the command `gcloud compute instances create` and returns json data
|
||||
on created instances on success. Creates len(names) instances, one for each
|
||||
name.
|
||||
|
||||
Args:
|
||||
names: list of names of instances to create.
|
||||
|
||||
Returns:
|
||||
List of json data describing created machines.
|
||||
"""
|
||||
if not names:
|
||||
raise ValueError(
|
||||
"_build_instances cannot create instances without names.")
|
||||
cmd = "gcloud compute instances create".split(" ")
|
||||
cmd.extend(names)
|
||||
cmd.extend("--preemptible --image={image} --zone={zone}".format(
|
||||
image=self.image, zone=self.zone).split(" "))
|
||||
if self.image_project:
|
||||
cmd.append("--image-project={project}".format(project=self.image_project))
|
||||
res = self._run_command(cmd)
|
||||
return json.loads(res.stdout)
|
||||
|
||||
def _start_command(self, names):
|
||||
"""Starts instances using gcloud command.
|
||||
|
||||
Runs the command `gcloud compute instances start` on list of instances by
|
||||
name and returns json data on started instances on success.
|
||||
|
||||
Args:
|
||||
names: list of names of instances to start.
|
||||
|
||||
Returns:
|
||||
List of json data describing started machines.
|
||||
"""
|
||||
if not names:
|
||||
raise ValueError("_start_command cannot start empty instance list.")
|
||||
cmd = "gcloud compute instances start".split(" ")
|
||||
cmd.extend(names)
|
||||
cmd.append("--zone={zone}".format(zone=self.zone))
|
||||
cmd.append("--project={project}".format(project=self.project))
|
||||
res = self._run_command(cmd)
|
||||
return json.loads(res.stdout)
|
||||
|
||||
def _add_ssh_key_to_instances(self, names: List[str]) -> None:
|
||||
"""Adds ssh key to instances by calling gcloud ssh command.
|
||||
|
||||
Runs the command `gcloud compute ssh instance_name` on list of images by
|
||||
name. Tries to ssh into given instance
|
||||
|
||||
Args:
|
||||
names: list of machine names to which to add the ssh-key
|
||||
self.ssh_key_path.
|
||||
|
||||
Raises:
|
||||
subprocess.CalledProcessError: when underlying subprocess call returns an
|
||||
error other than 255 (Connection closed by remote host).
|
||||
TimeoutError: when 3 unsuccessful tries to ssh into the host return 255.
|
||||
"""
|
||||
for name in names:
|
||||
cmd = "gcloud compute ssh {name}".format(name=name).split(" ")
|
||||
cmd.append("--ssh-key-file={key}".format(key=self.ssh_key_path))
|
||||
cmd.append("--zone={zone}".format(zone=self.zone))
|
||||
cmd.append("--command=uname")
|
||||
timeout = datetime.timedelta(seconds=5 * 60)
|
||||
start = datetime.datetime.now()
|
||||
while datetime.datetime.now() <= timeout + start:
|
||||
try:
|
||||
self._run_command(cmd)
|
||||
break
|
||||
except subprocess.CalledProcessError as e:
|
||||
if datetime.datetime.now() > timeout + start:
|
||||
raise TimeoutError(
|
||||
"Could not SSH into instance after 5 min: {name}".format(
|
||||
name=name))
|
||||
# 255 is the returncode for ssh connection refused.
|
||||
elif e.returncode == 255:
|
||||
|
||||
continue
|
||||
else:
|
||||
raise e
|
||||
|
||||
def _list_machines(self) -> List[Dict[str, Any]]:
|
||||
"""Runs `list` gcloud command and returns list of Machine data."""
|
||||
cmd = "gcloud compute instances list --project {project}".format(
|
||||
project=self.project).split(" ")
|
||||
res = self._run_command(cmd)
|
||||
return json.loads(res.stdout)
|
||||
|
||||
def _run_command(self, cmd: List[str]) -> subprocess.CompletedProcess:
|
||||
"""Runs command as a subprocess.
|
||||
|
||||
Runs command as subprocess and returns the result.
|
||||
If this has a mock recorder, use the record method to record the subprocess
|
||||
call.
|
||||
|
||||
Args:
|
||||
cmd: command to be run as a list of strings.
|
||||
|
||||
Returns:
|
||||
Completed process object to be parsed by caller.
|
||||
|
||||
Raises:
|
||||
CalledProcessError: if subprocess.run returns an error.
|
||||
"""
|
||||
cmd = cmd + ["--format=json"]
|
||||
res = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
if self.mock:
|
||||
self.mock.record(res)
|
||||
if res.returncode != 0:
|
||||
raise subprocess.CalledProcessError(
|
||||
cmd=res.args,
|
||||
output=res.stdout,
|
||||
stderr=res.stderr,
|
||||
returncode=res.returncode)
|
||||
return res
|
|
@ -0,0 +1,48 @@
|
|||
# python3
|
||||
# Copyright 2019 Google LLC
|
||||
#
|
||||
# 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.
|
||||
"""Tests GCloudProducer using mock data.
|
||||
|
||||
GCloudProducer produces machines using 'get_machines' and 'release_machines'
|
||||
methods. The tests check recorded data (jsonified subprocess.CompletedProcess
|
||||
objects) of the producer producing one and five machines.
|
||||
"""
|
||||
import os
|
||||
import types
|
||||
|
||||
from benchmarks.harness.machine_producers import machine_producer
|
||||
from benchmarks.harness.machine_producers import mock_producer
|
||||
|
||||
TEST_DIR = os.path.dirname(__file__)
|
||||
|
||||
|
||||
def run_get_release(producer: machine_producer.MachineProducer,
|
||||
num_machines: int,
|
||||
validator: types.FunctionType = None):
|
||||
machines = producer.get_machines(num_machines)
|
||||
assert len(machines) == num_machines
|
||||
if validator:
|
||||
validator(machines=machines, cmd="uname -a", workload=None)
|
||||
producer.release_machines(machines)
|
||||
|
||||
|
||||
def test_run_one():
|
||||
mock = mock_producer.MockReader(TEST_DIR + "get_one.json")
|
||||
producer = mock_producer.MockGCloudProducer(mock)
|
||||
run_get_release(producer, 1)
|
||||
|
||||
|
||||
def test_run_five():
|
||||
mock = mock_producer.MockReader(TEST_DIR + "get_five.json")
|
||||
producer = mock_producer.MockGCloudProducer(mock)
|
||||
run_get_release(producer, 5)
|
|
@ -13,9 +13,11 @@
|
|||
# limitations under the License.
|
||||
"""Producers of mocks."""
|
||||
|
||||
from typing import List
|
||||
from typing import List, Any
|
||||
|
||||
from benchmarks.harness import machine
|
||||
from benchmarks.harness.machine_producers import gcloud_mock_recorder
|
||||
from benchmarks.harness.machine_producers import gcloud_producer
|
||||
from benchmarks.harness.machine_producers import machine_producer
|
||||
|
||||
|
||||
|
@ -29,3 +31,22 @@ class MockMachineProducer(machine_producer.MachineProducer):
|
|||
def release_machines(self, machine_list: List[machine.MockMachine]):
|
||||
"""No-op."""
|
||||
return
|
||||
|
||||
|
||||
class MockGCloudProducer(gcloud_producer.GCloudProducer):
|
||||
"""Mocks GCloudProducer for testing purposes."""
|
||||
|
||||
def __init__(self, mock: gcloud_mock_recorder.MockReader, **kwargs):
|
||||
gcloud_producer.GCloudProducer.__init__(
|
||||
self, project="mock", ssh_private_key_path="mock", **kwargs)
|
||||
self.mock = mock
|
||||
|
||||
def _validate_ssh_file(self):
|
||||
pass
|
||||
|
||||
def _run_command(self, cmd):
|
||||
return self.mock.pop(cmd)
|
||||
|
||||
def _machines_from_instances(
|
||||
self, instances: List[Any]) -> List[machine.MockMachine]:
|
||||
return [machine.MockMachine() for _ in instances]
|
||||
|
|
|
@ -0,0 +1,211 @@
|
|||
[
|
||||
{
|
||||
"args": [
|
||||
"gcloud",
|
||||
"compute",
|
||||
"instances",
|
||||
"list",
|
||||
"--project",
|
||||
"project",
|
||||
"--format=json"
|
||||
],
|
||||
"stdout": "[{\"name\":\"name\", \"networkInterfaces\":[{\"accessConfigs\":[{\"natIP\":\"0.0.0.0\"}]}]},{\"name\":\"name\", \"networkInterfaces\":[{\"accessConfigs\":[{\"natIP\":\"0.0.0.0\"}]}]},{\"name\":\"name\", \"networkInterfaces\":[{\"accessConfigs\":[{\"natIP\":\"0.0.0.0\"}]}]},{\"name\":\"name\", \"networkInterfaces\":[{\"accessConfigs\":[{\"natIP\":\"0.0.0.0\"}]}]},{\"name\":\"name\", \"networkInterfaces\":[{\"accessConfigs\":{\"natIP\":\"0.0.0.0\"}]}]}]",
|
||||
"returncode": "0"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"gcloud",
|
||||
"compute",
|
||||
"instances",
|
||||
"create",
|
||||
"machine-42c9bf6e-8d45-4c37-b1c0-7e4fdcf530fc",
|
||||
"machine-5f28f145-cc2d-427d-9cbf-428d164cdb92",
|
||||
"machine-da5859b5-bae6-435d-8005-0202d6f6e065",
|
||||
"machine-880a8a2f-918c-4f9e-a43c-ed3c8e02ea05",
|
||||
"machine-1149147d-71e2-43ea-8fe1-49256e5c441c",
|
||||
"--preemptible",
|
||||
"--image=ubuntu-1910-eoan-v20191204",
|
||||
"--zone=us-west1-b",
|
||||
"--image-project=ubuntu-os-cloud",
|
||||
"--format=json"
|
||||
],
|
||||
"stdout": "[{\"name\":\"name\", \"networkInterfaces\":[{\"accessConfigs\":[{\"natIP\":\"0.0.0.0\"}]}]},{\"name\":\"name\", \"networkInterfaces\":[{\"accessConfigs\":[{\"natIP\":\"0.0.0.0\"}]}]},{\"name\":\"name\", \"networkInterfaces\":[{\"accessConfigs\":[{\"natIP\":\"0.0.0.0\"}]}]},{\"name\":\"name\", \"networkInterfaces\":[{\"accessConfigs\":[{\"natIP\":\"0.0.0.0\"}]}]},{\"name\":\"name\", \"networkInterfaces\":[{\"accessConfigs\":[{\"natIP\":\"0.0.0.0\"}]}]}]",
|
||||
"returncode": "0"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"gcloud",
|
||||
"compute",
|
||||
"instances",
|
||||
"start",
|
||||
"machine-42c9bf6e-8d45-4c37-b1c0-7e4fdcf530fc",
|
||||
"machine-5f28f145-cc2d-427d-9cbf-428d164cdb92",
|
||||
"machine-da5859b5-bae6-435d-8005-0202d6f6e065",
|
||||
"machine-880a8a2f-918c-4f9e-a43c-ed3c8e02ea05",
|
||||
"machine-1149147d-71e2-43ea-8fe1-49256e5c441c",
|
||||
"--zone=us-west1-b",
|
||||
"--project=project",
|
||||
"--format=json"
|
||||
],
|
||||
"stdout": "[{\"name\":\"name\", \"networkInterfaces\":[{\"accessConfigs\":[{\"natIP\":\"0.0.0.0\"}]}]},{\"name\":\"name\", \"networkInterfaces\":[{\"accessConfigs\":[{\"natIP\":\"0.0.0.0\"}]}]},{\"name\":\"name\", \"networkInterfaces\":[{\"accessConfigs\":[{\"natIP\":\"0.0.0.0\"}]}]},{\"name\":\"name\", \"networkInterfaces\":[{\"accessConfigs\":[{\"natIP\":\"0.0.0.0\"}]}]},{\"name\":\"name\", \"networkInterfaces\":[{\"accessConfigs\":[{\"natIP\":\"0.0.0.0\"}]}]}]",
|
||||
"returncode": "0"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"gcloud",
|
||||
"compute",
|
||||
"ssh",
|
||||
"machine-42c9bf6e-8d45-4c37-b1c0-7e4fdcf530fc",
|
||||
"--ssh-key-file=/usr/local/google/home/user/.ssh/benchmark-tools",
|
||||
"--zone=us-west1-b",
|
||||
"--command=uname",
|
||||
"--format=json"
|
||||
],
|
||||
"stdout": "",
|
||||
"returncode": "255"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"gcloud",
|
||||
"compute",
|
||||
"ssh",
|
||||
"machine-42c9bf6e-8d45-4c37-b1c0-7e4fdcf530fc",
|
||||
"--ssh-key-file=/usr/local/google/home/user/.ssh/benchmark-tools",
|
||||
"--zone=us-west1-b",
|
||||
"--command=uname",
|
||||
"--format=json"
|
||||
],
|
||||
"stdout": "",
|
||||
"returncode": "255"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"gcloud",
|
||||
"compute",
|
||||
"ssh",
|
||||
"machine-42c9bf6e-8d45-4c37-b1c0-7e4fdcf530fc",
|
||||
"--ssh-key-file=/usr/local/google/home/user/.ssh/benchmark-tools",
|
||||
"--zone=us-west1-b",
|
||||
"--command=uname",
|
||||
"--format=json"
|
||||
],
|
||||
"stdout": "",
|
||||
"returncode": "255"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"gcloud",
|
||||
"compute",
|
||||
"ssh",
|
||||
"machine-42c9bf6e-8d45-4c37-b1c0-7e4fdcf530fc",
|
||||
"--ssh-key-file=/usr/local/google/home/user/.ssh/benchmark-tools",
|
||||
"--zone=us-west1-b",
|
||||
"--command=uname",
|
||||
"--format=json"
|
||||
],
|
||||
"stdout": "",
|
||||
"returncode": "255"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"gcloud",
|
||||
"compute",
|
||||
"ssh",
|
||||
"machine-42c9bf6e-8d45-4c37-b1c0-7e4fdcf530fc",
|
||||
"--ssh-key-file=/usr/local/google/home/user/.ssh/benchmark-tools",
|
||||
"--zone=us-west1-b",
|
||||
"--command=uname",
|
||||
"--format=json"
|
||||
],
|
||||
"stdout": "",
|
||||
"returncode": "255"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"gcloud",
|
||||
"compute",
|
||||
"ssh",
|
||||
"machine-42c9bf6e-8d45-4c37-b1c0-7e4fdcf530fc",
|
||||
"--ssh-key-file=/usr/local/google/home/user/.ssh/benchmark-tools",
|
||||
"--zone=us-west1-b",
|
||||
"--command=uname",
|
||||
"--format=json"
|
||||
],
|
||||
"stdout": "Linux\n[]\n",
|
||||
"returncode": "0"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"gcloud",
|
||||
"compute",
|
||||
"ssh",
|
||||
"machine-5f28f145-cc2d-427d-9cbf-428d164cdb92",
|
||||
"--ssh-key-file=/usr/local/google/home/user/.ssh/benchmark-tools",
|
||||
"--zone=us-west1-b",
|
||||
"--command=uname",
|
||||
"--format=json"
|
||||
],
|
||||
"stdout": "Linux\n[]\n",
|
||||
"returncode": "0"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"gcloud",
|
||||
"compute",
|
||||
"ssh",
|
||||
"machine-da5859b5-bae6-435d-8005-0202d6f6e065",
|
||||
"--ssh-key-file=/usr/local/google/home/user/.ssh/benchmark-tools",
|
||||
"--zone=us-west1-b",
|
||||
"--command=uname",
|
||||
"--format=json"
|
||||
],
|
||||
"stdout": "Linux\n[]\n",
|
||||
"returncode": "0"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"gcloud",
|
||||
"compute",
|
||||
"ssh",
|
||||
"machine-880a8a2f-918c-4f9e-a43c-ed3c8e02ea05",
|
||||
"--ssh-key-file=/usr/local/google/home/user/.ssh/benchmark-tools",
|
||||
"--zone=us-west1-b",
|
||||
"--command=uname",
|
||||
"--format=json"
|
||||
],
|
||||
"stdout": "Linux\n[]\n",
|
||||
"returncode": "0"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"gcloud",
|
||||
"compute",
|
||||
"ssh",
|
||||
"machine-1149147d-71e2-43ea-8fe1-49256e5c441c",
|
||||
"--ssh-key-file=/usr/local/google/home/user/.ssh/benchmark-tools",
|
||||
"--zone=us-west1-b",
|
||||
"--command=uname",
|
||||
"--format=json"
|
||||
],
|
||||
"stdout": "Linux\n[]\n",
|
||||
"returncode": "0"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"gcloud",
|
||||
"compute",
|
||||
"instances",
|
||||
"delete",
|
||||
"--quiet",
|
||||
"machine-42c9bf6e-8d45-4c37-b1c0-7e4fdcf530fc",
|
||||
"machine-5f28f145-cc2d-427d-9cbf-428d164cdb92",
|
||||
"machine-da5859b5-bae6-435d-8005-0202d6f6e065",
|
||||
"machine-880a8a2f-918c-4f9e-a43c-ed3c8e02ea05",
|
||||
"machine-1149147d-71e2-43ea-8fe1-49256e5c441c",
|
||||
"--zone=us-west1-b",
|
||||
"--format=json"
|
||||
],
|
||||
"stdout": "[]\n",
|
||||
"returncode": "0"
|
||||
}
|
||||
]
|
|
@ -0,0 +1,145 @@
|
|||
[
|
||||
{
|
||||
"args": [
|
||||
"gcloud",
|
||||
"compute",
|
||||
"instances",
|
||||
"list",
|
||||
"--project",
|
||||
"linux-testing-user",
|
||||
"--format=json"
|
||||
],
|
||||
"stdout": "[{\"name\":\"name\", \"networkInterfaces\":[{\"accessConfigs\":[{\"natIP\":\"0.0.0.0\"}]}]}]",
|
||||
|
||||
"returncode": "0"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"gcloud",
|
||||
"compute",
|
||||
"instances",
|
||||
"create",
|
||||
"machine-129dfcf9-b05b-4c16-a4cd-21353b570ddc",
|
||||
"--preemptible",
|
||||
"--image=ubuntu-1910-eoan-v20191204",
|
||||
"--zone=us-west1-b",
|
||||
"--image-project=ubuntu-os-cloud",
|
||||
"--format=json"
|
||||
],
|
||||
"stdout": "[{\"name\":\"name\", \"networkInterfaces\":[{\"accessConfigs\":[{\"natIP\":\"0.0.0.0\"}]}]}]",
|
||||
"returncode": "0"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"gcloud",
|
||||
"compute",
|
||||
"instances",
|
||||
"start",
|
||||
"machine-129dfcf9-b05b-4c16-a4cd-21353b570ddc",
|
||||
"--zone=us-west1-b",
|
||||
"--project=linux-testing-user",
|
||||
"--format=json"
|
||||
],
|
||||
"stdout": "[{\"name\":\"name\", \"networkInterfaces\":[{\"accessConfigs\":[{\"natIP\":\"0.0.0.0\"}]}]}]",
|
||||
|
||||
"returncode": "0"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"gcloud",
|
||||
"compute",
|
||||
"ssh",
|
||||
"machine-129dfcf9-b05b-4c16-a4cd-21353b570ddc",
|
||||
"--ssh-key-file=/usr/local/google/home/user/.ssh/benchmark-tools",
|
||||
"--zone=us-west1-b",
|
||||
"--command=uname",
|
||||
"--format=json"
|
||||
],
|
||||
"stdout": "",
|
||||
"returncode": "255"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"gcloud",
|
||||
"compute",
|
||||
"ssh",
|
||||
"machine-129dfcf9-b05b-4c16-a4cd-21353b570ddc",
|
||||
"--ssh-key-file=/usr/local/google/home/user/.ssh/benchmark-tools",
|
||||
"--zone=us-west1-b",
|
||||
"--command=uname",
|
||||
"--format=json"
|
||||
],
|
||||
"stdout": "",
|
||||
"returncode": "255"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"gcloud",
|
||||
"compute",
|
||||
"ssh",
|
||||
"machine-129dfcf9-b05b-4c16-a4cd-21353b570ddc",
|
||||
"--ssh-key-file=/usr/local/google/home/user/.ssh/benchmark-tools",
|
||||
"--zone=us-west1-b",
|
||||
"--command=uname",
|
||||
"--format=json"
|
||||
],
|
||||
"stdout": "",
|
||||
"returncode": "255"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"gcloud",
|
||||
"compute",
|
||||
"ssh",
|
||||
"machine-129dfcf9-b05b-4c16-a4cd-21353b570ddc",
|
||||
"--ssh-key-file=/usr/local/google/home/user/.ssh/benchmark-tools",
|
||||
"--zone=us-west1-b",
|
||||
"--command=uname",
|
||||
"--format=json"
|
||||
],
|
||||
"stdout": "",
|
||||
"returncode": "255"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"gcloud",
|
||||
"compute",
|
||||
"ssh",
|
||||
"machine-129dfcf9-b05b-4c16-a4cd-21353b570ddc",
|
||||
"--ssh-key-file=/usr/local/google/home/user/.ssh/benchmark-tools",
|
||||
"--zone=us-west1-b",
|
||||
"--command=uname",
|
||||
"--format=json"
|
||||
],
|
||||
"stdout": "",
|
||||
"returncode": "255"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"gcloud",
|
||||
"compute",
|
||||
"ssh",
|
||||
"machine-129dfcf9-b05b-4c16-a4cd-21353b570ddc",
|
||||
"--ssh-key-file=/usr/local/google/home/user/.ssh/benchmark-tools",
|
||||
"--zone=us-west1-b",
|
||||
"--command=uname",
|
||||
"--format=json"
|
||||
],
|
||||
"stdout": "Linux\n[]\n",
|
||||
"returncode": "0"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"gcloud",
|
||||
"compute",
|
||||
"instances",
|
||||
"delete",
|
||||
"--quiet",
|
||||
"machine-129dfcf9-b05b-4c16-a4cd-21353b570ddc",
|
||||
"--zone=us-west1-b",
|
||||
"--format=json"
|
||||
],
|
||||
"stdout": "[]\n",
|
||||
"returncode": "0"
|
||||
}
|
||||
]
|
2
go.mod
2
go.mod
|
@ -9,6 +9,7 @@ require (
|
|||
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/go-github/v28 v28.1.1
|
||||
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
|
||||
|
@ -17,5 +18,6 @@ require (
|
|||
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/oauth2 v0.0.0-20191202225959-858c2ad4c8b6
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
|
||||
)
|
||||
|
|
2
go.sum
2
go.sum
|
@ -4,6 +4,7 @@ github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFU
|
|||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-github/v28 v28.1.1/go.mod h1:bsqJWQX05omyWVmc00nEUql9mhQyv38lDZ8kPZcQVoM=
|
||||
github.com/google/subcommands v0.0.0-20190508160503-636abe8753b8/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk=
|
||||
github.com/google/uuid v0.0.0-20171129191014-dec09d789f3d/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
|
@ -13,6 +14,7 @@ github.com/vishvananda/netlink v1.0.1-0.20190318003149-adb577d4a45e/go.mod h1:+S
|
|||
github.com/vishvananda/netns v0.0.0-20171111001504-be1fbeda1936/go.mod h1:ZjcWmFBXmLKZu9Nxj3WKYEafiSqer2rnvPr0en9UNpI=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
build_file: "repo/scripts/issue_reviver.sh"
|
||||
|
||||
before_action {
|
||||
fetch_keystore {
|
||||
keystore_resource {
|
||||
keystore_config_id: 73898
|
||||
keyname: "kokoro-github-access-token"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
env_vars {
|
||||
key: "KOKORO_GITHUB_ACCESS_TOKEN"
|
||||
value: "73898_kokoro-github-access-token"
|
||||
}
|
|
@ -15,4 +15,5 @@ go_test(
|
|||
size = "small",
|
||||
srcs = ["amutex_test.go"],
|
||||
embed = [":amutex"],
|
||||
deps = ["//pkg/sync"],
|
||||
)
|
||||
|
|
|
@ -15,9 +15,10 @@
|
|||
package amutex
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
type sleeper struct {
|
||||
|
|
|
@ -20,4 +20,5 @@ go_test(
|
|||
size = "small",
|
||||
srcs = ["atomic_bitops_test.go"],
|
||||
embed = [":atomicbitops"],
|
||||
deps = ["//pkg/sync"],
|
||||
)
|
||||
|
|
|
@ -16,8 +16,9 @@ package atomicbitops
|
|||
|
||||
import (
|
||||
"runtime"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
const iterations = 100
|
||||
|
|
|
@ -8,7 +8,10 @@ go_library(
|
|||
srcs = ["compressio.go"],
|
||||
importpath = "gvisor.dev/gvisor/pkg/compressio",
|
||||
visibility = ["//:sandbox"],
|
||||
deps = ["//pkg/binary"],
|
||||
deps = [
|
||||
"//pkg/binary",
|
||||
"//pkg/sync",
|
||||
],
|
||||
)
|
||||
|
||||
go_test(
|
||||
|
|
|
@ -52,9 +52,9 @@ import (
|
|||
"hash"
|
||||
"io"
|
||||
"runtime"
|
||||
"sync"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/binary"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
var bufPool = sync.Pool{
|
||||
|
|
|
@ -9,6 +9,7 @@ go_library(
|
|||
visibility = ["//:sandbox"],
|
||||
deps = [
|
||||
"//pkg/log",
|
||||
"//pkg/sync",
|
||||
"//pkg/unet",
|
||||
"//pkg/urpc",
|
||||
],
|
||||
|
|
|
@ -22,9 +22,9 @@ package server
|
|||
|
||||
import (
|
||||
"os"
|
||||
"sync"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/log"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
"gvisor.dev/gvisor/pkg/unet"
|
||||
"gvisor.dev/gvisor/pkg/urpc"
|
||||
)
|
||||
|
|
|
@ -15,6 +15,7 @@ go_library(
|
|||
deps = [
|
||||
":eventchannel_go_proto",
|
||||
"//pkg/log",
|
||||
"//pkg/sync",
|
||||
"//pkg/unet",
|
||||
"@com_github_golang_protobuf//proto:go_default_library",
|
||||
"@com_github_golang_protobuf//ptypes:go_default_library_gen",
|
||||
|
@ -40,6 +41,7 @@ go_test(
|
|||
srcs = ["event_test.go"],
|
||||
embed = [":eventchannel"],
|
||||
deps = [
|
||||
"//pkg/sync",
|
||||
"@com_github_golang_protobuf//proto:go_default_library",
|
||||
],
|
||||
)
|
||||
|
|
|
@ -22,13 +22,13 @@ package eventchannel
|
|||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"sync"
|
||||
"syscall"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/golang/protobuf/ptypes"
|
||||
pb "gvisor.dev/gvisor/pkg/eventchannel/eventchannel_go_proto"
|
||||
"gvisor.dev/gvisor/pkg/log"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
"gvisor.dev/gvisor/pkg/unet"
|
||||
)
|
||||
|
||||
|
|
|
@ -16,11 +16,11 @@ package eventchannel
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
// testEmitter is an emitter that can be used in tests. It records all events
|
||||
|
|
|
@ -15,4 +15,5 @@ go_test(
|
|||
size = "small",
|
||||
srcs = ["fdchannel_test.go"],
|
||||
embed = [":fdchannel"],
|
||||
deps = ["//pkg/sync"],
|
||||
)
|
||||
|
|
|
@ -17,10 +17,11 @@ package fdchannel
|
|||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"sync"
|
||||
"syscall"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
func TestSendRecvFD(t *testing.T) {
|
||||
|
|
|
@ -11,6 +11,7 @@ go_library(
|
|||
importpath = "gvisor.dev/gvisor/pkg/fdnotifier",
|
||||
visibility = ["//:sandbox"],
|
||||
deps = [
|
||||
"//pkg/sync",
|
||||
"//pkg/waiter",
|
||||
"@org_golang_x_sys//unix:go_default_library",
|
||||
],
|
||||
|
|
|
@ -22,10 +22,10 @@ package fdnotifier
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
"syscall"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
"gvisor.dev/gvisor/pkg/waiter"
|
||||
)
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ go_library(
|
|||
"//pkg/abi/linux",
|
||||
"//pkg/log",
|
||||
"//pkg/memutil",
|
||||
"//pkg/syncutil",
|
||||
"//pkg/sync",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -31,4 +31,5 @@ go_test(
|
|||
"flipcall_test.go",
|
||||
],
|
||||
embed = [":flipcall"],
|
||||
deps = ["//pkg/sync"],
|
||||
)
|
||||
|
|
|
@ -17,7 +17,8 @@ package flipcall
|
|||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
func Example() {
|
||||
|
|
|
@ -16,9 +16,10 @@ package flipcall
|
|||
|
||||
import (
|
||||
"runtime"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
var testPacketWindowSize = pageSize
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
"reflect"
|
||||
"unsafe"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/syncutil"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
// Packets consist of a 16-byte header followed by an arbitrarily-sized
|
||||
|
@ -75,13 +75,13 @@ func (ep *Endpoint) Data() []byte {
|
|||
var ioSync int64
|
||||
|
||||
func raceBecomeActive() {
|
||||
if syncutil.RaceEnabled {
|
||||
syncutil.RaceAcquire((unsafe.Pointer)(&ioSync))
|
||||
if sync.RaceEnabled {
|
||||
sync.RaceAcquire((unsafe.Pointer)(&ioSync))
|
||||
}
|
||||
}
|
||||
|
||||
func raceBecomeInactive() {
|
||||
if syncutil.RaceEnabled {
|
||||
syncutil.RaceReleaseMerge((unsafe.Pointer)(&ioSync))
|
||||
if sync.RaceEnabled {
|
||||
sync.RaceReleaseMerge((unsafe.Pointer)(&ioSync))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,5 +19,6 @@ go_test(
|
|||
],
|
||||
deps = [
|
||||
":gate",
|
||||
"//pkg/sync",
|
||||
],
|
||||
)
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
package gate_test
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/gate"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
func TestBasicEnter(t *testing.T) {
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
load("//tools/go_stateify:defs.bzl", "go_library")
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_test")
|
||||
|
||||
package(licenses = ["notice"])
|
||||
|
||||
go_library(
|
||||
name = "goid",
|
||||
srcs = [
|
||||
"goid.go",
|
||||
"goid_amd64.s",
|
||||
"goid_race.go",
|
||||
"goid_unsafe.go",
|
||||
],
|
||||
importpath = "gvisor.dev/gvisor/pkg/goid",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
go_test(
|
||||
name = "goid_test",
|
||||
size = "small",
|
||||
srcs = [
|
||||
"empty_test.go",
|
||||
"goid_test.go",
|
||||
],
|
||||
embed = [":goid"],
|
||||
)
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2020 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.
|
||||
|
||||
// +build !race
|
||||
|
||||
package goid
|
||||
|
||||
import "testing"
|
||||
|
||||
// TestNothing exists to make the build system happy.
|
||||
func TestNothing(t *testing.T) {}
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright 2020 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.
|
||||
|
||||
// +build !race
|
||||
|
||||
// Package goid provides access to the ID of the current goroutine in
|
||||
// race/gotsan builds.
|
||||
package goid
|
||||
|
||||
// Get returns the ID of the current goroutine.
|
||||
func Get() int64 {
|
||||
panic("unimplemented for non-race builds")
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright 2020 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.
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
// func getg() *g
|
||||
TEXT ·getg(SB),NOSPLIT,$0-8
|
||||
MOVQ (TLS), R14
|
||||
MOVQ R14, ret+0(FP)
|
||||
RET
|
|
@ -0,0 +1,25 @@
|
|||
// Copyright 2020 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.
|
||||
|
||||
// Only available in race/gotsan builds.
|
||||
// +build race
|
||||
|
||||
// Package goid provides access to the ID of the current goroutine in
|
||||
// race/gotsan builds.
|
||||
package goid
|
||||
|
||||
// Get returns the ID of the current goroutine.
|
||||
func Get() int64 {
|
||||
return goid()
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
// Copyright 2020 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.
|
||||
|
||||
// +build race
|
||||
|
||||
package goid
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"sync"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestInitialGoID(t *testing.T) {
|
||||
const max = 10000
|
||||
if id := goid(); id < 0 || id > max {
|
||||
t.Errorf("got goid = %d, want 0 < goid <= %d", id, max)
|
||||
}
|
||||
}
|
||||
|
||||
// TestGoIDSquence verifies that goid returns values which could plausibly be
|
||||
// goroutine IDs. If this test breaks or becomes flaky, the structs in
|
||||
// goid_unsafe.go may need to be updated.
|
||||
func TestGoIDSquence(t *testing.T) {
|
||||
// Goroutine IDs are cached by each P.
|
||||
runtime.GOMAXPROCS(1)
|
||||
|
||||
// Fill any holes in lower range.
|
||||
for i := 0; i < 50; i++ {
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
wg.Done()
|
||||
|
||||
// Leak the goroutine to prevent the ID from being
|
||||
// reused.
|
||||
select {}
|
||||
}()
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
id := goid()
|
||||
for i := 0; i < 100; i++ {
|
||||
var (
|
||||
newID int64
|
||||
wg sync.WaitGroup
|
||||
)
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
newID = goid()
|
||||
wg.Done()
|
||||
|
||||
// Leak the goroutine to prevent the ID from being
|
||||
// reused.
|
||||
select {}
|
||||
}()
|
||||
wg.Wait()
|
||||
if max := id + 100; newID <= id || newID > max {
|
||||
t.Errorf("unexpected goroutine ID pattern, got goid = %d, want %d < goid <= %d (previous = %d)", newID, id, max, id)
|
||||
}
|
||||
id = newID
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
// Copyright 2020 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.
|
||||
|
||||
package goid
|
||||
|
||||
// Structs from Go runtime. These may change in the future and require
|
||||
// updating. These structs are currently the same on both AMD64 and ARM64,
|
||||
// but may diverge in the future.
|
||||
|
||||
type stack struct {
|
||||
lo uintptr
|
||||
hi uintptr
|
||||
}
|
||||
|
||||
type gobuf struct {
|
||||
sp uintptr
|
||||
pc uintptr
|
||||
g uintptr
|
||||
ctxt uintptr
|
||||
ret uint64
|
||||
lr uintptr
|
||||
bp uintptr
|
||||
}
|
||||
|
||||
type g struct {
|
||||
stack stack
|
||||
stackguard0 uintptr
|
||||
stackguard1 uintptr
|
||||
|
||||
_panic uintptr
|
||||
_defer uintptr
|
||||
m uintptr
|
||||
sched gobuf
|
||||
syscallsp uintptr
|
||||
syscallpc uintptr
|
||||
stktopsp uintptr
|
||||
param uintptr
|
||||
atomicstatus uint32
|
||||
stackLock uint32
|
||||
goid int64
|
||||
|
||||
// More fields...
|
||||
//
|
||||
// We only use goid and the fields before it are only listed to
|
||||
// calculate the correct offset.
|
||||
}
|
||||
|
||||
func getg() *g
|
||||
|
||||
// goid returns the ID of the current goroutine.
|
||||
func goid() int64 {
|
||||
return getg().goid
|
||||
}
|
|
@ -8,6 +8,7 @@ go_library(
|
|||
srcs = ["linewriter.go"],
|
||||
importpath = "gvisor.dev/gvisor/pkg/linewriter",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["//pkg/sync"],
|
||||
)
|
||||
|
||||
go_test(
|
||||
|
|
|
@ -17,7 +17,8 @@ package linewriter
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"sync"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
// Writer is an io.Writer which buffers input, flushing
|
||||
|
|
|
@ -16,7 +16,10 @@ go_library(
|
|||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
deps = ["//pkg/linewriter"],
|
||||
deps = [
|
||||
"//pkg/linewriter",
|
||||
"//pkg/sync",
|
||||
],
|
||||
)
|
||||
|
||||
go_test(
|
||||
|
|
|
@ -25,12 +25,12 @@ import (
|
|||
stdlog "log"
|
||||
"os"
|
||||
"runtime"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/linewriter"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
// Level is the log level.
|
||||
|
|
|
@ -14,6 +14,7 @@ go_library(
|
|||
":metric_go_proto",
|
||||
"//pkg/eventchannel",
|
||||
"//pkg/log",
|
||||
"//pkg/sync",
|
||||
],
|
||||
)
|
||||
|
||||
|
|
|
@ -18,12 +18,12 @@ package metric
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/eventchannel"
|
||||
"gvisor.dev/gvisor/pkg/log"
|
||||
pb "gvisor.dev/gvisor/pkg/metric/metric_go_proto"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -29,6 +29,7 @@ go_library(
|
|||
"//pkg/fdchannel",
|
||||
"//pkg/flipcall",
|
||||
"//pkg/log",
|
||||
"//pkg/sync",
|
||||
"//pkg/unet",
|
||||
"@org_golang_x_sys//unix:go_default_library",
|
||||
],
|
||||
|
|
|
@ -17,12 +17,12 @@ package p9
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"sync"
|
||||
"syscall"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
"gvisor.dev/gvisor/pkg/flipcall"
|
||||
"gvisor.dev/gvisor/pkg/log"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
"gvisor.dev/gvisor/pkg/unet"
|
||||
)
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@ go_library(
|
|||
"//pkg/fd",
|
||||
"//pkg/log",
|
||||
"//pkg/p9",
|
||||
"//pkg/sync",
|
||||
"//pkg/unet",
|
||||
"@com_github_golang_mock//gomock:go_default_library",
|
||||
],
|
||||
|
@ -83,6 +84,7 @@ go_test(
|
|||
deps = [
|
||||
"//pkg/fd",
|
||||
"//pkg/p9",
|
||||
"//pkg/sync",
|
||||
"@com_github_golang_mock//gomock:go_default_library",
|
||||
],
|
||||
)
|
||||
|
|
|
@ -22,7 +22,6 @@ import (
|
|||
"os"
|
||||
"reflect"
|
||||
"strings"
|
||||
"sync"
|
||||
"syscall"
|
||||
"testing"
|
||||
"time"
|
||||
|
@ -30,6 +29,7 @@ import (
|
|||
"github.com/golang/mock/gomock"
|
||||
"gvisor.dev/gvisor/pkg/fd"
|
||||
"gvisor.dev/gvisor/pkg/p9"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
func TestPanic(t *testing.T) {
|
||||
|
|
|
@ -17,13 +17,13 @@ package p9test
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"syscall"
|
||||
"testing"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
"gvisor.dev/gvisor/pkg/p9"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
"gvisor.dev/gvisor/pkg/unet"
|
||||
)
|
||||
|
||||
|
|
|
@ -16,7 +16,8 @@ package p9
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
// pathNode is a single node in a path traversal.
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package p9
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
// pool is a simple allocator.
|
||||
|
|
|
@ -17,7 +17,6 @@ package p9
|
|||
import (
|
||||
"io"
|
||||
"runtime/debug"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"syscall"
|
||||
|
||||
|
@ -25,6 +24,7 @@ import (
|
|||
"gvisor.dev/gvisor/pkg/fdchannel"
|
||||
"gvisor.dev/gvisor/pkg/flipcall"
|
||||
"gvisor.dev/gvisor/pkg/log"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
"gvisor.dev/gvisor/pkg/unet"
|
||||
)
|
||||
|
||||
|
|
|
@ -19,11 +19,11 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"sync"
|
||||
"syscall"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/fd"
|
||||
"gvisor.dev/gvisor/pkg/log"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
"gvisor.dev/gvisor/pkg/unet"
|
||||
)
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ go_test(
|
|||
"procid_test.go",
|
||||
],
|
||||
embed = [":procid"],
|
||||
deps = ["//pkg/sync"],
|
||||
)
|
||||
|
||||
go_test(
|
||||
|
@ -31,4 +32,5 @@ go_test(
|
|||
"procid_test.go",
|
||||
],
|
||||
embed = [":procid"],
|
||||
deps = ["//pkg/sync"],
|
||||
)
|
||||
|
|
|
@ -17,9 +17,10 @@ package procid
|
|||
import (
|
||||
"os"
|
||||
"runtime"
|
||||
"sync"
|
||||
"syscall"
|
||||
"testing"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
// runOnMain is used to send functions to run on the main (initial) thread.
|
||||
|
|
|
@ -10,5 +10,8 @@ go_library(
|
|||
],
|
||||
importpath = "gvisor.dev/gvisor/pkg/rand",
|
||||
visibility = ["//:sandbox"],
|
||||
deps = ["@org_golang_x_sys//unix:go_default_library"],
|
||||
deps = [
|
||||
"//pkg/sync",
|
||||
"@org_golang_x_sys//unix:go_default_library",
|
||||
],
|
||||
)
|
||||
|
|
|
@ -19,9 +19,9 @@ package rand
|
|||
import (
|
||||
"crypto/rand"
|
||||
"io"
|
||||
"sync"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
// reader implements an io.Reader that returns pseudorandom bytes.
|
||||
|
|
|
@ -27,6 +27,7 @@ go_library(
|
|||
visibility = ["//:sandbox"],
|
||||
deps = [
|
||||
"//pkg/log",
|
||||
"//pkg/sync",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -35,4 +36,5 @@ go_test(
|
|||
size = "small",
|
||||
srcs = ["refcounter_test.go"],
|
||||
embed = [":refs"],
|
||||
deps = ["//pkg/sync"],
|
||||
)
|
||||
|
|
|
@ -21,10 +21,10 @@ import (
|
|||
"fmt"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/log"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
// RefCounter is the interface to be implemented by objects that are reference
|
||||
|
|
|
@ -16,8 +16,9 @@ package refs
|
|||
|
||||
import (
|
||||
"reflect"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
type testCounter struct {
|
||||
|
|
|
@ -32,6 +32,7 @@ go_library(
|
|||
"//pkg/sentry/context",
|
||||
"//pkg/sentry/limits",
|
||||
"//pkg/sentry/usermem",
|
||||
"//pkg/sync",
|
||||
"//pkg/syserror",
|
||||
],
|
||||
)
|
||||
|
|
|
@ -19,7 +19,6 @@ package arch
|
|||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"sync"
|
||||
"syscall"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/binary"
|
||||
|
@ -27,6 +26,7 @@ import (
|
|||
"gvisor.dev/gvisor/pkg/log"
|
||||
rpb "gvisor.dev/gvisor/pkg/sentry/arch/registers_go_proto"
|
||||
"gvisor.dev/gvisor/pkg/sentry/usermem"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
"gvisor.dev/gvisor/pkg/syserror"
|
||||
)
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ go_library(
|
|||
"//pkg/sentry/strace",
|
||||
"//pkg/sentry/usage",
|
||||
"//pkg/sentry/watchdog",
|
||||
"//pkg/sync",
|
||||
"//pkg/tcpip/link/sniffer",
|
||||
"//pkg/urpc",
|
||||
],
|
||||
|
|
|
@ -19,10 +19,10 @@ import (
|
|||
"runtime"
|
||||
"runtime/pprof"
|
||||
"runtime/trace"
|
||||
"sync"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/fd"
|
||||
"gvisor.dev/gvisor/pkg/sentry/kernel"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
"gvisor.dev/gvisor/pkg/urpc"
|
||||
)
|
||||
|
||||
|
|
|
@ -8,7 +8,10 @@ go_library(
|
|||
srcs = ["device.go"],
|
||||
importpath = "gvisor.dev/gvisor/pkg/sentry/device",
|
||||
visibility = ["//pkg/sentry:internal"],
|
||||
deps = ["//pkg/abi/linux"],
|
||||
deps = [
|
||||
"//pkg/abi/linux",
|
||||
"//pkg/sync",
|
||||
],
|
||||
)
|
||||
|
||||
go_test(
|
||||
|
|
|
@ -19,10 +19,10 @@ package device
|
|||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/abi/linux"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
// Registry tracks all simple devices and related state on the system for
|
||||
|
|
|
@ -68,7 +68,7 @@ go_library(
|
|||
"//pkg/sentry/usage",
|
||||
"//pkg/sentry/usermem",
|
||||
"//pkg/state",
|
||||
"//pkg/syncutil",
|
||||
"//pkg/sync",
|
||||
"//pkg/syserror",
|
||||
"//pkg/waiter",
|
||||
],
|
||||
|
@ -115,6 +115,7 @@ go_test(
|
|||
"//pkg/sentry/fs/tmpfs",
|
||||
"//pkg/sentry/kernel/contexttest",
|
||||
"//pkg/sentry/usermem",
|
||||
"//pkg/sync",
|
||||
"//pkg/syserror",
|
||||
],
|
||||
)
|
||||
|
|
|
@ -17,12 +17,12 @@ package fs
|
|||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"sync"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/log"
|
||||
"gvisor.dev/gvisor/pkg/sentry/context"
|
||||
"gvisor.dev/gvisor/pkg/sentry/memmap"
|
||||
"gvisor.dev/gvisor/pkg/sentry/usermem"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
"gvisor.dev/gvisor/pkg/syserror"
|
||||
)
|
||||
|
||||
|
|
|
@ -19,13 +19,13 @@ import (
|
|||
"crypto/rand"
|
||||
"fmt"
|
||||
"io"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/sentry/fs"
|
||||
_ "gvisor.dev/gvisor/pkg/sentry/fs/tmpfs"
|
||||
"gvisor.dev/gvisor/pkg/sentry/kernel/contexttest"
|
||||
"gvisor.dev/gvisor/pkg/sentry/usermem"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -18,7 +18,6 @@ import (
|
|||
"fmt"
|
||||
"path"
|
||||
"sort"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"syscall"
|
||||
|
||||
|
@ -28,6 +27,7 @@ import (
|
|||
"gvisor.dev/gvisor/pkg/sentry/kernel/auth"
|
||||
"gvisor.dev/gvisor/pkg/sentry/socket/unix/transport"
|
||||
"gvisor.dev/gvisor/pkg/sentry/uniqueid"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
"gvisor.dev/gvisor/pkg/syserror"
|
||||
)
|
||||
|
||||
|
|
|
@ -16,7 +16,8 @@ package fs
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
// DirentCache is an LRU cache of Dirents. The Dirent's refCount is
|
||||
|
|
|
@ -16,7 +16,8 @@ package fs
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
// DirentCacheLimiter acts as a global limit for all dirent caches in the
|
||||
|
|
|
@ -23,6 +23,7 @@ go_library(
|
|||
"//pkg/sentry/fs/fsutil",
|
||||
"//pkg/sentry/safemem",
|
||||
"//pkg/sentry/usermem",
|
||||
"//pkg/sync",
|
||||
"//pkg/syserror",
|
||||
"//pkg/waiter",
|
||||
],
|
||||
|
|
|
@ -17,7 +17,6 @@ package fdpipe
|
|||
|
||||
import (
|
||||
"os"
|
||||
"sync"
|
||||
"syscall"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/fd"
|
||||
|
@ -29,6 +28,7 @@ import (
|
|||
"gvisor.dev/gvisor/pkg/sentry/fs/fsutil"
|
||||
"gvisor.dev/gvisor/pkg/sentry/safemem"
|
||||
"gvisor.dev/gvisor/pkg/sentry/usermem"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
"gvisor.dev/gvisor/pkg/syserror"
|
||||
"gvisor.dev/gvisor/pkg/waiter"
|
||||
)
|
||||
|
|
|
@ -17,10 +17,10 @@ package fdpipe
|
|||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"sync"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/sentry/context"
|
||||
"gvisor.dev/gvisor/pkg/sentry/fs"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
// beforeSave is invoked by stateify.
|
||||
|
|
|
@ -16,7 +16,6 @@ package fs
|
|||
|
||||
import (
|
||||
"math"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
|
@ -29,6 +28,7 @@ import (
|
|||
"gvisor.dev/gvisor/pkg/sentry/memmap"
|
||||
"gvisor.dev/gvisor/pkg/sentry/uniqueid"
|
||||
"gvisor.dev/gvisor/pkg/sentry/usermem"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
"gvisor.dev/gvisor/pkg/syserror"
|
||||
"gvisor.dev/gvisor/pkg/waiter"
|
||||
)
|
||||
|
|
|
@ -16,13 +16,13 @@ package fs
|
|||
|
||||
import (
|
||||
"io"
|
||||
"sync"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/refs"
|
||||
"gvisor.dev/gvisor/pkg/sentry/arch"
|
||||
"gvisor.dev/gvisor/pkg/sentry/context"
|
||||
"gvisor.dev/gvisor/pkg/sentry/memmap"
|
||||
"gvisor.dev/gvisor/pkg/sentry/usermem"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
"gvisor.dev/gvisor/pkg/syserror"
|
||||
"gvisor.dev/gvisor/pkg/waiter"
|
||||
)
|
||||
|
|
|
@ -18,9 +18,9 @@ import (
|
|||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/sentry/context"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
// FilesystemFlags matches include/linux/fs.h:file_system_type.fs_flags.
|
||||
|
|
|
@ -54,10 +54,9 @@
|
|||
package fs
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/log"
|
||||
"gvisor.dev/gvisor/pkg/sentry/context"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -93,6 +93,7 @@ go_library(
|
|||
"//pkg/sentry/usage",
|
||||
"//pkg/sentry/usermem",
|
||||
"//pkg/state",
|
||||
"//pkg/sync",
|
||||
"//pkg/syserror",
|
||||
"//pkg/waiter",
|
||||
],
|
||||
|
|
|
@ -16,7 +16,6 @@ package fsutil
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
"syscall"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/log"
|
||||
|
@ -24,6 +23,7 @@ import (
|
|||
"gvisor.dev/gvisor/pkg/sentry/platform"
|
||||
"gvisor.dev/gvisor/pkg/sentry/safemem"
|
||||
"gvisor.dev/gvisor/pkg/sentry/usermem"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
// HostFileMapper caches mappings of an arbitrary host file descriptor. It is
|
||||
|
|
|
@ -16,7 +16,6 @@ package fsutil
|
|||
|
||||
import (
|
||||
"math"
|
||||
"sync"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/sentry/context"
|
||||
"gvisor.dev/gvisor/pkg/sentry/fs"
|
||||
|
@ -24,6 +23,7 @@ import (
|
|||
"gvisor.dev/gvisor/pkg/sentry/platform"
|
||||
"gvisor.dev/gvisor/pkg/sentry/safemem"
|
||||
"gvisor.dev/gvisor/pkg/sentry/usermem"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
// HostMappable implements memmap.Mappable and platform.File over a
|
||||
|
|
|
@ -15,13 +15,12 @@
|
|||
package fsutil
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/sentry/context"
|
||||
"gvisor.dev/gvisor/pkg/sentry/fs"
|
||||
ktime "gvisor.dev/gvisor/pkg/sentry/kernel/time"
|
||||
"gvisor.dev/gvisor/pkg/sentry/memmap"
|
||||
"gvisor.dev/gvisor/pkg/sentry/socket/unix/transport"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
"gvisor.dev/gvisor/pkg/syserror"
|
||||
"gvisor.dev/gvisor/pkg/waiter"
|
||||
)
|
||||
|
|
|
@ -17,7 +17,6 @@ package fsutil
|
|||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"sync"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/log"
|
||||
"gvisor.dev/gvisor/pkg/sentry/context"
|
||||
|
@ -30,6 +29,7 @@ import (
|
|||
"gvisor.dev/gvisor/pkg/sentry/safemem"
|
||||
"gvisor.dev/gvisor/pkg/sentry/usage"
|
||||
"gvisor.dev/gvisor/pkg/sentry/usermem"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
// Lock order (compare the lock order model in mm/mm.go):
|
||||
|
|
|
@ -44,6 +44,7 @@ go_library(
|
|||
"//pkg/sentry/safemem",
|
||||
"//pkg/sentry/socket/unix/transport",
|
||||
"//pkg/sentry/usermem",
|
||||
"//pkg/sync",
|
||||
"//pkg/syserr",
|
||||
"//pkg/syserror",
|
||||
"//pkg/unet",
|
||||
|
|
|
@ -16,7 +16,6 @@ package gofer
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"sync"
|
||||
"syscall"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/abi/linux"
|
||||
|
@ -31,6 +30,7 @@ import (
|
|||
"gvisor.dev/gvisor/pkg/sentry/fs/host"
|
||||
"gvisor.dev/gvisor/pkg/sentry/memmap"
|
||||
"gvisor.dev/gvisor/pkg/sentry/safemem"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
"gvisor.dev/gvisor/pkg/syserror"
|
||||
)
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ package gofer
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/p9"
|
||||
"gvisor.dev/gvisor/pkg/refs"
|
||||
|
@ -25,6 +24,7 @@ import (
|
|||
"gvisor.dev/gvisor/pkg/sentry/fs"
|
||||
"gvisor.dev/gvisor/pkg/sentry/fs/fsutil"
|
||||
"gvisor.dev/gvisor/pkg/sentry/socket/unix/transport"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
"gvisor.dev/gvisor/pkg/unet"
|
||||
)
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ go_library(
|
|||
"//pkg/sentry/unimpl",
|
||||
"//pkg/sentry/uniqueid",
|
||||
"//pkg/sentry/usermem",
|
||||
"//pkg/sync",
|
||||
"//pkg/syserr",
|
||||
"//pkg/syserror",
|
||||
"//pkg/tcpip",
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
package host
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"syscall"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/abi/linux"
|
||||
|
@ -28,6 +27,7 @@ import (
|
|||
"gvisor.dev/gvisor/pkg/sentry/memmap"
|
||||
"gvisor.dev/gvisor/pkg/sentry/safemem"
|
||||
"gvisor.dev/gvisor/pkg/sentry/socket/unix/transport"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
"gvisor.dev/gvisor/pkg/syserror"
|
||||
"gvisor.dev/gvisor/pkg/waiter"
|
||||
)
|
||||
|
|
|
@ -16,7 +16,6 @@ package host
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
"syscall"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/abi/linux"
|
||||
|
@ -30,6 +29,7 @@ import (
|
|||
unixsocket "gvisor.dev/gvisor/pkg/sentry/socket/unix"
|
||||
"gvisor.dev/gvisor/pkg/sentry/socket/unix/transport"
|
||||
"gvisor.dev/gvisor/pkg/sentry/uniqueid"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
"gvisor.dev/gvisor/pkg/syserr"
|
||||
"gvisor.dev/gvisor/pkg/syserror"
|
||||
"gvisor.dev/gvisor/pkg/tcpip"
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
package host
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/abi/linux"
|
||||
"gvisor.dev/gvisor/pkg/sentry/arch"
|
||||
"gvisor.dev/gvisor/pkg/sentry/context"
|
||||
|
@ -24,6 +22,7 @@ import (
|
|||
"gvisor.dev/gvisor/pkg/sentry/kernel"
|
||||
"gvisor.dev/gvisor/pkg/sentry/unimpl"
|
||||
"gvisor.dev/gvisor/pkg/sentry/usermem"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
"gvisor.dev/gvisor/pkg/syserror"
|
||||
)
|
||||
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
package fs
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/abi/linux"
|
||||
"gvisor.dev/gvisor/pkg/log"
|
||||
"gvisor.dev/gvisor/pkg/metric"
|
||||
|
@ -26,6 +24,7 @@ import (
|
|||
"gvisor.dev/gvisor/pkg/sentry/kernel/auth"
|
||||
"gvisor.dev/gvisor/pkg/sentry/memmap"
|
||||
"gvisor.dev/gvisor/pkg/sentry/socket/unix/transport"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
"gvisor.dev/gvisor/pkg/syserror"
|
||||
)
|
||||
|
||||
|
|
|
@ -16,7 +16,8 @@ package fs
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
// Watches is the collection of inotify watches on an inode.
|
||||
|
|
|
@ -16,7 +16,6 @@ package fs
|
|||
|
||||
import (
|
||||
"io"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/abi/linux"
|
||||
|
@ -25,6 +24,7 @@ import (
|
|||
"gvisor.dev/gvisor/pkg/sentry/memmap"
|
||||
"gvisor.dev/gvisor/pkg/sentry/uniqueid"
|
||||
"gvisor.dev/gvisor/pkg/sentry/usermem"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
"gvisor.dev/gvisor/pkg/syserror"
|
||||
"gvisor.dev/gvisor/pkg/waiter"
|
||||
)
|
||||
|
|
|
@ -15,10 +15,10 @@
|
|||
package fs
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/abi/linux"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
)
|
||||
|
||||
// Watch represent a particular inotify watch created by inotify_add_watch.
|
||||
|
|
|
@ -44,6 +44,7 @@ go_library(
|
|||
visibility = ["//pkg/sentry:internal"],
|
||||
deps = [
|
||||
"//pkg/log",
|
||||
"//pkg/sync",
|
||||
"//pkg/waiter",
|
||||
],
|
||||
)
|
||||
|
|
|
@ -52,9 +52,9 @@ package lock
|
|||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"sync"
|
||||
"syscall"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
"gvisor.dev/gvisor/pkg/waiter"
|
||||
)
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ import (
|
|||
"math"
|
||||
"path"
|
||||
"strings"
|
||||
"sync"
|
||||
"syscall"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/abi/linux"
|
||||
|
@ -27,6 +26,7 @@ import (
|
|||
"gvisor.dev/gvisor/pkg/refs"
|
||||
"gvisor.dev/gvisor/pkg/sentry/context"
|
||||
"gvisor.dev/gvisor/pkg/sentry/kernel/auth"
|
||||
"gvisor.dev/gvisor/pkg/sync"
|
||||
"gvisor.dev/gvisor/pkg/syserror"
|
||||
)
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue