• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2019 Google LLC
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15load("@com_google_sandboxed_api//sandboxed_api/bazel:build_defs.bzl", "sapi_platform_copts")
16
17DEFAULT_VISIBILITY = [
18    "@com_google_sandboxed_api//sandboxed_api:__subpackages__",
19]
20
21package(default_visibility = DEFAULT_VISIBILITY)
22
23licenses(["notice"])
24
25cc_library(
26    name = "bpf_helper",
27    srcs = ["bpf_helper.c"],
28    hdrs = ["bpf_helper.h"],
29    copts = sapi_platform_copts(),
30    visibility = ["//visibility:public"],
31)
32
33cc_test(
34    name = "bpf_helper_test",
35    srcs = ["bpf_helper_test.cc"],
36    copts = sapi_platform_copts(),
37    deps = [
38        ":bpf_helper",
39        "@com_google_absl//absl/strings",
40        "@com_google_googletest//:gtest_main",
41    ],
42)
43
44cc_library(
45    name = "minielf",
46    srcs = ["minielf.cc"],
47    hdrs = ["minielf.h"],
48    copts = sapi_platform_copts(),
49    visibility = ["//visibility:public"],
50    deps = [
51        "@com_google_absl//absl/base:endian",
52        "@com_google_absl//absl/status",
53        "@com_google_absl//absl/status:statusor",
54        "@com_google_absl//absl/strings",
55        "@com_google_sandboxed_api//sandboxed_api:config",
56        "@com_google_sandboxed_api//sandboxed_api/sandbox2:util",
57        "@com_google_sandboxed_api//sandboxed_api/util:raw_logging",
58        "@com_google_sandboxed_api//sandboxed_api/util:status",
59    ],
60)
61
62cc_test(
63    name = "minielf_test",
64    srcs = ["minielf_test.cc"],
65    copts = sapi_platform_copts(),
66    data = [
67        ":testdata/chrome_grte_header",
68        ":testdata/hello_world",
69    ],
70    features = ["-dynamic_link_test_srcs"],  # see go/dynamic_link_test_srcs
71    deps = [
72        ":maps_parser",
73        ":minielf",
74        "@com_google_absl//absl/algorithm:container",
75        "@com_google_absl//absl/status:statusor",
76        "@com_google_googletest//:gtest_main",
77        "@com_google_sandboxed_api//sandboxed_api:testing",
78        "@com_google_sandboxed_api//sandboxed_api/util:file_helpers",
79        "@com_google_sandboxed_api//sandboxed_api/util:status_matchers",
80    ],
81)
82
83cc_library(
84    name = "syscall_trap",
85    srcs = ["syscall_trap.cc"],
86    hdrs = ["syscall_trap.h"],
87    copts = sapi_platform_copts(),
88    deps = [
89        "@com_google_absl//absl/log:check",
90        "@com_google_sandboxed_api//sandboxed_api:config",
91    ],
92)
93
94cc_library(
95    name = "deadline_manager",
96    srcs = ["deadline_manager.cc"],
97    hdrs = ["deadline_manager.h"],
98    copts = sapi_platform_copts(),
99    deps = [
100        "@com_google_absl//absl/base",
101        "@com_google_absl//absl/base:core_headers",
102        "@com_google_absl//absl/base:no_destructor",
103        "@com_google_absl//absl/container:btree",
104        "@com_google_absl//absl/flags:flag",
105        "@com_google_absl//absl/functional:function_ref",
106        "@com_google_absl//absl/log",
107        "@com_google_absl//absl/log:check",
108        "@com_google_absl//absl/strings",
109        "@com_google_absl//absl/strings:string_view",
110        "@com_google_absl//absl/synchronization",
111        "@com_google_absl//absl/time",
112        "@com_google_sandboxed_api//sandboxed_api/sandbox2:util",
113        "@com_google_sandboxed_api//sandboxed_api/util:thread",
114    ],
115)
116
117cc_test(
118    name = "deadline_manager_test",
119    srcs = ["deadline_manager_test.cc"],
120    copts = sapi_platform_copts(),
121    deps = [
122        ":deadline_manager",
123        "@com_google_absl//absl/flags:flag",
124        "@com_google_absl//absl/log:check",
125        "@com_google_absl//absl/time",
126        "@com_google_googletest//:gtest_main",
127        "@com_google_sandboxed_api//sandboxed_api/util:thread",
128    ],
129)
130
131cc_library(
132    name = "maps_parser",
133    srcs = ["maps_parser.cc"],
134    hdrs = ["maps_parser.h"],
135    copts = sapi_platform_copts(),
136    deps = [
137        "@com_google_absl//absl/status",
138        "@com_google_absl//absl/status:statusor",
139        "@com_google_absl//absl/strings",
140    ],
141)
142
143cc_test(
144    name = "maps_parser_test",
145    srcs = ["maps_parser_test.cc"],
146    copts = sapi_platform_copts(),
147    deps = [
148        ":maps_parser",
149        "@com_google_absl//absl/status:statusor",
150        "@com_google_googletest//:gtest_main",
151        "@com_google_sandboxed_api//sandboxed_api/util:status_matchers",
152    ],
153)
154
155cc_library(
156    name = "pid_waiter",
157    srcs = ["pid_waiter.cc"],
158    hdrs = ["pid_waiter.h"],
159    copts = sapi_platform_copts(),
160    deps = [
161        ":deadline_manager",
162        "@com_google_absl//absl/base:core_headers",
163        "@com_google_absl//absl/cleanup",
164        "@com_google_absl//absl/synchronization",
165        "@com_google_absl//absl/time",
166    ],
167)
168
169cc_test(
170    name = "pid_waiter_test",
171    srcs = ["pid_waiter_test.cc"],
172    copts = sapi_platform_copts(),
173    deps = [
174        ":pid_waiter",
175        "@com_google_absl//absl/time",
176        "@com_google_googletest//:gtest_main",
177        "@com_google_sandboxed_api//sandboxed_api/util:thread",
178    ],
179)
180