Split sanitizer.h into a separate library

PiperOrigin-RevId: 305327952
Change-Id: I6708729d379d019c3d299e9cb54b76338ced23bf
This commit is contained in:
Sandboxed API Team 2020-04-07 13:26:15 -07:00 committed by Copybara-Service
parent bd4cb3ad10
commit 9b85dc49c1
2 changed files with 31 additions and 15 deletions

View File

@ -190,9 +190,9 @@ cc_binary(
srcs = ["forkserver_bin.cc"], srcs = ["forkserver_bin.cc"],
copts = sapi_platform_copts(), copts = sapi_platform_copts(),
deps = [ deps = [
":client",
":comms", ":comms",
":forkserver", ":forkserver",
":sanitizer",
"//sandboxed_api/sandbox2/util:strerror", "//sandboxed_api/sandbox2/util:strerror",
"//sandboxed_api/util:raw_logging", "//sandboxed_api/util:raw_logging",
"@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/base:core_headers",
@ -211,10 +211,10 @@ cc_library(
hdrs = ["global_forkclient.h"], hdrs = ["global_forkclient.h"],
copts = sapi_platform_copts(), copts = sapi_platform_copts(),
deps = [ deps = [
":client",
":comms", ":comms",
":forkserver", ":forkserver",
":forkserver_bin_embed", ":forkserver_bin_embed",
":sanitizer",
"//sandboxed_api:embed_file", "//sandboxed_api:embed_file",
"//sandboxed_api/sandbox2/util:strerror", "//sandboxed_api/sandbox2/util:strerror",
"//sandboxed_api/util:raw_logging", "//sandboxed_api/util:raw_logging",
@ -277,6 +277,7 @@ cc_library(
":comms", ":comms",
":forkserver_cc_proto", ":forkserver_cc_proto",
":global_forkserver", ":global_forkserver",
":sanitizer",
":violation_cc_proto", ":violation_cc_proto",
":forkserver", ":forkserver",
":ipc", ":ipc",
@ -310,7 +311,6 @@ cc_library(
"//sandboxed_api/sandbox2/util:bpf_helper", "//sandboxed_api/sandbox2/util:bpf_helper",
"//sandboxed_api/sandbox2/util:file_base", "//sandboxed_api/sandbox2/util:file_base",
"//sandboxed_api/sandbox2/util:fileops", "//sandboxed_api/sandbox2/util:fileops",
"//sandboxed_api/sandbox2/util:strerror",
"//sandboxed_api/util:raw_logging", "//sandboxed_api/util:raw_logging",
"//sandboxed_api/util:status", "//sandboxed_api/util:status",
"//sandboxed_api/util:statusor", "//sandboxed_api/util:statusor",
@ -325,10 +325,7 @@ cc_library(
cc_library( cc_library(
name = "client", name = "client",
srcs = ["client.cc"], srcs = ["client.cc"],
hdrs = [ hdrs = ["client.h"],
"client.h",
"sanitizer.h",
],
copts = sapi_platform_copts(), copts = sapi_platform_copts(),
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
@ -336,11 +333,8 @@ cc_library(
":logsink", ":logsink",
":sanitizer", ":sanitizer",
"//sandboxed_api/sandbox2/network_proxy:client", "//sandboxed_api/sandbox2/network_proxy:client",
"//sandboxed_api/sandbox2/util:file_helpers",
"//sandboxed_api/sandbox2/util:fileops",
"//sandboxed_api/sandbox2/util:strerror", "//sandboxed_api/sandbox2/util:strerror",
"//sandboxed_api/util:raw_logging", "//sandboxed_api/util:raw_logging",
"//sandboxed_api/util:status",
"@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/memory", "@com_google_absl//absl/memory",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
@ -376,6 +370,7 @@ cc_library(
":forkserver_cc_proto", ":forkserver_cc_proto",
":namespace", ":namespace",
":policy", ":policy",
":sanitizer",
":syscall", ":syscall",
":util", ":util",
"//sandboxed_api/sandbox2/unwind", "//sandboxed_api/sandbox2/unwind",
@ -487,6 +482,7 @@ cc_library(
":client", ":client",
":comms", ":comms",
":forkserver", ":forkserver",
":sanitizer",
"@com_google_absl//absl/memory", "@com_google_absl//absl/memory",
], ],
) )
@ -710,9 +706,9 @@ cc_test(
copts = sapi_platform_copts(), copts = sapi_platform_copts(),
data = ["//sandboxed_api/sandbox2/testcases:sanitizer"], data = ["//sandboxed_api/sandbox2/testcases:sanitizer"],
deps = [ deps = [
":client",
":comms", ":comms",
":sandbox2", ":sandbox2",
":sanitizer",
":testing", ":testing",
":util", ":util",
"//sandboxed_api/sandbox2/util:bpf_helper", "//sandboxed_api/sandbox2/util:bpf_helper",

View File

@ -197,6 +197,7 @@ target_link_libraries(forkserver_bin PRIVATE
sandbox2::client sandbox2::client
sandbox2::comms sandbox2::comms
sandbox2::forkserver sandbox2::forkserver
sandbox2::sanitizer
sandbox2::strerror sandbox2::strerror
sapi::base sapi::base
sapi::raw_logging sapi::raw_logging
@ -223,6 +224,7 @@ target_link_libraries(sandbox2_global_forkserver PRIVATE
sandbox2::comms sandbox2::comms
sandbox2::forkserver sandbox2::forkserver
sandbox2::forkserver_bin_embed sandbox2::forkserver_bin_embed
sandbox2::sanitizer
sandbox2::strerror sandbox2::strerror
sapi::base sapi::base
sapi::embed_file sapi::embed_file
@ -295,6 +297,7 @@ target_link_libraries(sandbox2_sandbox2
sandbox2::ptrace_hook sandbox2::ptrace_hook
sandbox2::regs sandbox2::regs
sandbox2::result sandbox2::result
sandbox2::sanitizer
sandbox2::syscall sandbox2::syscall
sandbox2::unwind sandbox2::unwind
sandbox2::unwind_proto sandbox2::unwind_proto
@ -311,18 +314,15 @@ target_link_libraries(sandbox2_sandbox2
add_library(sandbox2_client STATIC add_library(sandbox2_client STATIC
client.cc client.cc
client.h client.h
sanitizer.cc
sanitizer.h
) )
add_library(sandbox2::client ALIAS sandbox2_client) add_library(sandbox2::client ALIAS sandbox2_client)
target_link_libraries(sandbox2_client target_link_libraries(sandbox2_client
PRIVATE absl::core_headers PRIVATE absl::core_headers
absl::memory absl::memory
absl::strings absl::strings
sandbox2::file_helpers
sandbox2::fileops
sandbox2::logsink sandbox2::logsink
sandbox2::network_proxy_client sandbox2::network_proxy_client
sandbox2::sanitizer
sandbox2::strerror sandbox2::strerror
sapi::base sapi::base
sapi::raw_logging sapi::raw_logging
@ -330,6 +330,23 @@ target_link_libraries(sandbox2_client
sandbox2::comms sandbox2::comms
) )
# sandboxed_api/sandbox2:sanitizer
add_library(sandbox2_sanitizer STATIC
sanitizer.cc
sanitizer.h
)
add_library(sandbox2::sanitizer ALIAS sandbox2_sanitizer)
target_link_libraries(sandbox2_sanitizer
PRIVATE absl::core_headers
absl::strings
sandbox2::file_helpers
sandbox2::fileops
sandbox2::strerror
sapi::base
sapi::raw_logging
PUBLIC glog::glog
)
# sandboxed_api/sandbox2:forkserver # sandboxed_api/sandbox2:forkserver
add_library(sandbox2_forkserver STATIC add_library(sandbox2_forkserver STATIC
forkserver.cc forkserver.cc
@ -351,6 +368,7 @@ target_link_libraries(sandbox2_forkserver PRIVATE
sandbox2::policy sandbox2::policy
sandbox2::ptrace_hook sandbox2::ptrace_hook
sandbox2::strerror sandbox2::strerror
sandbox2::sanitizer
sandbox2::syscall sandbox2::syscall
sandbox2::unwind sandbox2::unwind
sandbox2::unwind_proto sandbox2::unwind_proto
@ -416,6 +434,7 @@ add_library(sandbox2::forkingclient ALIAS sandbox2_forkingclient)
target_link_libraries(sandbox2_forkingclient target_link_libraries(sandbox2_forkingclient
PRIVATE absl::memory PRIVATE absl::memory
sandbox2::forkserver sandbox2::forkserver
sandbox2::sanitizer
sapi::base sapi::base
PUBLIC sandbox2::client PUBLIC sandbox2::client
) )
@ -772,6 +791,7 @@ if(SAPI_ENABLE_TESTS)
sandbox2::client sandbox2::client
sandbox2::comms sandbox2::comms
sandbox2::sandbox2 sandbox2::sandbox2
sandbox2::sanitizer
sandbox2::testing sandbox2::testing
sandbox2::util sandbox2::util
sapi::status_matchers sapi::status_matchers