mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Use regular logging in fork client
PiperOrigin-RevId: 399623764 Change-Id: I5eaf0ff7f24e7b61c84ff9dacf8cd53889cc83d0
This commit is contained in:
parent
fb81c00fd1
commit
d9d2f0e5de
|
@ -438,9 +438,9 @@ cc_library(
|
||||||
deps = [
|
deps = [
|
||||||
":comms",
|
":comms",
|
||||||
":forkserver_cc_proto",
|
":forkserver_cc_proto",
|
||||||
"//sandboxed_api/util:raw_logging",
|
|
||||||
"@com_google_absl//absl/base:core_headers",
|
"@com_google_absl//absl/base:core_headers",
|
||||||
"@com_google_absl//absl/synchronization",
|
"@com_google_absl//absl/synchronization",
|
||||||
|
"@com_google_glog//:glog",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -418,10 +418,10 @@ add_library(sandbox2::fork_client ALIAS sandbox2_fork_client)
|
||||||
target_link_libraries(sandbox2_fork_client PRIVATE
|
target_link_libraries(sandbox2_fork_client PRIVATE
|
||||||
absl::core_headers
|
absl::core_headers
|
||||||
absl::synchronization
|
absl::synchronization
|
||||||
|
glog::glog
|
||||||
sandbox2::comms
|
sandbox2::comms
|
||||||
sandbox2::forkserver_proto
|
sandbox2::forkserver_proto
|
||||||
sapi::base
|
sapi::base
|
||||||
sapi::raw_logging
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# sandboxed_api/sandbox2:mounts
|
# sandboxed_api/sandbox2:mounts
|
||||||
|
|
|
@ -14,9 +14,9 @@
|
||||||
|
|
||||||
#include "sandboxed_api/sandbox2/fork_client.h"
|
#include "sandboxed_api/sandbox2/fork_client.h"
|
||||||
|
|
||||||
|
#include <glog/logging.h>
|
||||||
#include "sandboxed_api/sandbox2/comms.h"
|
#include "sandboxed_api/sandbox2/comms.h"
|
||||||
#include "sandboxed_api/sandbox2/forkserver.pb.h"
|
#include "sandboxed_api/sandbox2/forkserver.pb.h"
|
||||||
#include "sandboxed_api/util/raw_logging.h"
|
|
||||||
|
|
||||||
namespace sandbox2 {
|
namespace sandbox2 {
|
||||||
|
|
||||||
|
@ -26,30 +26,30 @@ pid_t ForkClient::SendRequest(const ForkRequest& request, int exec_fd,
|
||||||
absl::MutexLock l(&comms_mutex_);
|
absl::MutexLock l(&comms_mutex_);
|
||||||
|
|
||||||
if (!comms_->SendProtoBuf(request)) {
|
if (!comms_->SendProtoBuf(request)) {
|
||||||
SAPI_RAW_LOG(ERROR, "Sending PB to the ForkServer failed");
|
LOG(ERROR) << "Sending PB to the ForkServer failed";
|
||||||
return -1;
|
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)) {
|
if (!comms_->SendFD(comms_fd)) {
|
||||||
SAPI_RAW_LOG(ERROR, "Sending Comms FD (%d) to the ForkServer failed",
|
LOG(ERROR) << "Sending Comms FD (" << comms_fd
|
||||||
comms_fd);
|
<< ") to the ForkServer failed";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (request.mode() == FORKSERVER_FORK_EXECVE ||
|
if (request.mode() == FORKSERVER_FORK_EXECVE ||
|
||||||
request.mode() == FORKSERVER_FORK_EXECVE_SANDBOX) {
|
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)) {
|
if (!comms_->SendFD(exec_fd)) {
|
||||||
SAPI_RAW_LOG(ERROR, "Sending Exec FD (%d) to the ForkServer failed",
|
LOG(ERROR) << "Sending Exec FD (" << exec_fd
|
||||||
exec_fd);
|
<< ") to the ForkServer failed";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.mode() == FORKSERVER_FORK_JOIN_SANDBOX_UNWIND) {
|
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)) {
|
if (!comms_->SendFD(user_ns_fd)) {
|
||||||
SAPI_RAW_LOG(ERROR, "Sending user ns FD (%d) to the ForkServer failed",
|
LOG(ERROR) << "Sending user ns FD (" << user_ns_fd
|
||||||
user_ns_fd);
|
<< ") to the ForkServer failed";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ pid_t ForkClient::SendRequest(const ForkRequest& request, int exec_fd,
|
||||||
int32_t pid;
|
int32_t pid;
|
||||||
// Receive init process ID.
|
// Receive init process ID.
|
||||||
if (!comms_->RecvInt32(&pid)) {
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
if (init_pid) {
|
if (init_pid) {
|
||||||
|
@ -66,7 +66,7 @@ pid_t ForkClient::SendRequest(const ForkRequest& request, int exec_fd,
|
||||||
|
|
||||||
// Receive sandboxee process ID.
|
// Receive sandboxee process ID.
|
||||||
if (!comms_->RecvInt32(&pid)) {
|
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 -1;
|
||||||
}
|
}
|
||||||
return static_cast<pid_t>(pid);
|
return static_cast<pid_t>(pid);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user