2020-01-17 21:05:03 +08:00
|
|
|
# Copyright 2019 Google LLC
|
2019-03-19 00:21:48 +08:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
|
|
|
# Description: sandbox2 is a C++ sandbox technology for Linux.
|
|
|
|
|
2019-11-20 01:01:59 +08:00
|
|
|
load("//sandboxed_api/bazel:build_defs.bzl", "sapi_platform_copts")
|
|
|
|
load("//sandboxed_api/bazel:embed_data.bzl", "sapi_cc_embed_data")
|
|
|
|
load("//sandboxed_api/bazel:proto.bzl", "sapi_proto_library")
|
|
|
|
|
2021-01-14 01:25:25 +08:00
|
|
|
package(default_visibility = ["//sandboxed_api:__subpackages__"])
|
2019-03-19 00:21:48 +08:00
|
|
|
|
|
|
|
licenses(["notice"]) # Apache 2.0
|
|
|
|
|
2019-12-05 19:33:08 +08:00
|
|
|
exports_files(["testdata/hostname"])
|
|
|
|
|
2019-03-19 00:21:48 +08:00
|
|
|
cc_library(
|
|
|
|
name = "bpfdisassembler",
|
|
|
|
srcs = ["bpfdisassembler.cc"],
|
|
|
|
hdrs = ["bpfdisassembler.h"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2021-04-21 20:32:48 +08:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
"@com_google_absl//absl/types:span",
|
|
|
|
],
|
2019-03-19 00:21:48 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "regs",
|
|
|
|
srcs = ["regs.cc"],
|
|
|
|
hdrs = ["regs.h"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
deps = [
|
|
|
|
":syscall",
|
2019-09-25 22:13:33 +08:00
|
|
|
":violation_cc_proto",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api:config",
|
2021-07-27 19:09:37 +08:00
|
|
|
"//sandboxed_api/util:status",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api/util:strerror",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/base:core_headers",
|
2020-02-28 01:23:44 +08:00
|
|
|
"@com_google_absl//absl/status",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "syscall",
|
|
|
|
srcs = [
|
|
|
|
"syscall.cc",
|
|
|
|
"syscall_defs.cc",
|
|
|
|
"syscall_defs.h",
|
|
|
|
],
|
2019-03-20 01:57:58 +08:00
|
|
|
hdrs = ["syscall.h"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":util",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api:config",
|
2020-11-25 22:15:06 +08:00
|
|
|
"@com_google_absl//absl/algorithm:container",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
"@com_google_absl//absl/strings:str_format",
|
|
|
|
"@com_google_absl//absl/types:span",
|
|
|
|
"@com_google_glog//:glog",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "syscall_test",
|
|
|
|
srcs = ["syscall_test.cc"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
deps = [
|
|
|
|
":syscall",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api:config",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "result",
|
|
|
|
srcs = ["result.cc"],
|
|
|
|
hdrs = ["result.h"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
deps = [
|
|
|
|
":regs",
|
|
|
|
":syscall",
|
|
|
|
":util",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api:config",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/memory",
|
2020-02-28 01:23:44 +08:00
|
|
|
"@com_google_absl//absl/status",
|
2020-09-02 23:46:48 +08:00
|
|
|
"@com_google_absl//absl/status:statusor",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
sapi_proto_library(
|
|
|
|
name = "logserver_proto",
|
|
|
|
srcs = ["logserver.proto"],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "logserver",
|
|
|
|
srcs = ["logserver.cc"],
|
|
|
|
hdrs = ["logserver.h"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
deps = [
|
|
|
|
":comms",
|
2019-09-25 22:13:33 +08:00
|
|
|
":logserver_cc_proto",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_glog//:glog",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "logsink",
|
|
|
|
srcs = ["logsink.cc"],
|
|
|
|
hdrs = ["logsink.h"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":comms",
|
2019-09-25 22:13:33 +08:00
|
|
|
":logserver_cc_proto",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
"@com_google_absl//absl/synchronization",
|
|
|
|
"@com_google_glog//:glog",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "ipc",
|
|
|
|
srcs = ["ipc.cc"],
|
|
|
|
hdrs = ["ipc.h"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
deps = [
|
|
|
|
":comms",
|
|
|
|
":logserver",
|
|
|
|
":logsink",
|
|
|
|
"@com_google_absl//absl/base:core_headers",
|
|
|
|
"@com_google_absl//absl/memory",
|
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "policy",
|
|
|
|
srcs = ["policy.cc"],
|
|
|
|
hdrs = ["policy.h"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
deps = [
|
|
|
|
":bpfdisassembler",
|
|
|
|
":comms",
|
|
|
|
":namespace",
|
|
|
|
":regs",
|
|
|
|
":syscall",
|
2019-09-25 22:13:33 +08:00
|
|
|
":violation_cc_proto",
|
2021-05-20 23:16:45 +08:00
|
|
|
"//sandboxed_api:config",
|
2020-02-20 23:45:22 +08:00
|
|
|
"//sandboxed_api/sandbox2/network_proxy:filtering",
|
2019-03-19 00:21:48 +08:00
|
|
|
"//sandboxed_api/sandbox2/util:bpf_helper",
|
2019-06-05 15:25:50 +08:00
|
|
|
"//sandboxed_api/util:flags",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/base:core_headers",
|
|
|
|
"@com_google_absl//absl/types:optional",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "notify",
|
|
|
|
srcs = [],
|
|
|
|
hdrs = ["notify.h"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
deps = [
|
|
|
|
":comms",
|
|
|
|
":result",
|
|
|
|
":syscall",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "limits",
|
|
|
|
hdrs = ["limits.h"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
deps = [
|
|
|
|
"@com_google_absl//absl/base:core_headers",
|
|
|
|
"@com_google_absl//absl/time",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2019-04-09 18:44:34 +08:00
|
|
|
cc_binary(
|
|
|
|
name = "forkserver_bin",
|
|
|
|
srcs = ["forkserver_bin.cc"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-04-09 18:44:34 +08:00
|
|
|
deps = [
|
|
|
|
":comms",
|
|
|
|
":forkserver",
|
2020-04-08 04:26:15 +08:00
|
|
|
":sanitizer",
|
2019-04-09 18:44:34 +08:00
|
|
|
"//sandboxed_api/util:raw_logging",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api/util:strerror",
|
2019-04-09 18:44:34 +08:00
|
|
|
"@com_google_absl//absl/base:core_headers",
|
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
sapi_cc_embed_data(
|
|
|
|
name = "forkserver_bin_embed",
|
|
|
|
srcs = [":forkserver_bin.stripped"],
|
|
|
|
)
|
|
|
|
|
2019-03-19 00:21:48 +08:00
|
|
|
cc_library(
|
|
|
|
name = "global_forkserver",
|
|
|
|
srcs = ["global_forkclient.cc"],
|
|
|
|
hdrs = ["global_forkclient.h"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2020-11-06 00:47:34 +08:00
|
|
|
visibility = ["//visibility:public"],
|
2019-03-19 00:21:48 +08:00
|
|
|
deps = [
|
|
|
|
":comms",
|
2020-07-17 19:54:20 +08:00
|
|
|
":fork_client",
|
2019-04-09 18:44:34 +08:00
|
|
|
":forkserver_bin_embed",
|
2020-11-06 00:47:34 +08:00
|
|
|
":forkserver_cc_proto",
|
|
|
|
":util",
|
2019-04-09 18:44:34 +08:00
|
|
|
"//sandboxed_api:embed_file",
|
2020-11-06 00:47:34 +08:00
|
|
|
"//sandboxed_api/util:flags",
|
2019-03-19 00:21:48 +08:00
|
|
|
"//sandboxed_api/util:raw_logging",
|
2021-08-10 15:33:04 +08:00
|
|
|
"//sandboxed_api/util:status",
|
2020-12-02 19:05:06 +08:00
|
|
|
"@com_google_absl//absl/base:core_headers",
|
2020-11-06 00:47:34 +08:00
|
|
|
"@com_google_absl//absl/memory",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/strings",
|
2020-12-02 19:05:06 +08:00
|
|
|
"@com_google_absl//absl/synchronization",
|
2020-11-06 00:47:34 +08:00
|
|
|
"@com_google_glog//:glog",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
# Use only if Sandbox2 global forkserver has to be started very early on.
|
|
|
|
# By default the forkserver is started on demand.
|
|
|
|
cc_library(
|
|
|
|
name = "start_global_forkserver_lib_constructor",
|
|
|
|
srcs = ["global_forkclient_lib_ctor.cc"],
|
|
|
|
copts = sapi_platform_copts(),
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
2020-12-10 18:49:25 +08:00
|
|
|
":fork_client",
|
2020-11-06 00:47:34 +08:00
|
|
|
":global_forkserver",
|
|
|
|
"@com_google_absl//absl/base:core_headers",
|
2019-03-19 00:21:48 +08:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2019-07-09 16:53:31 +08:00
|
|
|
cc_library(
|
|
|
|
name = "executor",
|
|
|
|
srcs = ["executor.cc"],
|
|
|
|
hdrs = ["executor.h"],
|
|
|
|
copts = sapi_platform_copts(),
|
|
|
|
deps = [
|
2020-07-17 19:54:20 +08:00
|
|
|
":fork_client",
|
2019-09-25 22:13:33 +08:00
|
|
|
":forkserver_cc_proto",
|
2019-07-09 16:53:31 +08:00
|
|
|
":global_forkserver",
|
|
|
|
":ipc",
|
|
|
|
":limits",
|
|
|
|
":namespace",
|
|
|
|
":util",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api/util:fileops",
|
2019-07-09 16:53:31 +08:00
|
|
|
"@com_google_absl//absl/base:core_headers",
|
|
|
|
"@com_google_absl//absl/memory",
|
|
|
|
"@com_google_absl//absl/strings",
|
2021-01-28 18:20:13 +08:00
|
|
|
"@com_google_absl//absl/types:span",
|
2019-07-09 16:53:31 +08:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2019-03-19 00:21:48 +08:00
|
|
|
# Should not be used in sandboxee code if it only uses sandbox2::Comms and
|
|
|
|
# sandbox2::Client objects
|
|
|
|
cc_library(
|
|
|
|
name = "sandbox2",
|
|
|
|
srcs = [
|
|
|
|
"monitor.cc",
|
|
|
|
"monitor.h",
|
|
|
|
"policybuilder.cc",
|
|
|
|
"sandbox2.cc",
|
2019-07-09 16:31:48 +08:00
|
|
|
"stack_trace.cc",
|
2021-06-25 15:03:27 +08:00
|
|
|
"stack_trace.h",
|
2019-03-19 00:21:48 +08:00
|
|
|
],
|
|
|
|
hdrs = [
|
2019-07-09 16:53:31 +08:00
|
|
|
"client.h",
|
2019-03-19 00:21:48 +08:00
|
|
|
"executor.h",
|
|
|
|
"ipc.h",
|
|
|
|
"limits.h",
|
|
|
|
"notify.h",
|
|
|
|
"policy.h",
|
2019-07-09 16:53:31 +08:00
|
|
|
"policybuilder.h",
|
2019-03-19 00:21:48 +08:00
|
|
|
"regs.h",
|
|
|
|
"result.h",
|
2019-07-09 16:53:31 +08:00
|
|
|
"sandbox2.h",
|
2019-03-19 00:21:48 +08:00
|
|
|
"syscall.h",
|
|
|
|
],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":client",
|
|
|
|
":comms",
|
2020-07-17 18:20:18 +08:00
|
|
|
":executor",
|
2020-07-17 19:54:20 +08:00
|
|
|
":fork_client",
|
2020-02-12 21:21:12 +08:00
|
|
|
":forkserver_cc_proto",
|
|
|
|
":global_forkserver",
|
2019-03-19 00:21:48 +08:00
|
|
|
":ipc",
|
|
|
|
":limits",
|
|
|
|
":logsink",
|
|
|
|
":mounts",
|
|
|
|
":namespace",
|
|
|
|
":notify",
|
|
|
|
":policy",
|
|
|
|
":regs",
|
|
|
|
":result",
|
2020-07-17 18:20:18 +08:00
|
|
|
":sanitizer",
|
2019-03-19 00:21:48 +08:00
|
|
|
":syscall",
|
|
|
|
":util",
|
2020-07-17 18:20:18 +08:00
|
|
|
":violation_cc_proto",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api:config",
|
2020-02-20 23:45:22 +08:00
|
|
|
"//sandboxed_api/sandbox2/network_proxy:client",
|
|
|
|
"//sandboxed_api/sandbox2/network_proxy:filtering",
|
|
|
|
"//sandboxed_api/sandbox2/network_proxy:server",
|
2019-03-19 00:21:48 +08:00
|
|
|
"//sandboxed_api/sandbox2/unwind",
|
2019-09-25 22:13:33 +08:00
|
|
|
"//sandboxed_api/sandbox2/unwind:unwind_cc_proto",
|
2019-03-19 00:21:48 +08:00
|
|
|
"//sandboxed_api/sandbox2/util:bpf_helper",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api/util:file_base",
|
2021-05-10 22:03:15 +08:00
|
|
|
"//sandboxed_api/util:file_helpers",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api/util:fileops",
|
2020-07-17 18:20:18 +08:00
|
|
|
"//sandboxed_api/util:flags",
|
2019-05-08 09:29:51 +08:00
|
|
|
"//sandboxed_api/util:raw_logging",
|
2019-03-19 00:21:48 +08:00
|
|
|
"//sandboxed_api/util:status",
|
2021-07-27 23:31:38 +08:00
|
|
|
"//sandboxed_api/util:strerror",
|
2021-05-10 22:03:15 +08:00
|
|
|
"//sandboxed_api/util:temp_file",
|
2020-07-17 18:20:18 +08:00
|
|
|
"@com_google_absl//absl/base:core_headers",
|
2021-05-10 22:03:15 +08:00
|
|
|
"@com_google_absl//absl/cleanup",
|
2020-07-17 18:20:18 +08:00
|
|
|
"@com_google_absl//absl/container:flat_hash_map",
|
|
|
|
"@com_google_absl//absl/container:flat_hash_set",
|
|
|
|
"@com_google_absl//absl/memory",
|
|
|
|
"@com_google_absl//absl/status",
|
2020-09-02 23:46:48 +08:00
|
|
|
"@com_google_absl//absl/status:statusor",
|
2020-07-17 18:20:18 +08:00
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
"@com_google_absl//absl/strings:str_format",
|
|
|
|
"@com_google_absl//absl/synchronization",
|
|
|
|
"@com_google_absl//absl/time",
|
|
|
|
"@com_google_absl//absl/types:optional",
|
2021-01-28 18:20:13 +08:00
|
|
|
"@com_google_absl//absl/types:span",
|
2020-07-17 18:20:18 +08:00
|
|
|
"@org_kernel_libcap//:libcap",
|
2019-03-19 00:21:48 +08:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
# Should be used in sandboxee code instead of :sandbox2 if it uses just
|
|
|
|
# sandbox2::Client::SandboxMeHere() and sandbox2::Comms
|
|
|
|
cc_library(
|
|
|
|
name = "client",
|
2020-03-26 16:58:42 +08:00
|
|
|
srcs = ["client.cc"],
|
2020-04-08 04:26:15 +08:00
|
|
|
hdrs = ["client.h"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":comms",
|
|
|
|
":logsink",
|
2020-03-26 16:58:42 +08:00
|
|
|
":sanitizer",
|
2020-02-20 23:45:22 +08:00
|
|
|
"//sandboxed_api/sandbox2/network_proxy:client",
|
2019-03-19 00:21:48 +08:00
|
|
|
"//sandboxed_api/util:raw_logging",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api/util:strerror",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/base:core_headers",
|
2020-11-05 17:48:46 +08:00
|
|
|
"@com_google_absl//absl/container:flat_hash_map",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/memory",
|
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2020-03-25 00:54:21 +08:00
|
|
|
cc_library(
|
|
|
|
name = "sanitizer",
|
|
|
|
srcs = ["sanitizer.cc"],
|
|
|
|
hdrs = ["sanitizer.h"],
|
|
|
|
copts = sapi_platform_copts(),
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
2021-04-17 03:42:41 +08:00
|
|
|
":util",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api/util:file_helpers",
|
|
|
|
"//sandboxed_api/util:fileops",
|
2020-03-25 00:54:21 +08:00
|
|
|
"//sandboxed_api/util:raw_logging",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api/util:strerror",
|
2020-03-25 00:54:21 +08:00
|
|
|
"@com_google_absl//absl/base:core_headers",
|
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
"@com_google_glog//:glog",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2019-03-19 00:21:48 +08:00
|
|
|
cc_library(
|
|
|
|
name = "forkserver",
|
|
|
|
srcs = ["forkserver.cc"],
|
|
|
|
hdrs = ["forkserver.h"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":client",
|
|
|
|
":comms",
|
2020-07-17 19:54:20 +08:00
|
|
|
":fork_client",
|
2019-09-25 22:13:33 +08:00
|
|
|
":forkserver_cc_proto",
|
2019-03-19 00:21:48 +08:00
|
|
|
":namespace",
|
|
|
|
":policy",
|
2020-04-08 04:26:15 +08:00
|
|
|
":sanitizer",
|
2019-03-19 00:21:48 +08:00
|
|
|
":syscall",
|
|
|
|
":util",
|
|
|
|
"//sandboxed_api/sandbox2/unwind",
|
|
|
|
"//sandboxed_api/sandbox2/util:bpf_helper",
|
2021-05-10 22:03:15 +08:00
|
|
|
"//sandboxed_api/util:file_helpers",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api/util:fileops",
|
2019-03-19 00:21:48 +08:00
|
|
|
"//sandboxed_api/util:raw_logging",
|
2021-07-27 19:09:37 +08:00
|
|
|
"//sandboxed_api/util:status",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api/util:strerror",
|
2021-07-14 16:32:57 +08:00
|
|
|
"@com_google_absl//absl/container:flat_hash_map",
|
2019-11-20 01:01:59 +08:00
|
|
|
"@com_google_absl//absl/memory",
|
2020-02-28 01:23:44 +08:00
|
|
|
"@com_google_absl//absl/status",
|
2020-09-02 23:46:48 +08:00
|
|
|
"@com_google_absl//absl/status:statusor",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
"@com_google_absl//absl/strings:str_format",
|
|
|
|
"@org_kernel_libcap//:libcap",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2020-07-17 19:54:20 +08:00
|
|
|
cc_library(
|
|
|
|
name = "fork_client",
|
|
|
|
srcs = ["fork_client.cc"],
|
|
|
|
hdrs = ["fork_client.h"],
|
|
|
|
copts = sapi_platform_copts(),
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":comms",
|
|
|
|
":forkserver_cc_proto",
|
|
|
|
"//sandboxed_api/util:raw_logging",
|
|
|
|
"@com_google_absl//absl/base:core_headers",
|
|
|
|
"@com_google_absl//absl/synchronization",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2019-03-19 00:21:48 +08:00
|
|
|
cc_library(
|
|
|
|
name = "mounts",
|
|
|
|
srcs = ["mounts.cc"],
|
|
|
|
hdrs = ["mounts.h"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
deps = [
|
2019-09-25 22:13:33 +08:00
|
|
|
":mounttree_cc_proto",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api:config",
|
2019-03-19 00:21:48 +08:00
|
|
|
"//sandboxed_api/sandbox2/util:minielf",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api/util:file_base",
|
|
|
|
"//sandboxed_api/util:fileops",
|
2019-03-19 00:21:48 +08:00
|
|
|
"//sandboxed_api/util:raw_logging",
|
|
|
|
"//sandboxed_api/util:status",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api/util:strerror",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/base:core_headers",
|
|
|
|
"@com_google_absl//absl/container:flat_hash_set",
|
2020-02-28 01:23:44 +08:00
|
|
|
"@com_google_absl//absl/status",
|
2020-09-02 23:46:48 +08:00
|
|
|
"@com_google_absl//absl/status:statusor",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
"@com_google_protobuf//:protobuf",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "mounts_test",
|
|
|
|
srcs = ["mounts_test.cc"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-04-24 01:45:50 +08:00
|
|
|
data = ["//sandboxed_api/sandbox2/testcases:minimal_dynamic"],
|
2019-03-19 00:21:48 +08:00
|
|
|
deps = [
|
|
|
|
":mounts",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api:testing",
|
|
|
|
"//sandboxed_api/util:file_base",
|
|
|
|
"//sandboxed_api/util:file_helpers",
|
2019-03-19 00:21:48 +08:00
|
|
|
"//sandboxed_api/util:status_matchers",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api/util:temp_file",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "namespace",
|
|
|
|
srcs = ["namespace.cc"],
|
|
|
|
hdrs = ["namespace.h"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
deps = [
|
|
|
|
":mounts",
|
2019-09-25 22:13:33 +08:00
|
|
|
":mounttree_cc_proto",
|
2019-03-19 00:21:48 +08:00
|
|
|
":util",
|
2019-09-25 22:13:33 +08:00
|
|
|
":violation_cc_proto",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api/util:file_base",
|
|
|
|
"//sandboxed_api/util:fileops",
|
2019-03-19 00:21:48 +08:00
|
|
|
"//sandboxed_api/util:raw_logging",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api/util:strerror",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/base:core_headers",
|
2019-11-20 01:01:59 +08:00
|
|
|
"@com_google_absl//absl/memory",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
"@com_google_absl//absl/strings:str_format",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "namespace_test",
|
|
|
|
srcs = ["namespace_test.cc"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
data = [
|
|
|
|
"//sandboxed_api/sandbox2/testcases:hostname",
|
|
|
|
"//sandboxed_api/sandbox2/testcases:namespace",
|
|
|
|
],
|
|
|
|
deps = [
|
|
|
|
":comms",
|
|
|
|
":namespace",
|
|
|
|
":sandbox2",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api:config",
|
|
|
|
"//sandboxed_api:testing",
|
|
|
|
"//sandboxed_api/util:fileops",
|
2019-03-19 00:21:48 +08:00
|
|
|
"//sandboxed_api/util:status_matchers",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api/util:temp_file",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/memory",
|
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "forkingclient",
|
|
|
|
srcs = ["forkingclient.cc"],
|
|
|
|
hdrs = ["forkingclient.h"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":client",
|
|
|
|
":comms",
|
|
|
|
":forkserver",
|
2020-04-08 04:26:15 +08:00
|
|
|
":sanitizer",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/memory",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "util",
|
|
|
|
srcs = ["util.cc"],
|
|
|
|
hdrs = ["util.h"],
|
|
|
|
# The default is 16384, however we need to do a clone with a
|
|
|
|
# stack-allocated buffer -- and PTHREAD_STACK_MIN also happens to be 16384.
|
|
|
|
# Thus the slight increase.
|
2019-08-27 20:36:07 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api:config",
|
|
|
|
"//sandboxed_api/util:file_base",
|
2021-04-17 03:42:41 +08:00
|
|
|
"//sandboxed_api/util:file_helpers",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api/util:fileops",
|
2019-03-19 00:21:48 +08:00
|
|
|
"//sandboxed_api/util:raw_logging",
|
2021-07-27 19:09:37 +08:00
|
|
|
"//sandboxed_api/util:status",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/base:core_headers",
|
2021-07-27 19:09:37 +08:00
|
|
|
"@com_google_absl//absl/status",
|
2020-09-02 23:46:48 +08:00
|
|
|
"@com_google_absl//absl/status:statusor",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
"@com_google_absl//absl/strings:str_format",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "buffer",
|
|
|
|
srcs = ["buffer.cc"],
|
|
|
|
hdrs = ["buffer.h"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":util",
|
2021-07-27 19:09:37 +08:00
|
|
|
"//sandboxed_api/util:status",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/base:core_headers",
|
|
|
|
"@com_google_absl//absl/memory",
|
2021-07-27 19:09:37 +08:00
|
|
|
"@com_google_absl//absl/status",
|
2020-09-02 23:46:48 +08:00
|
|
|
"@com_google_absl//absl/status:statusor",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "buffer_test",
|
|
|
|
srcs = ["buffer_test.cc"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
data = ["//sandboxed_api/sandbox2/testcases:buffer"],
|
|
|
|
deps = [
|
|
|
|
":buffer",
|
|
|
|
":comms",
|
|
|
|
":sandbox2",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api:config",
|
|
|
|
"//sandboxed_api:testing",
|
2019-03-19 00:21:48 +08:00
|
|
|
"//sandboxed_api/util:status_matchers",
|
|
|
|
"@com_google_absl//absl/memory",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
sapi_proto_library(
|
|
|
|
name = "forkserver_proto",
|
|
|
|
srcs = ["forkserver.proto"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
deps = [":mounttree_proto"],
|
|
|
|
)
|
|
|
|
|
|
|
|
sapi_proto_library(
|
|
|
|
name = "mounttree_proto",
|
|
|
|
srcs = ["mounttree.proto"],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "comms",
|
|
|
|
srcs = ["comms.cc"],
|
|
|
|
hdrs = ["comms.h"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":util",
|
|
|
|
"//sandboxed_api/util:raw_logging",
|
|
|
|
"//sandboxed_api/util:status",
|
2021-01-22 22:01:05 +08:00
|
|
|
"//sandboxed_api/util:status_cc_proto",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api/util:strerror",
|
2021-02-01 23:10:43 +08:00
|
|
|
"@com_google_absl//absl/base:config",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/base:core_headers",
|
2021-02-01 23:10:43 +08:00
|
|
|
"@com_google_absl//absl/base:dynamic_annotations",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/memory",
|
2020-02-28 01:23:44 +08:00
|
|
|
"@com_google_absl//absl/status",
|
2020-09-02 23:46:48 +08:00
|
|
|
"@com_google_absl//absl/status:statusor",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
"@com_google_absl//absl/strings:str_format",
|
|
|
|
"@com_google_absl//absl/synchronization",
|
|
|
|
"@com_google_protobuf//:protobuf",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
sapi_proto_library(
|
|
|
|
name = "comms_test_proto",
|
|
|
|
srcs = ["comms_test.proto"],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "comms_test",
|
|
|
|
srcs = ["comms_test.cc"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
deps = [
|
|
|
|
":comms",
|
2019-09-25 22:13:33 +08:00
|
|
|
":comms_test_cc_proto",
|
2019-03-19 00:21:48 +08:00
|
|
|
"//sandboxed_api/util:status_matchers",
|
|
|
|
"@com_google_absl//absl/container:fixed_array",
|
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
"@com_google_glog//:glog",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
"@com_google_protobuf//:protobuf",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "forkserver_test",
|
2020-07-17 19:54:20 +08:00
|
|
|
srcs = ["forkserver_test.cc"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
data = ["//sandboxed_api/sandbox2/testcases:minimal"],
|
|
|
|
deps = [
|
|
|
|
":comms",
|
|
|
|
":forkserver",
|
2019-09-25 22:13:33 +08:00
|
|
|
":forkserver_cc_proto",
|
2020-07-17 19:54:20 +08:00
|
|
|
":global_forkserver",
|
2019-03-19 00:21:48 +08:00
|
|
|
":sandbox2",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api:testing",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
"@com_google_glog//:glog",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "limits_test",
|
|
|
|
srcs = ["limits_test.cc"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
data = ["//sandboxed_api/sandbox2/testcases:limits"],
|
|
|
|
deps = [
|
|
|
|
":limits",
|
|
|
|
":sandbox2",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api:config",
|
|
|
|
"//sandboxed_api:testing",
|
2019-03-19 00:21:48 +08:00
|
|
|
"//sandboxed_api/sandbox2/util:bpf_helper",
|
|
|
|
"//sandboxed_api/util:status_matchers",
|
|
|
|
"@com_google_absl//absl/memory",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "notify_test",
|
|
|
|
srcs = ["notify_test.cc"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
data = [
|
|
|
|
"//sandboxed_api/sandbox2/testcases:personality",
|
|
|
|
"//sandboxed_api/sandbox2/testcases:pidcomms",
|
|
|
|
],
|
|
|
|
deps = [
|
|
|
|
":comms",
|
|
|
|
":regs",
|
|
|
|
":sandbox2",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api:testing",
|
2019-03-19 00:21:48 +08:00
|
|
|
"//sandboxed_api/sandbox2/util:bpf_helper",
|
|
|
|
"@com_google_absl//absl/memory",
|
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "policy_test",
|
|
|
|
srcs = ["policy_test.cc"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
data = [
|
|
|
|
"//sandboxed_api/sandbox2/testcases:add_policy_on_syscalls",
|
|
|
|
"//sandboxed_api/sandbox2/testcases:malloc_system",
|
|
|
|
"//sandboxed_api/sandbox2/testcases:minimal",
|
|
|
|
"//sandboxed_api/sandbox2/testcases:minimal_dynamic",
|
|
|
|
"//sandboxed_api/sandbox2/testcases:policy",
|
|
|
|
],
|
|
|
|
deps = [
|
|
|
|
":limits",
|
|
|
|
":regs",
|
|
|
|
":sandbox2",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api:config",
|
|
|
|
"//sandboxed_api:testing",
|
2019-03-19 00:21:48 +08:00
|
|
|
"//sandboxed_api/sandbox2/util:bpf_helper",
|
|
|
|
"@com_google_absl//absl/memory",
|
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "sandbox2_test",
|
|
|
|
srcs = ["sandbox2_test.cc"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
data = [
|
|
|
|
"//sandboxed_api/sandbox2/testcases:abort",
|
|
|
|
"//sandboxed_api/sandbox2/testcases:minimal",
|
|
|
|
"//sandboxed_api/sandbox2/testcases:sleep",
|
2019-05-15 23:04:36 +08:00
|
|
|
"//sandboxed_api/sandbox2/testcases:starve",
|
2019-03-19 00:21:48 +08:00
|
|
|
"//sandboxed_api/sandbox2/testcases:tsync",
|
|
|
|
],
|
|
|
|
tags = ["local"],
|
|
|
|
deps = [
|
|
|
|
":sandbox2",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api:config",
|
|
|
|
"//sandboxed_api:testing",
|
2019-03-19 00:21:48 +08:00
|
|
|
"//sandboxed_api/sandbox2/util:bpf_helper",
|
|
|
|
"//sandboxed_api/util:status_matchers",
|
|
|
|
"@com_google_absl//absl/memory",
|
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "sanitizer_test",
|
|
|
|
srcs = ["sanitizer_test.cc"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
data = ["//sandboxed_api/sandbox2/testcases:sanitizer"],
|
|
|
|
deps = [
|
|
|
|
":comms",
|
|
|
|
":sandbox2",
|
2020-04-08 04:26:15 +08:00
|
|
|
":sanitizer",
|
2019-03-19 00:21:48 +08:00
|
|
|
":util",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api:testing",
|
2019-03-19 00:21:48 +08:00
|
|
|
"//sandboxed_api/sandbox2/util:bpf_helper",
|
|
|
|
"//sandboxed_api/util:status_matchers",
|
|
|
|
"@com_google_absl//absl/memory",
|
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "util_test",
|
|
|
|
srcs = ["util_test.cc"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
deps = [
|
|
|
|
":util",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api:testing",
|
|
|
|
"//sandboxed_api/util:file_base",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
2019-07-09 16:31:48 +08:00
|
|
|
name = "stack_trace_test",
|
2021-06-25 15:03:27 +08:00
|
|
|
srcs = [
|
|
|
|
"stack_trace.h",
|
|
|
|
"stack_trace_test.cc",
|
|
|
|
],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
data = ["//sandboxed_api/sandbox2/testcases:symbolize"],
|
|
|
|
deps = [
|
|
|
|
":global_forkserver",
|
2021-06-25 15:03:27 +08:00
|
|
|
":mounts",
|
|
|
|
":regs",
|
2019-03-19 00:21:48 +08:00
|
|
|
":sandbox2",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api:testing",
|
2019-03-19 00:21:48 +08:00
|
|
|
"//sandboxed_api/sandbox2/util:bpf_helper",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api/util:fileops",
|
2019-06-05 15:25:50 +08:00
|
|
|
"//sandboxed_api/util:flags",
|
2019-03-19 00:21:48 +08:00
|
|
|
"//sandboxed_api/util:status_matchers",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api/util:temp_file",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/memory",
|
2021-06-28 17:02:35 +08:00
|
|
|
"@com_google_absl//absl/status:statusor",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "ipc_test",
|
|
|
|
srcs = ["ipc_test.cc"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
data = ["//sandboxed_api/sandbox2/testcases:ipc"],
|
|
|
|
deps = [
|
|
|
|
":comms",
|
|
|
|
":sandbox2",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api:testing",
|
2019-03-19 00:21:48 +08:00
|
|
|
"//sandboxed_api/sandbox2/util:bpf_helper",
|
|
|
|
"//sandboxed_api/util:status_matchers",
|
|
|
|
"@com_google_absl//absl/memory",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "testing",
|
|
|
|
testonly = 1,
|
|
|
|
hdrs = ["testing.h"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
visibility = ["//visibility:public"],
|
2021-01-14 01:25:25 +08:00
|
|
|
deps = ["//sandboxed_api:testing"],
|
2019-03-19 00:21:48 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
sapi_proto_library(
|
2019-03-20 20:19:28 +08:00
|
|
|
name = "violation_proto",
|
|
|
|
srcs = ["violation.proto"],
|
2019-03-19 00:21:48 +08:00
|
|
|
deps = [":mounttree_proto"],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_test(
|
|
|
|
name = "policybuilder_test",
|
|
|
|
srcs = ["policybuilder_test.cc"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
data = ["//sandboxed_api/sandbox2/testcases:print_fds"],
|
|
|
|
deps = [
|
|
|
|
":comms",
|
|
|
|
":sandbox2",
|
2021-02-01 23:10:43 +08:00
|
|
|
"//sandboxed_api:config",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api:testing",
|
2019-03-19 00:21:48 +08:00
|
|
|
"//sandboxed_api/sandbox2/util:bpf_helper",
|
|
|
|
"//sandboxed_api/util:status_matchers",
|
|
|
|
"@com_google_absl//absl/memory",
|
2020-02-28 01:23:44 +08:00
|
|
|
"@com_google_absl//absl/status",
|
2020-09-02 23:46:48 +08:00
|
|
|
"@com_google_absl//absl/status:statusor",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
"@com_google_glog//:glog",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|