Use regular logging in fork client

PiperOrigin-RevId: 399623764
Change-Id: I5eaf0ff7f24e7b61c84ff9dacf8cd53889cc83d0
This commit is contained in:
Wiktor Garbacz 2021-09-29 00:45:35 -07:00 committed by Copybara-Service
parent fb81c00fd1
commit d9d2f0e5de
3 changed files with 15 additions and 15 deletions

View File

@ -438,9 +438,9 @@ cc_library(
deps = [
":comms",
":forkserver_cc_proto",
"//sandboxed_api/util:raw_logging",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/synchronization",
"@com_google_glog//:glog",
],
)

View File

@ -418,10 +418,10 @@ add_library(sandbox2::fork_client ALIAS sandbox2_fork_client)
target_link_libraries(sandbox2_fork_client PRIVATE
absl::core_headers
absl::synchronization
glog::glog
sandbox2::comms
sandbox2::forkserver_proto
sapi::base
sapi::raw_logging
)
# sandboxed_api/sandbox2:mounts

View File

@ -14,9 +14,9 @@
#include "sandboxed_api/sandbox2/fork_client.h"
#include <glog/logging.h>
#include "sandboxed_api/sandbox2/comms.h"
#include "sandboxed_api/sandbox2/forkserver.pb.h"
#include "sandboxed_api/util/raw_logging.h"
namespace sandbox2 {
@ -26,30 +26,30 @@ pid_t ForkClient::SendRequest(const ForkRequest& request, int exec_fd,
absl::MutexLock l(&comms_mutex_);
if (!comms_->SendProtoBuf(request)) {
SAPI_RAW_LOG(ERROR, "Sending PB to the ForkServer failed");
LOG(ERROR) << "Sending PB to the ForkServer failed";
return -1;
}
SAPI_RAW_CHECK(comms_fd != -1, "comms_fd was not properly set up");
CHECK(comms_fd != -1) << "comms_fd was not properly set up";
if (!comms_->SendFD(comms_fd)) {
SAPI_RAW_LOG(ERROR, "Sending Comms FD (%d) to the ForkServer failed",
comms_fd);
LOG(ERROR) << "Sending Comms FD (" << comms_fd
<< ") to the ForkServer failed";
return -1;
}
if (request.mode() == FORKSERVER_FORK_EXECVE ||
request.mode() == FORKSERVER_FORK_EXECVE_SANDBOX) {
SAPI_RAW_CHECK(exec_fd != -1, "exec_fd cannot be -1 in execve mode");
CHECK(exec_fd != -1) << "exec_fd cannot be -1 in execve mode";
if (!comms_->SendFD(exec_fd)) {
SAPI_RAW_LOG(ERROR, "Sending Exec FD (%d) to the ForkServer failed",
exec_fd);
LOG(ERROR) << "Sending Exec FD (" << exec_fd
<< ") to the ForkServer failed";
return -1;
}
}
if (request.mode() == FORKSERVER_FORK_JOIN_SANDBOX_UNWIND) {
SAPI_RAW_CHECK(user_ns_fd != -1, "user_ns_fd cannot be -1 in unwind mode");
CHECK(user_ns_fd != -1) << "user_ns_fd cannot be -1 in unwind mode";
if (!comms_->SendFD(user_ns_fd)) {
SAPI_RAW_LOG(ERROR, "Sending user ns FD (%d) to the ForkServer failed",
user_ns_fd);
LOG(ERROR) << "Sending user ns FD (" << user_ns_fd
<< ") to the ForkServer failed";
return -1;
}
}
@ -57,7 +57,7 @@ pid_t ForkClient::SendRequest(const ForkRequest& request, int exec_fd,
int32_t pid;
// Receive init process ID.
if (!comms_->RecvInt32(&pid)) {
SAPI_RAW_LOG(ERROR, "Receiving init PID from the ForkServer failed");
LOG(ERROR) << "Receiving init PID from the ForkServer failed";
return -1;
}
if (init_pid) {
@ -66,7 +66,7 @@ pid_t ForkClient::SendRequest(const ForkRequest& request, int exec_fd,
// Receive sandboxee process ID.
if (!comms_->RecvInt32(&pid)) {
SAPI_RAW_LOG(ERROR, "Receiving sandboxee PID from the ForkServer failed");
LOG(ERROR) << "Receiving sandboxee PID from the ForkServer failed";
return -1;
}
return static_cast<pid_t>(pid);