Skip to content

Commit

Permalink
Use Abseil's VLOG
Browse files Browse the repository at this point in the history
Drive-by: IWUY fixes
PiperOrigin-RevId: 622852668
Change-Id: I4f28f3bb7909f0820c34e025a0d8c40cd31a358e
  • Loading branch information
happyCoder92 authored and Copybara-Service committed Apr 8, 2024
1 parent 59c2104 commit 7c1e23c
Show file tree
Hide file tree
Showing 20 changed files with 25 additions and 62 deletions.
7 changes: 2 additions & 5 deletions sandboxed_api/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,15 @@ cc_library(
copts = sapi_platform_copts(),
visibility = ["//visibility:public"],
deps = [
":call",
":config",
":embed_file",
":var_type",
":vars",
"//sandboxed_api/sandbox2",
"//sandboxed_api/sandbox2:client",
"//sandboxed_api/sandbox2:comms",
"//sandboxed_api/sandbox2/util:bpf_helper",
"//sandboxed_api/util:file_base",
"//sandboxed_api/util:fileops",
"//sandboxed_api/util:raw_logging",
"//sandboxed_api/util:runfiles",
"//sandboxed_api/util:status",
"@com_google_absl//absl/base:core_headers",
Expand Down Expand Up @@ -155,7 +154,6 @@ cc_library(
":proto_arg_cc_proto",
":var_type",
"//sandboxed_api/sandbox2:comms",
"//sandboxed_api/util:raw_logging",
"//sandboxed_api/util:status",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/log",
Expand Down Expand Up @@ -184,7 +182,6 @@ cc_library(
"//sandboxed_api/sandbox2:comms",
"//sandboxed_api/sandbox2:forkingclient",
"//sandboxed_api/sandbox2:logsink",
"//sandboxed_api/util:raw_logging",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/base:dynamic_annotations",
"@com_google_absl//absl/flags:parse",
Expand Down
4 changes: 2 additions & 2 deletions sandboxed_api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ target_link_libraries(sapi_sapi
absl::str_format
absl::strings
absl::synchronization
sandbox2::bpf_helper
sapi::call
sapi::file_base
sapi::fileops
sapi::runfiles
sapi::strerror
sandbox2::util
sapi::embed_file
sapi::var_type
sapi::vars
PUBLIC absl::check
absl::core_headers
Expand Down
1 change: 0 additions & 1 deletion sandboxed_api/client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#include "sandboxed_api/sandbox2/comms.h"
#include "sandboxed_api/sandbox2/forkingclient.h"
#include "sandboxed_api/sandbox2/logsink.h"
#include "sandboxed_api/util/raw_logging.h"
#include "sandboxed_api/var_type.h"

#include <ffi.h>
Expand Down
1 change: 0 additions & 1 deletion sandboxed_api/rpcchannel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "absl/synchronization/mutex.h"
#include "sandboxed_api/call.h"
#include "sandboxed_api/sandbox2/comms.h"
#include "sandboxed_api/util/raw_logging.h"
#include "sandboxed_api/util/status_macros.h"

namespace sapi {
Expand Down
8 changes: 5 additions & 3 deletions sandboxed_api/sandbox.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "absl/strings/string_view.h"
#include "absl/time/time.h"
#include "absl/types/span.h"
#include "sandboxed_api/call.h"
#include "sandboxed_api/config.h"
#include "sandboxed_api/embed_file.h"
#include "sandboxed_api/rpcchannel.h"
Expand All @@ -45,14 +46,15 @@
#include "sandboxed_api/sandbox2/policybuilder.h"
#include "sandboxed_api/sandbox2/result.h"
#include "sandboxed_api/sandbox2/sandbox2.h"
#include "sandboxed_api/sandbox2/util/bpf_helper.h"
#include "sandboxed_api/util/fileops.h"
#include "sandboxed_api/util/path.h"
#include "sandboxed_api/util/raw_logging.h"
#include "sandboxed_api/util/runfiles.h"
#include "sandboxed_api/util/status_macros.h"
#include "sandboxed_api/var_abstract.h"
#include "sandboxed_api/var_array.h"
#include "sandboxed_api/var_int.h"
#include "sandboxed_api/var_ptr.h"
#include "sandboxed_api/var_reg.h"
#include "sandboxed_api/var_type.h"

namespace sapi {

Expand Down
11 changes: 2 additions & 9 deletions sandboxed_api/sandbox2/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ cc_library(
":comms",
":logserver",
":logsink",
"//sandboxed_api/util:raw_logging",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/log",
"@com_google_absl//absl/strings",
Expand All @@ -241,7 +240,6 @@ cc_library(
"//sandboxed_api:config",
"//sandboxed_api/sandbox2/network_proxy:filtering",
"//sandboxed_api/sandbox2/util:bpf_helper",
"//sandboxed_api/util:raw_logging",
"@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/log",
"@com_google_absl//absl/strings:string_view",
Expand Down Expand Up @@ -353,7 +351,6 @@ cc_library(
":util",
"//sandboxed_api:config",
"//sandboxed_api/util:fileops",
"//sandboxed_api/util:raw_logging",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/log",
"@com_google_absl//absl/log:check",
Expand Down Expand Up @@ -447,7 +444,6 @@ cc_library(
"//sandboxed_api/sandbox2/unwind:unwind_cc_proto",
"//sandboxed_api/util:file_base",
"//sandboxed_api/util:fileops",
"//sandboxed_api/util:raw_logging",
"//sandboxed_api/util:status",
"@com_google_absl//absl/cleanup",
"@com_google_absl//absl/flags:flag",
Expand Down Expand Up @@ -479,7 +475,6 @@ cc_library(
":syscall",
":util",
"//sandboxed_api:config",
"//sandboxed_api/util:raw_logging",
"//sandboxed_api/util:status",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/cleanup",
Expand All @@ -488,6 +483,7 @@ cc_library(
"@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/log",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/log:vlog_is_on",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings",
Expand All @@ -512,7 +508,6 @@ cc_library(
":result",
"//sandboxed_api:config",
"//sandboxed_api/util:fileops",
"//sandboxed_api/util:raw_logging",
"//sandboxed_api/util:status",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/cleanup",
Expand Down Expand Up @@ -552,14 +547,14 @@ cc_library(
"//sandboxed_api/sandbox2/network_proxy:client",
"//sandboxed_api/sandbox2/network_proxy:server",
"//sandboxed_api/util:file_helpers",
"//sandboxed_api/util:raw_logging",
"//sandboxed_api/util:strerror",
"//sandboxed_api/util:temp_file",
"@com_google_absl//absl/base",
"@com_google_absl//absl/cleanup",
"@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/log",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/log:vlog_is_on",
"@com_google_absl//absl/memory",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
Expand Down Expand Up @@ -779,7 +774,6 @@ cc_library(
":comms",
":forkserver",
":sanitizer",
"//sandboxed_api/util:raw_logging",
"@com_google_absl//absl/log",
"@com_google_absl//absl/log:check",
],
Expand Down Expand Up @@ -907,7 +901,6 @@ cc_test(
":global_forkserver",
":sandbox2",
"//sandboxed_api:testing",
"//sandboxed_api/util:raw_logging",
"@com_google_absl//absl/log",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/strings",
Expand Down
16 changes: 8 additions & 8 deletions sandboxed_api/sandbox2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ target_link_libraries(sandbox2_ipc PRIVATE
sandbox2::network_proxy_client
sandbox2::network_proxy_server
sapi::base
sapi::raw_logging
)

# sandboxed_api/sandbox2:policy
Expand Down Expand Up @@ -392,7 +391,6 @@ target_link_libraries(sandbox2_stack_trace
sapi::config
sapi::file_base
sapi::fileops
sapi::raw_logging
sapi::status
PUBLIC absl::check
absl::statusor
Expand All @@ -412,9 +410,15 @@ add_library(sandbox2_monitor_base ${SAPI_LIB_TYPE}
)
add_library(sandbox2::monitor_base ALIAS sandbox2_monitor_base)
target_link_libraries(sandbox2_monitor_base
PRIVATE absl::cleanup
PRIVATE absl::bind_front
absl::check
absl::cleanup
absl::flags
absl::log
absl::status
absl::strings
absl::time
absl::vlog_is_on
sandbox2::client
sandbox2::limits
sandbox2::mounts
Expand All @@ -424,7 +428,6 @@ target_link_libraries(sandbox2_monitor_base
sapi::file_helpers
sapi::temp_file
sapi::base
sapi::raw_logging
PUBLIC absl::statusor
absl::synchronization
sandbox2::comms
Expand Down Expand Up @@ -456,6 +459,7 @@ target_link_libraries(sandbox2_monitor_ptrace
absl::str_format
absl::strings
absl::time
absl::vlog_is_on
sapi::base
sapi::config
sapi::status
Expand All @@ -473,7 +477,6 @@ target_link_libraries(sandbox2_monitor_ptrace
sandbox2::syscall
absl::synchronization
absl::flat_hash_map
sapi::raw_logging
)

# sandboxed_api/sandbox2:monitor_unotify
Expand Down Expand Up @@ -505,7 +508,6 @@ target_link_libraries(sandbox2_monitor_unotify
absl::statusor
absl::synchronization
sapi::fileops
sapi::raw_logging
)

# sandboxed_api/sandbox2:policybuilder
Expand Down Expand Up @@ -675,7 +677,6 @@ target_link_libraries(sandbox2_forkingclient
absl::log
sandbox2::sanitizer
sapi::base
sapi::raw_logging
PUBLIC sandbox2::client
sandbox2::comms
sandbox2::forkserver
Expand Down Expand Up @@ -955,7 +956,6 @@ if(BUILD_TESTING AND SAPI_BUILD_TESTING)
sandbox2::forkserver
sandbox2::forkserver_proto
sandbox2::sandbox2
sapi::raw_logging
sapi::testing
sapi::test_main
)
Expand Down
1 change: 0 additions & 1 deletion sandboxed_api/sandbox2/executor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#include "sandboxed_api/sandbox2/ipc.h"
#include "sandboxed_api/sandbox2/util.h"
#include "sandboxed_api/util/fileops.h"
#include "sandboxed_api/util/raw_logging.h"

namespace sandbox2 {

Expand Down
1 change: 0 additions & 1 deletion sandboxed_api/sandbox2/forkingclient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "absl/log/log.h"
#include "sandboxed_api/sandbox2/forkserver.h"
#include "sandboxed_api/sandbox2/sanitizer.h"
#include "sandboxed_api/util/raw_logging.h"

namespace sandbox2 {

Expand Down
1 change: 0 additions & 1 deletion sandboxed_api/sandbox2/forkserver_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "sandboxed_api/sandbox2/global_forkclient.h"
#include "sandboxed_api/sandbox2/ipc.h"
#include "sandboxed_api/testing.h"
#include "sandboxed_api/util/raw_logging.h"

namespace sandbox2 {

Expand Down
1 change: 0 additions & 1 deletion sandboxed_api/sandbox2/ipc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include "sandboxed_api/sandbox2/comms.h"
#include "sandboxed_api/sandbox2/logserver.h"
#include "sandboxed_api/sandbox2/logsink.h"
#include "sandboxed_api/util/raw_logging.h"

namespace sandbox2 {

Expand Down
6 changes: 3 additions & 3 deletions sandboxed_api/sandbox2/monitor_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "absl/flags/flag.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/log/vlog_is_on.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/match.h"
Expand All @@ -59,7 +60,6 @@
#include "sandboxed_api/sandbox2/syscall.h"
#include "sandboxed_api/sandbox2/util.h"
#include "sandboxed_api/util/file_helpers.h"
#include "sandboxed_api/util/raw_logging.h"
#include "sandboxed_api/util/strerror.h"
#include "sandboxed_api/util/temp_file.h"

Expand Down Expand Up @@ -184,7 +184,7 @@ void MonitorBase::Launch() {
absl::Cleanup monitor_done = [this] { OnDone(); };

const Namespace* ns = policy_->GetNamespaceOrNull();
if (SAPI_VLOG_IS_ON(1) && ns != nullptr) {
if (VLOG_IS_ON(1) && ns != nullptr) {
std::vector<std::string> outside_entries;
std::vector<std::string> inside_entries;
ns->mounts().RecursivelyListMounts(
Expand Down Expand Up @@ -359,7 +359,7 @@ void MonitorBase::LogSyscallViolation(const Syscall& syscall) const {
LOG(ERROR) << "SANDBOX VIOLATION : PID: " << syscall.pid() << ", PROG: '"
<< util::GetProgName(syscall.pid())
<< "' : " << syscall.GetDescription();
if (SAPI_VLOG_IS_ON(1)) {
if (VLOG_IS_ON(1)) {
VLOG(1) << "Cmdline: " << util::GetCmdLine(syscall.pid());
VLOG(1) << "Task Name: " << util::GetProcStatusLine(syscall.pid(), "Name");
VLOG(1) << "Tgid: " << util::GetProcStatusLine(syscall.pid(), "Tgid");
Expand Down
4 changes: 2 additions & 2 deletions sandboxed_api/sandbox2/monitor_ptrace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "absl/flags/flag.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/log/vlog_is_on.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_cat.h"
Expand All @@ -64,7 +65,6 @@
#include "sandboxed_api/sandbox2/sanitizer.h"
#include "sandboxed_api/sandbox2/syscall.h"
#include "sandboxed_api/sandbox2/util.h"
#include "sandboxed_api/util/raw_logging.h"
#include "sandboxed_api/util/status_macros.h"

ABSL_FLAG(bool, sandbox2_log_all_stack_traces, false,
Expand Down Expand Up @@ -949,7 +949,7 @@ void PtraceMonitor::StateProcessStopped(pid_t pid, int status) {

if (!stack_trace.ok()) {
LOG(WARNING) << "FAILED TO GET SANDBOX STACK : " << stack_trace.status();
} else if (SAPI_VLOG_IS_ON(0)) {
} else if (VLOG_IS_ON(0)) {
VLOG(0) << "SANDBOX STACK: PID: " << pid << ", [";
for (const auto& frame : *stack_trace) {
VLOG(0) << " " << frame;
Expand Down
1 change: 0 additions & 1 deletion sandboxed_api/sandbox2/monitor_ptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include "sandboxed_api/sandbox2/policy.h"
#include "sandboxed_api/sandbox2/regs.h"
#include "sandboxed_api/sandbox2/syscall.h"
#include "sandboxed_api/util/raw_logging.h"

namespace sandbox2 {

Expand Down
1 change: 0 additions & 1 deletion sandboxed_api/sandbox2/monitor_unotify.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
#include "sandboxed_api/sandbox2/result.h"
#include "sandboxed_api/util/fileops.h"
#include "sandboxed_api/util/status_macros.h"
#include "sandboxed_api/util/raw_logging.h"

#ifndef SECCOMP_GET_NOTIF_SIZES
#define SECCOMP_GET_NOTIF_SIZES 3
Expand Down
1 change: 0 additions & 1 deletion sandboxed_api/sandbox2/monitor_unotify.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "sandboxed_api/sandbox2/policy.h"
#include "sandboxed_api/sandbox2/result.h"
#include "sandboxed_api/util/fileops.h"
#include "sandboxed_api/util/raw_logging.h"

namespace sandbox2 {

Expand Down
1 change: 0 additions & 1 deletion sandboxed_api/sandbox2/policy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include "sandboxed_api/sandbox2/comms.h"
#include "sandboxed_api/sandbox2/syscall.h"
#include "sandboxed_api/sandbox2/util/bpf_helper.h"
#include "sandboxed_api/util/raw_logging.h"

#ifndef SECCOMP_FILTER_FLAG_NEW_LISTENER
#define SECCOMP_FILTER_FLAG_NEW_LISTENER (1UL << 3)
Expand Down
1 change: 0 additions & 1 deletion sandboxed_api/sandbox2/stack_trace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
#include "sandboxed_api/sandbox2/unwind/unwind.pb.h"
#include "sandboxed_api/util/fileops.h"
#include "sandboxed_api/util/path.h"
#include "sandboxed_api/util/raw_logging.h"
#include "sandboxed_api/util/status_macros.h"

ABSL_FLAG(bool, sandbox_disable_all_stack_traces, false,
Expand Down

0 comments on commit 7c1e23c

Please sign in to comment.