Move log warning about non-namespaced stacktraces

PiperOrigin-RevId: 554493643
Change-Id: I27755322edcd7c0191cd125ec8ffdace18a6460c
This commit is contained in:
Wiktor Garbacz 2023-08-07 09:06:31 -07:00 committed by Copybara-Service
parent 4890c86cec
commit 48bbb06fe7
3 changed files with 7 additions and 8 deletions

View File

@ -1213,11 +1213,6 @@ absl::StatusOr<std::unique_ptr<Policy>> PolicyBuilder::TryBuild() {
output->SetNamespace(std::make_unique<Namespace>( output->SetNamespace(std::make_unique<Namespace>(
allow_unrestricted_networking_, std::move(mounts_), hostname_, allow_unrestricted_networking_, std::move(mounts_), hostname_,
allow_mount_propagation_)); allow_mount_propagation_));
} else {
// Not explicitly disabling them here as this is a technical limitation in
// our stack trace collection functionality.
LOG(WARNING) << "Using policy without namespaces, disabling stack traces on"
<< " crash";
} }
output->collect_stacktrace_on_signal_ = collect_stacktrace_on_signal_; output->collect_stacktrace_on_signal_ = collect_stacktrace_on_signal_;

View File

@ -16,13 +16,11 @@
#include "sandboxed_api/sandbox2/sandbox2.h" #include "sandboxed_api/sandbox2/sandbox2.h"
#include <csignal>
#include <memory> #include <memory>
#include <string>
#include <vector>
#include "absl/base/call_once.h" #include "absl/base/call_once.h"
#include "absl/log/check.h" #include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/status.h" #include "absl/status/status.h"
#include "absl/status/statusor.h" #include "absl/status/statusor.h"
#include "absl/time/time.h" #include "absl/time/time.h"
@ -108,6 +106,11 @@ void Sandbox2::Launch() {
internal::SandboxPeer::spawn_fn_ = Sandbox2Peer::Spawn; internal::SandboxPeer::spawn_fn_ = Sandbox2Peer::Spawn;
}); });
// This is a technical limitation in our stack trace collection
// functionality.
LOG_IF(WARNING, !policy_->GetNamespace())
<< "Using policy without namespaces, disabling stack traces on crash";
monitor_ = CreateMonitor(); monitor_ = CreateMonitor();
monitor_->Launch(); monitor_->Launch();
} }

View File

@ -23,6 +23,7 @@
#include <utility> #include <utility>
#include "absl/base/macros.h" #include "absl/base/macros.h"
#include "absl/log/check.h"
#include "absl/status/statusor.h" #include "absl/status/statusor.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"