Use Abseil's flag library released in aa468ad75539619b47979911297efbb629c52e44
PiperOrigin-RevId: 247424939 Change-Id: I22a4696f705f9dcfa7394b329c78bd126f42bd16pull/26/head
parent
7800fd7402
commit
5f3c7171b7
|
@ -20,8 +20,9 @@ load("//sandboxed_api/bazel:repositories.bzl", "autotools_repository")
|
||||||
# Abseil
|
# Abseil
|
||||||
http_archive(
|
http_archive(
|
||||||
name = "com_google_absl",
|
name = "com_google_absl",
|
||||||
strip_prefix = "abseil-cpp-master",
|
sha256 = "57cadb5f4e35e479de395490994db5cd91a23b3a4d6fba85ffbe86590d70f606", # 2019-05-07
|
||||||
urls = ["https://github.com/abseil/abseil-cpp/archive/master.zip"],
|
strip_prefix = "abseil-cpp-aa468ad75539619b47979911297efbb629c52e44",
|
||||||
|
urls = ["https://github.com/abseil/abseil-cpp/archive/aa468ad75539619b47979911297efbb629c52e44.zip"],
|
||||||
)
|
)
|
||||||
|
|
||||||
# Abseil-py
|
# Abseil-py
|
||||||
|
|
|
@ -7,7 +7,7 @@ set(EXTRA_CMAKE_ARGS)
|
||||||
|
|
||||||
ExternalProject_Add(absl
|
ExternalProject_Add(absl
|
||||||
GIT_REPOSITORY https://github.com/abseil/abseil-cpp.git
|
GIT_REPOSITORY https://github.com/abseil/abseil-cpp.git
|
||||||
GIT_TAG 88a152ae747c3c42dc9167d46c590929b048d436
|
GIT_TAG aa468ad75539619b47979911297efbb629c52e44 # 2019-05-07
|
||||||
# Just clone into directory
|
# Just clone into directory
|
||||||
CONFIGURE_COMMAND ""
|
CONFIGURE_COMMAND ""
|
||||||
BUILD_COMMAND ""
|
BUILD_COMMAND ""
|
||||||
|
|
|
@ -173,7 +173,7 @@ cc_library(
|
||||||
"//sandboxed_api/sandbox2:client",
|
"//sandboxed_api/sandbox2:client",
|
||||||
"//sandboxed_api/sandbox2:comms",
|
"//sandboxed_api/sandbox2:comms",
|
||||||
"//sandboxed_api/sandbox2:forkingclient",
|
"//sandboxed_api/sandbox2:forkingclient",
|
||||||
"//sandboxed_api/util:flag",
|
"@com_google_absl//absl/flags:flag",
|
||||||
"@com_google_absl//absl/strings",
|
"@com_google_absl//absl/strings",
|
||||||
"@com_google_glog//:glog",
|
"@com_google_glog//:glog",
|
||||||
"@com_google_protobuf//:protobuf",
|
"@com_google_protobuf//:protobuf",
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include "google/protobuf/descriptor.h"
|
#include "google/protobuf/descriptor.h"
|
||||||
#include "google/protobuf/message.h"
|
#include "google/protobuf/message.h"
|
||||||
#include "sandboxed_api/util/flag.h"
|
#include "absl/flags/flag.h"
|
||||||
#include "absl/strings/str_cat.h"
|
#include "absl/strings/str_cat.h"
|
||||||
#include "sandboxed_api/call.h"
|
#include "sandboxed_api/call.h"
|
||||||
#include "sandboxed_api/lenval_core.h"
|
#include "sandboxed_api/lenval_core.h"
|
||||||
|
|
|
@ -28,9 +28,9 @@ cc_test(
|
||||||
"//sandboxed_api:vars",
|
"//sandboxed_api:vars",
|
||||||
"//sandboxed_api/examples/stringop/lib:stringop-sapi",
|
"//sandboxed_api/examples/stringop/lib:stringop-sapi",
|
||||||
"//sandboxed_api/examples/stringop/lib:stringop_params_proto_cc",
|
"//sandboxed_api/examples/stringop/lib:stringop_params_proto_cc",
|
||||||
"//sandboxed_api/util:flag",
|
|
||||||
"//sandboxed_api/util:status",
|
"//sandboxed_api/util:status",
|
||||||
"//sandboxed_api/util:status_matchers",
|
"//sandboxed_api/util:status_matchers",
|
||||||
|
"@com_google_absl//absl/flags:flag",
|
||||||
"@com_google_absl//absl/memory",
|
"@com_google_absl//absl/memory",
|
||||||
"@com_google_absl//absl/time",
|
"@com_google_absl//absl/time",
|
||||||
"@com_google_googletest//:gtest_main",
|
"@com_google_googletest//:gtest_main",
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "sandboxed_api/util/flag.h"
|
#include "absl/flags/flag.h"
|
||||||
#include "absl/memory/memory.h"
|
#include "absl/memory/memory.h"
|
||||||
#include "absl/time/time.h"
|
#include "absl/time/time.h"
|
||||||
#include "sandboxed_api/examples/stringop/lib/sandbox.h"
|
#include "sandboxed_api/examples/stringop/lib/sandbox.h"
|
||||||
|
|
|
@ -26,8 +26,8 @@ cc_binary(
|
||||||
"//sandboxed_api:vars",
|
"//sandboxed_api:vars",
|
||||||
"//sandboxed_api/examples/sum/lib:sum-sapi",
|
"//sandboxed_api/examples/sum/lib:sum-sapi",
|
||||||
"//sandboxed_api/examples/sum/lib:sum_params_proto_cc",
|
"//sandboxed_api/examples/sum/lib:sum_params_proto_cc",
|
||||||
"//sandboxed_api/util:flag",
|
|
||||||
"//sandboxed_api/util:status",
|
"//sandboxed_api/util:status",
|
||||||
|
"@com_google_absl//absl/flags:flag",
|
||||||
"@com_google_absl//absl/memory",
|
"@com_google_absl//absl/memory",
|
||||||
"@com_google_absl//absl/strings",
|
"@com_google_absl//absl/strings",
|
||||||
],
|
],
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include "sandboxed_api/util/flag.h"
|
#include "absl/flags/flag.h"
|
||||||
#include "absl/memory/memory.h"
|
#include "absl/memory/memory.h"
|
||||||
#include "absl/strings/str_cat.h"
|
#include "absl/strings/str_cat.h"
|
||||||
#include "sandboxed_api/examples/sum/lib/sandbox.h"
|
#include "sandboxed_api/examples/sum/lib/sandbox.h"
|
||||||
|
|
|
@ -42,7 +42,7 @@ cc_binary(
|
||||||
":zlib-sapi",
|
":zlib-sapi",
|
||||||
":zlib-sapi_embed",
|
":zlib-sapi_embed",
|
||||||
"//sandboxed_api:vars",
|
"//sandboxed_api:vars",
|
||||||
"//sandboxed_api/util:flag",
|
|
||||||
"@com_google_absl//absl/base:core_headers",
|
"@com_google_absl//absl/base:core_headers",
|
||||||
|
"@com_google_absl//absl/flags:flag",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include "absl/base/macros.h"
|
#include "absl/base/macros.h"
|
||||||
#include "sandboxed_api/util/flag.h"
|
#include "absl/flags/flag.h"
|
||||||
#include "sandboxed_api/examples/zlib/zlib-sapi.sapi.h"
|
#include "sandboxed_api/examples/zlib/zlib-sapi.sapi.h"
|
||||||
#include "sandboxed_api/examples/zlib/zlib-sapi_embed.h"
|
#include "sandboxed_api/examples/zlib/zlib-sapi_embed.h"
|
||||||
#include "sandboxed_api/vars.h"
|
#include "sandboxed_api/vars.h"
|
||||||
|
|
|
@ -185,8 +185,8 @@ cc_library(
|
||||||
":syscall",
|
":syscall",
|
||||||
":violation_proto_cc",
|
":violation_proto_cc",
|
||||||
"//sandboxed_api/sandbox2/util:bpf_helper",
|
"//sandboxed_api/sandbox2/util:bpf_helper",
|
||||||
"//sandboxed_api/util:flag",
|
|
||||||
"@com_google_absl//absl/base:core_headers",
|
"@com_google_absl//absl/base:core_headers",
|
||||||
|
"@com_google_absl//absl/flags:flag",
|
||||||
"@com_google_absl//absl/types:optional",
|
"@com_google_absl//absl/types:optional",
|
||||||
"@org_kernel_libcap//:libcap",
|
"@org_kernel_libcap//:libcap",
|
||||||
],
|
],
|
||||||
|
@ -303,7 +303,7 @@ cc_library(
|
||||||
"@com_google_absl//absl/base:core_headers",
|
"@com_google_absl//absl/base:core_headers",
|
||||||
"@com_google_absl//absl/container:flat_hash_map",
|
"@com_google_absl//absl/container:flat_hash_map",
|
||||||
"@com_google_absl//absl/container:flat_hash_set",
|
"@com_google_absl//absl/container:flat_hash_set",
|
||||||
"//sandboxed_api/util:flag",
|
"@com_google_absl//absl/flags:flag",
|
||||||
"@com_google_absl//absl/memory",
|
"@com_google_absl//absl/memory",
|
||||||
"@com_google_absl//absl/strings",
|
"@com_google_absl//absl/strings",
|
||||||
"@com_google_absl//absl/strings:str_format",
|
"@com_google_absl//absl/strings:str_format",
|
||||||
|
@ -728,8 +728,8 @@ cc_test(
|
||||||
"//sandboxed_api/sandbox2/util:bpf_helper",
|
"//sandboxed_api/sandbox2/util:bpf_helper",
|
||||||
"//sandboxed_api/sandbox2/util:fileops",
|
"//sandboxed_api/sandbox2/util:fileops",
|
||||||
"//sandboxed_api/sandbox2/util:temp_file",
|
"//sandboxed_api/sandbox2/util:temp_file",
|
||||||
"//sandboxed_api/util:flag",
|
|
||||||
"//sandboxed_api/util:status_matchers",
|
"//sandboxed_api/util:status_matchers",
|
||||||
|
"@com_google_absl//absl/flags:flag",
|
||||||
"@com_google_absl//absl/memory",
|
"@com_google_absl//absl/memory",
|
||||||
"@com_google_absl//absl/strings",
|
"@com_google_absl//absl/strings",
|
||||||
"@com_google_googletest//:gtest_main",
|
"@com_google_googletest//:gtest_main",
|
||||||
|
|
|
@ -187,6 +187,7 @@ add_library(sandbox2_policy STATIC
|
||||||
add_library(sandbox2::policy ALIAS sandbox2_policy)
|
add_library(sandbox2::policy ALIAS sandbox2_policy)
|
||||||
target_link_libraries(sandbox2_policy PRIVATE
|
target_link_libraries(sandbox2_policy PRIVATE
|
||||||
absl::core_headers
|
absl::core_headers
|
||||||
|
absl::flags
|
||||||
absl::optional
|
absl::optional
|
||||||
libcap::libcap
|
libcap::libcap
|
||||||
sandbox2::bpf_helper
|
sandbox2::bpf_helper
|
||||||
|
@ -197,7 +198,6 @@ target_link_libraries(sandbox2_policy PRIVATE
|
||||||
sandbox2::syscall
|
sandbox2::syscall
|
||||||
sandbox2::violation_proto
|
sandbox2::violation_proto
|
||||||
sapi::base
|
sapi::base
|
||||||
sapi::flag
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# sandboxed_api/sandbox2:notify
|
# sandboxed_api/sandbox2:notify
|
||||||
|
@ -284,6 +284,7 @@ add_library(sandbox2::sandbox2 ALIAS sandbox2_sandbox2)
|
||||||
target_link_libraries(sandbox2_sandbox2
|
target_link_libraries(sandbox2_sandbox2
|
||||||
PRIVATE absl::core_headers
|
PRIVATE absl::core_headers
|
||||||
absl::flat_hash_map
|
absl::flat_hash_map
|
||||||
|
absl::flags
|
||||||
absl::flat_hash_set
|
absl::flat_hash_set
|
||||||
absl::memory
|
absl::memory
|
||||||
absl::optional
|
absl::optional
|
||||||
|
@ -318,8 +319,7 @@ target_link_libraries(sandbox2_sandbox2
|
||||||
sapi::base
|
sapi::base
|
||||||
sapi::status
|
sapi::status
|
||||||
sapi::statusor
|
sapi::statusor
|
||||||
PUBLIC sapi::flag
|
PUBLIC sandbox2::logsink
|
||||||
sandbox2::logsink
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# sandboxed_api/sandbox2:client
|
# sandboxed_api/sandbox2:client
|
||||||
|
@ -770,6 +770,7 @@ add_dependencies(stack-trace_test
|
||||||
sandbox2::testcase_symbolize
|
sandbox2::testcase_symbolize
|
||||||
)
|
)
|
||||||
target_link_libraries(stack-trace_test PRIVATE
|
target_link_libraries(stack-trace_test PRIVATE
|
||||||
|
absl::flags
|
||||||
absl::memory
|
absl::memory
|
||||||
absl::strings
|
absl::strings
|
||||||
sandbox2::bpf_helper
|
sandbox2::bpf_helper
|
||||||
|
@ -781,7 +782,6 @@ target_link_libraries(stack-trace_test PRIVATE
|
||||||
sandbox2::util
|
sandbox2::util
|
||||||
sapi::status_matchers
|
sapi::status_matchers
|
||||||
sapi::test_main
|
sapi::test_main
|
||||||
sapi::flag
|
|
||||||
)
|
)
|
||||||
gtest_discover_tests(stack-trace_test PROPERTIES
|
gtest_discover_tests(stack-trace_test PROPERTIES
|
||||||
ENVIRONMENT "TEST_TMPDIR=/tmp"
|
ENVIRONMENT "TEST_TMPDIR=/tmp"
|
||||||
|
@ -796,6 +796,7 @@ add_dependencies(ipc_test
|
||||||
sandbox2::testcase_ipc
|
sandbox2::testcase_ipc
|
||||||
)
|
)
|
||||||
target_link_libraries(ipc_test PRIVATE
|
target_link_libraries(ipc_test PRIVATE
|
||||||
|
absl::flags
|
||||||
absl::memory
|
absl::memory
|
||||||
sandbox2::bpf_helper
|
sandbox2::bpf_helper
|
||||||
sandbox2::comms
|
sandbox2::comms
|
||||||
|
@ -803,7 +804,6 @@ target_link_libraries(ipc_test PRIVATE
|
||||||
sandbox2::testing
|
sandbox2::testing
|
||||||
sapi::status_matchers
|
sapi::status_matchers
|
||||||
sapi::test_main
|
sapi::test_main
|
||||||
sapi::flag
|
|
||||||
)
|
)
|
||||||
gtest_discover_tests(ipc_test PROPERTIES
|
gtest_discover_tests(ipc_test PROPERTIES
|
||||||
ENVIRONMENT "TEST_TMPDIR=/tmp"
|
ENVIRONMENT "TEST_TMPDIR=/tmp"
|
||||||
|
@ -845,6 +845,7 @@ add_dependencies(policybuilder_test
|
||||||
sandbox2::testcase_print_fds
|
sandbox2::testcase_print_fds
|
||||||
)
|
)
|
||||||
target_link_libraries(policybuilder_test PRIVATE
|
target_link_libraries(policybuilder_test PRIVATE
|
||||||
|
absl::flags
|
||||||
absl::memory
|
absl::memory
|
||||||
absl::strings
|
absl::strings
|
||||||
glog::glog
|
glog::glog
|
||||||
|
@ -854,7 +855,6 @@ target_link_libraries(policybuilder_test PRIVATE
|
||||||
sandbox2::testing
|
sandbox2::testing
|
||||||
sapi::status_matchers
|
sapi::status_matchers
|
||||||
sapi::test_main
|
sapi::test_main
|
||||||
sapi::flag
|
|
||||||
)
|
)
|
||||||
gtest_discover_tests(policybuilder_test PROPERTIES
|
gtest_discover_tests(policybuilder_test PROPERTIES
|
||||||
ENVIRONMENT "TEST_TMPDIR=/tmp"
|
ENVIRONMENT "TEST_TMPDIR=/tmp"
|
||||||
|
|
|
@ -34,7 +34,7 @@ cc_binary(
|
||||||
"//sandboxed_api/sandbox2:comms",
|
"//sandboxed_api/sandbox2:comms",
|
||||||
"//sandboxed_api/sandbox2/util:bpf_helper",
|
"//sandboxed_api/sandbox2/util:bpf_helper",
|
||||||
"//sandboxed_api/sandbox2/util:runfiles",
|
"//sandboxed_api/sandbox2/util:runfiles",
|
||||||
"//sandboxed_api/util:flag",
|
"@com_google_absl//absl/flags:flag",
|
||||||
"@com_google_absl//absl/memory",
|
"@com_google_absl//absl/memory",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -48,8 +48,8 @@ cc_binary(
|
||||||
"//sandboxed_api/sandbox2:client",
|
"//sandboxed_api/sandbox2:client",
|
||||||
"//sandboxed_api/sandbox2:comms",
|
"//sandboxed_api/sandbox2:comms",
|
||||||
"//sandboxed_api/sandbox2:util",
|
"//sandboxed_api/sandbox2:util",
|
||||||
"//sandboxed_api/util:flag",
|
|
||||||
"@com_google_absl//absl/base:core_headers",
|
"@com_google_absl//absl/base:core_headers",
|
||||||
|
"@com_google_absl//absl/flags:flag",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include "sandboxed_api/util/flag.h"
|
#include "absl/flags/flag.h"
|
||||||
#include "sandboxed_api/sandbox2/client.h"
|
#include "sandboxed_api/sandbox2/client.h"
|
||||||
#include "sandboxed_api/sandbox2/comms.h"
|
#include "sandboxed_api/sandbox2/comms.h"
|
||||||
#include "sandboxed_api/sandbox2/util.h"
|
#include "sandboxed_api/sandbox2/util.h"
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include "sandboxed_api/util/flag.h"
|
#include "absl/flags/flag.h"
|
||||||
#include "absl/memory/memory.h"
|
#include "absl/memory/memory.h"
|
||||||
#include "sandboxed_api/sandbox2/comms.h"
|
#include "sandboxed_api/sandbox2/comms.h"
|
||||||
#include "sandboxed_api/sandbox2/executor.h"
|
#include "sandboxed_api/sandbox2/executor.h"
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
#include "sandboxed_api/sandbox2/util/bpf_helper.h"
|
#include "sandboxed_api/sandbox2/util/bpf_helper.h"
|
||||||
#include "sandboxed_api/sandbox2/util/runfiles.h"
|
#include "sandboxed_api/sandbox2/util/runfiles.h"
|
||||||
|
|
||||||
ABSL_FLAG(string, input, "", "Input to calculate CRC4 of.");
|
ABSL_FLAG(std::string, input, "", "Input to calculate CRC4 of.");
|
||||||
ABSL_FLAG(bool, call_syscall_not_allowed, false,
|
ABSL_FLAG(bool, call_syscall_not_allowed, false,
|
||||||
"Have sandboxee call clone (violation).");
|
"Have sandboxee call clone (violation).");
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,9 @@ cc_binary(
|
||||||
"//sandboxed_api/sandbox2:comms",
|
"//sandboxed_api/sandbox2:comms",
|
||||||
"//sandboxed_api/sandbox2:forkserver",
|
"//sandboxed_api/sandbox2:forkserver",
|
||||||
"//sandboxed_api/sandbox2/util:runfiles",
|
"//sandboxed_api/sandbox2/util:runfiles",
|
||||||
"//sandboxed_api/util:flag",
|
|
||||||
"//sandboxed_api/util:raw_logging",
|
"//sandboxed_api/util:raw_logging",
|
||||||
"@com_google_absl//absl/base:core_headers",
|
"@com_google_absl//absl/base:core_headers",
|
||||||
|
"@com_google_absl//absl/flags:flag",
|
||||||
"@com_google_absl//absl/memory",
|
"@com_google_absl//absl/memory",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -46,7 +46,7 @@ cc_binary(
|
||||||
deps = [
|
deps = [
|
||||||
"//sandboxed_api/sandbox2:comms",
|
"//sandboxed_api/sandbox2:comms",
|
||||||
"//sandboxed_api/sandbox2:forkingclient",
|
"//sandboxed_api/sandbox2:forkingclient",
|
||||||
"//sandboxed_api/util:flag",
|
|
||||||
"//sandboxed_api/util:raw_logging",
|
"//sandboxed_api/util:raw_logging",
|
||||||
|
"@com_google_absl//absl/flags:flag",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
#include "sandboxed_api/util/flag.h"
|
#include "absl/flags/flag.h"
|
||||||
#include "sandboxed_api/sandbox2/comms.h"
|
#include "sandboxed_api/sandbox2/comms.h"
|
||||||
#include "sandboxed_api/sandbox2/forkingclient.h"
|
#include "sandboxed_api/sandbox2/forkingclient.h"
|
||||||
#include "sandboxed_api/util/raw_logging.h"
|
#include "sandboxed_api/util/raw_logging.h"
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include "sandboxed_api/util/flag.h"
|
#include "absl/flags/flag.h"
|
||||||
#include "absl/memory/memory.h"
|
#include "absl/memory/memory.h"
|
||||||
#include "sandboxed_api/sandbox2/comms.h"
|
#include "sandboxed_api/sandbox2/comms.h"
|
||||||
#include "sandboxed_api/sandbox2/executor.h"
|
#include "sandboxed_api/sandbox2/executor.h"
|
||||||
|
|
|
@ -33,7 +33,7 @@ cc_binary(
|
||||||
"//sandboxed_api/sandbox2",
|
"//sandboxed_api/sandbox2",
|
||||||
"//sandboxed_api/sandbox2/util:bpf_helper",
|
"//sandboxed_api/sandbox2/util:bpf_helper",
|
||||||
"//sandboxed_api/sandbox2/util:runfiles",
|
"//sandboxed_api/sandbox2/util:runfiles",
|
||||||
"//sandboxed_api/util:flag",
|
"@com_google_absl//absl/flags:flag",
|
||||||
"@com_google_absl//absl/memory",
|
"@com_google_absl//absl/memory",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include "sandboxed_api/util/flag.h"
|
#include "absl/flags/flag.h"
|
||||||
#include "absl/memory/memory.h"
|
#include "absl/memory/memory.h"
|
||||||
#include "sandboxed_api/sandbox2/executor.h"
|
#include "sandboxed_api/sandbox2/executor.h"
|
||||||
#include "sandboxed_api/sandbox2/ipc.h"
|
#include "sandboxed_api/sandbox2/ipc.h"
|
||||||
|
|
|
@ -33,7 +33,7 @@ cc_binary(
|
||||||
"//sandboxed_api/sandbox2",
|
"//sandboxed_api/sandbox2",
|
||||||
"//sandboxed_api/sandbox2:util",
|
"//sandboxed_api/sandbox2:util",
|
||||||
"//sandboxed_api/sandbox2/util:bpf_helper",
|
"//sandboxed_api/sandbox2/util:bpf_helper",
|
||||||
"//sandboxed_api/util:flag",
|
"@com_google_absl//absl/flags:flag",
|
||||||
"@com_google_absl//absl/memory",
|
"@com_google_absl//absl/memory",
|
||||||
"@com_google_absl//absl/strings",
|
"@com_google_absl//absl/strings",
|
||||||
"@com_google_absl//absl/strings:str_format",
|
"@com_google_absl//absl/strings:str_format",
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include "sandboxed_api/util/flag.h"
|
#include "absl/flags/flag.h"
|
||||||
#include "absl/memory/memory.h"
|
#include "absl/memory/memory.h"
|
||||||
#include "absl/strings/str_format.h"
|
#include "absl/strings/str_format.h"
|
||||||
#include "absl/strings/str_split.h"
|
#include "absl/strings/str_split.h"
|
||||||
|
@ -69,9 +69,9 @@ ABSL_FLAG(uint64_t, sandbox2tool_walltime_timeout, 60U,
|
||||||
"Wall-time timeout in seconds (if >0)");
|
"Wall-time timeout in seconds (if >0)");
|
||||||
ABSL_FLAG(uint64_t, sandbox2tool_file_size_creation_limit, 1024U,
|
ABSL_FLAG(uint64_t, sandbox2tool_file_size_creation_limit, 1024U,
|
||||||
"Maximum size of created files");
|
"Maximum size of created files");
|
||||||
ABSL_FLAG(string, sandbox2tool_cwd, "/",
|
ABSL_FLAG(std::string, sandbox2tool_cwd, "/",
|
||||||
"If not empty, chdir to the directory before sandboxed");
|
"If not empty, chdir to the directory before sandboxed");
|
||||||
ABSL_FLAG(string, sandbox2tool_additional_bind_mounts, "",
|
ABSL_FLAG(std::string, sandbox2tool_additional_bind_mounts, "",
|
||||||
"If user namespaces are enabled, this option will add additional "
|
"If user namespaces are enabled, this option will add additional "
|
||||||
"bind mounts. Mounts are separated by comma and can optionally "
|
"bind mounts. Mounts are separated by comma and can optionally "
|
||||||
"specify a target using \"=>\" "
|
"specify a target using \"=>\" "
|
||||||
|
|
|
@ -27,7 +27,7 @@ cc_binary(
|
||||||
"//sandboxed_api/sandbox2:comms",
|
"//sandboxed_api/sandbox2:comms",
|
||||||
"//sandboxed_api/sandbox2/util:bpf_helper",
|
"//sandboxed_api/sandbox2/util:bpf_helper",
|
||||||
"//sandboxed_api/sandbox2/util:runfiles",
|
"//sandboxed_api/sandbox2/util:runfiles",
|
||||||
"//sandboxed_api/util:flag",
|
"@com_google_absl//absl/flags:flag",
|
||||||
"@com_google_absl//absl/memory",
|
"@com_google_absl//absl/memory",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include "sandboxed_api/util/flag.h"
|
#include "absl/flags/flag.h"
|
||||||
#include "absl/memory/memory.h"
|
#include "absl/memory/memory.h"
|
||||||
#include "sandboxed_api/sandbox2/comms.h"
|
#include "sandboxed_api/sandbox2/comms.h"
|
||||||
#include "sandboxed_api/sandbox2/executor.h"
|
#include "sandboxed_api/sandbox2/executor.h"
|
||||||
|
@ -40,8 +40,8 @@
|
||||||
#include "sandboxed_api/sandbox2/util/bpf_helper.h"
|
#include "sandboxed_api/sandbox2/util/bpf_helper.h"
|
||||||
#include "sandboxed_api/sandbox2/util/runfiles.h"
|
#include "sandboxed_api/sandbox2/util/runfiles.h"
|
||||||
|
|
||||||
ABSL_FLAG(string, input, "", "Input file");
|
ABSL_FLAG(std::string, input, "", "Input file");
|
||||||
ABSL_FLAG(string, output, "", "Output file");
|
ABSL_FLAG(std::string, output, "", "Output file");
|
||||||
ABSL_FLAG(bool, decompress, false, "Decompress instead of compress.");
|
ABSL_FLAG(bool, decompress, false, "Decompress instead of compress.");
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include "sandboxed_api/util/flag.h"
|
#include "absl/flags/flag.h"
|
||||||
#include "absl/memory/memory.h"
|
#include "absl/memory/memory.h"
|
||||||
#include "absl/strings/str_cat.h"
|
#include "absl/strings/str_cat.h"
|
||||||
#include "absl/strings/str_format.h"
|
#include "absl/strings/str_format.h"
|
||||||
|
@ -69,7 +69,7 @@ ABSL_FLAG(bool, sandbox2_report_on_sandboxee_timeout, true,
|
||||||
"Report sandbox2 sandboxee timeouts");
|
"Report sandbox2 sandboxee timeouts");
|
||||||
|
|
||||||
ABSL_DECLARE_FLAG(bool, sandbox2_danger_danger_permit_all);
|
ABSL_DECLARE_FLAG(bool, sandbox2_danger_danger_permit_all);
|
||||||
ABSL_DECLARE_FLAG(string, sandbox2_danger_danger_permit_all_and_log);
|
ABSL_DECLARE_FLAG(std::string, sandbox2_danger_danger_permit_all_and_log);
|
||||||
|
|
||||||
namespace sandbox2 {
|
namespace sandbox2 {
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include "sandboxed_api/util/flag.h"
|
#include "absl/flags/flag.h"
|
||||||
#include "external/org_kernel_libcap/libcap/include/sys/capability.h"
|
#include "external/org_kernel_libcap/libcap/include/sys/capability.h"
|
||||||
#include "sandboxed_api/sandbox2/bpfdisassembler.h"
|
#include "sandboxed_api/sandbox2/bpfdisassembler.h"
|
||||||
#include "sandboxed_api/sandbox2/comms.h"
|
#include "sandboxed_api/sandbox2/comms.h"
|
||||||
|
@ -37,8 +37,7 @@
|
||||||
|
|
||||||
ABSL_FLAG(bool, sandbox2_danger_danger_permit_all, false,
|
ABSL_FLAG(bool, sandbox2_danger_danger_permit_all, false,
|
||||||
"Allow all syscalls, useful for testing");
|
"Allow all syscalls, useful for testing");
|
||||||
|
ABSL_FLAG(std::string, sandbox2_danger_danger_permit_all_and_log, "",
|
||||||
ABSL_FLAG(string, sandbox2_danger_danger_permit_all_and_log, "",
|
|
||||||
"Allow all syscalls and log them into specified file");
|
"Allow all syscalls and log them into specified file");
|
||||||
|
|
||||||
namespace sandbox2 {
|
namespace sandbox2 {
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include "sandboxed_api/util/flag.h"
|
#include "absl/flags/flag.h"
|
||||||
#include "absl/memory/memory.h"
|
#include "absl/memory/memory.h"
|
||||||
#include "absl/strings/numbers.h"
|
#include "absl/strings/numbers.h"
|
||||||
#include "absl/strings/str_cat.h"
|
#include "absl/strings/str_cat.h"
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "sandboxed_api/util/flag.h"
|
#include "absl/flags/flag.h"
|
||||||
#include "sandboxed_api/sandbox2/mounts.h"
|
#include "sandboxed_api/sandbox2/mounts.h"
|
||||||
#include "sandboxed_api/sandbox2/policy.h"
|
#include "sandboxed_api/sandbox2/policy.h"
|
||||||
#include "sandboxed_api/sandbox2/regs.h"
|
#include "sandboxed_api/sandbox2/regs.h"
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "sandboxed_api/util/flag.h"
|
#include "absl/flags/flag.h"
|
||||||
#include "absl/memory/memory.h"
|
#include "absl/memory/memory.h"
|
||||||
#include "absl/strings/match.h"
|
#include "absl/strings/match.h"
|
||||||
#include "absl/strings/str_cat.h"
|
#include "absl/strings/str_cat.h"
|
||||||
|
@ -48,7 +48,7 @@ namespace {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class TemporaryFlagOverride {
|
class TemporaryFlagOverride {
|
||||||
public:
|
public:
|
||||||
using Flag = T;
|
using Flag = absl::Flag<T>;
|
||||||
TemporaryFlagOverride(Flag* flag, T value)
|
TemporaryFlagOverride(Flag* flag, T value)
|
||||||
: flag_(flag), original_value_(absl::GetFlag(*flag)) {
|
: flag_(flag), original_value_(absl::GetFlag(*flag)) {
|
||||||
absl::SetFlag(flag, value);
|
absl::SetFlag(flag, value);
|
||||||
|
|
|
@ -221,9 +221,9 @@ cc_library(
|
||||||
copts = sapi_platform_copts(),
|
copts = sapi_platform_copts(),
|
||||||
deps = [
|
deps = [
|
||||||
":file_base",
|
":file_base",
|
||||||
"//sandboxed_api/util:flag",
|
|
||||||
"//sandboxed_api/util:raw_logging",
|
"//sandboxed_api/util:raw_logging",
|
||||||
"@bazel_tools//tools/cpp/runfiles",
|
"@bazel_tools//tools/cpp/runfiles",
|
||||||
|
"@com_google_absl//absl/flags:flag",
|
||||||
"@com_google_absl//absl/strings",
|
"@com_google_absl//absl/strings",
|
||||||
"@com_google_absl//absl/strings:str_format",
|
"@com_google_absl//absl/strings:str_format",
|
||||||
],
|
],
|
||||||
|
|
|
@ -210,10 +210,10 @@ add_library(sandbox2_util_runfiles STATIC
|
||||||
)
|
)
|
||||||
add_library(sandbox2::runfiles ALIAS sandbox2_util_runfiles)
|
add_library(sandbox2::runfiles ALIAS sandbox2_util_runfiles)
|
||||||
target_link_libraries(sandbox2_util_runfiles PRIVATE
|
target_link_libraries(sandbox2_util_runfiles PRIVATE
|
||||||
|
absl::flags
|
||||||
absl::str_format
|
absl::str_format
|
||||||
absl::strings
|
absl::strings
|
||||||
sandbox2::file_base
|
sandbox2::file_base
|
||||||
sapi::base
|
sapi::base
|
||||||
sapi::flag
|
|
||||||
sapi::raw_logging
|
sapi::raw_logging
|
||||||
)
|
)
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
|
#include "absl/flags/internal/program_name.h"
|
||||||
#include "absl/strings/str_format.h"
|
#include "absl/strings/str_format.h"
|
||||||
#include "sandboxed_api/sandbox2/util/path.h"
|
#include "sandboxed_api/sandbox2/util/path.h"
|
||||||
#include "sandboxed_api/sandbox2/util/runfiles.h"
|
#include "sandboxed_api/sandbox2/util/runfiles.h"
|
||||||
#include "sandboxed_api/util/flag.h"
|
|
||||||
#include "sandboxed_api/util/raw_logging.h"
|
#include "sandboxed_api/util/raw_logging.h"
|
||||||
#include "tools/cpp/runfiles/runfiles.h"
|
#include "tools/cpp/runfiles/runfiles.h"
|
||||||
|
|
||||||
|
@ -28,7 +28,8 @@ namespace sandbox2 {
|
||||||
std::string GetDataDependencyFilePath(absl::string_view relative_path) {
|
std::string GetDataDependencyFilePath(absl::string_view relative_path) {
|
||||||
static Runfiles* runfiles = []() {
|
static Runfiles* runfiles = []() {
|
||||||
std::string error;
|
std::string error;
|
||||||
auto* runfiles = Runfiles::Create(gflags::GetArgv0(), &error);
|
auto* runfiles =
|
||||||
|
Runfiles::Create(absl::flags_internal::ProgramInvocationName(), &error);
|
||||||
SAPI_RAW_CHECK(runfiles != nullptr, "%s", error);
|
SAPI_RAW_CHECK(runfiles != nullptr, "%s", error);
|
||||||
|
|
||||||
// Setup environment for child processes.
|
// Setup environment for child processes.
|
||||||
|
|
|
@ -115,14 +115,6 @@ cc_test(
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
# Compatibility layer for Abseil's flags vs. gFlags
|
|
||||||
cc_library(
|
|
||||||
name = "flag",
|
|
||||||
hdrs = ["flag.h"],
|
|
||||||
copts = sapi_platform_copts(),
|
|
||||||
deps = ["@com_github_gflags_gflags//:gflags"],
|
|
||||||
)
|
|
||||||
|
|
||||||
# Small support library emulating verbose logging using Abseil's raw logging
|
# Small support library emulating verbose logging using Abseil's raw logging
|
||||||
# facility.
|
# facility.
|
||||||
cc_library(
|
cc_library(
|
||||||
|
|
|
@ -81,15 +81,6 @@ target_link_libraries(status_test PRIVATE
|
||||||
)
|
)
|
||||||
gtest_discover_tests(status_test)
|
gtest_discover_tests(status_test)
|
||||||
|
|
||||||
# sandboxed_api/util:flag
|
|
||||||
add_library(sapi_util_flag STATIC
|
|
||||||
flag.h
|
|
||||||
)
|
|
||||||
add_library(sapi::flag ALIAS sapi_util_flag)
|
|
||||||
target_link_libraries(sapi_util_flag PUBLIC
|
|
||||||
gflags
|
|
||||||
)
|
|
||||||
|
|
||||||
# sandboxed_api/util:raw_logging
|
# sandboxed_api/util:raw_logging
|
||||||
add_library(sapi_util_raw_logging STATIC
|
add_library(sapi_util_raw_logging STATIC
|
||||||
raw_logging.cc
|
raw_logging.cc
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
// Copyright 2019 Google LLC. All Rights Reserved.
|
|
||||||
//
|
|
||||||
// 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.
|
|
||||||
|
|
||||||
#ifndef SANDBOXED_API_UTIL_FLAG_H_
|
|
||||||
#define SANDBOXED_API_UTIL_FLAG_H_
|
|
||||||
|
|
||||||
#include <gflags/gflags.h>
|
|
||||||
|
|
||||||
#define ABSL_FLAG(type, name, default_value, help) \
|
|
||||||
DEFINE_##type(name, default_value, help)
|
|
||||||
#define ABSL_RETIRED_FLAG ABSL_FLAG
|
|
||||||
#define ABSL_DECLARE_FLAG(type, name) DECLARE_##type(name)
|
|
||||||
|
|
||||||
// Internal defines for compatility with gflags and standard integer types.
|
|
||||||
#define DECLARE_int32_t DECLARE_int32
|
|
||||||
#define DECLARE_int64_t DECLARE_int64
|
|
||||||
#define DECLARE_uint32_t DECLARE_uint32
|
|
||||||
#define DECLARE_uint64_t DECLARE_uint64
|
|
||||||
#define DEFINE_int32_t DEFINE_int32
|
|
||||||
#define DEFINE_int64_t DEFINE_int64
|
|
||||||
#define DEFINE_uint32_t DEFINE_uint32
|
|
||||||
#define DEFINE_uint64_t DEFINE_uint64
|
|
||||||
|
|
||||||
namespace absl {
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
const T& GetFlag(const T& flag) {
|
|
||||||
return flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
void SetFlag(T* flag, const T& value) {
|
|
||||||
*flag = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace absl
|
|
||||||
|
|
||||||
#endif // SANDBOXED_API_UTIL_FLAG_H_
|
|
Loading…
Reference in New Issue