Reduce logspam: Log Tomoyo LSM check only with VLOG

PiperOrigin-RevId: 387114844
Change-Id: Ib670799e3327fcc991ad012ccee20b96089c2f48
This commit is contained in:
Christian Blichmann 2021-07-27 08:31:38 -07:00 committed by Copybara-Service
parent ccd7b03026
commit 85c58dc2d7
3 changed files with 6 additions and 2 deletions

View File

@ -332,6 +332,7 @@ cc_library(
"//sandboxed_api/util:flags", "//sandboxed_api/util:flags",
"//sandboxed_api/util:raw_logging", "//sandboxed_api/util:raw_logging",
"//sandboxed_api/util:status", "//sandboxed_api/util:status",
"//sandboxed_api/util:strerror",
"//sandboxed_api/util:temp_file", "//sandboxed_api/util:temp_file",
"@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/cleanup", "@com_google_absl//absl/cleanup",

View File

@ -301,6 +301,7 @@ target_link_libraries(sandbox2_sandbox2
absl::str_format absl::str_format
absl::strings absl::strings
absl::synchronization absl::synchronization
sapi::strerror
sapi::base sapi::base
PUBLIC absl::status PUBLIC absl::status
absl::statusor absl::statusor

View File

@ -69,6 +69,7 @@
#include "sandboxed_api/util/file_helpers.h" #include "sandboxed_api/util/file_helpers.h"
#include "sandboxed_api/util/raw_logging.h" #include "sandboxed_api/util/raw_logging.h"
#include "sandboxed_api/util/status_macros.h" #include "sandboxed_api/util/status_macros.h"
#include "sandboxed_api/util/strerror.h"
#include "sandboxed_api/util/temp_file.h" #include "sandboxed_api/util/temp_file.h"
using std::string; using std::string;
@ -132,8 +133,9 @@ void MaybeEnableTomoyoLsmWorkaround(Mounts& mounts, std::string& comms_fd_dev) {
if (auto status = sapi::file::GetContents( if (auto status = sapi::file::GetContents(
"/sys/kernel/security/lsm", &lsm_list, sapi::file::Defaults()); "/sys/kernel/security/lsm", &lsm_list, sapi::file::Defaults());
!status.ok() && !absl::IsNotFound(status)) { !status.ok() && !absl::IsNotFound(status)) {
SAPI_RAW_PLOG(WARNING, "Checking active LSMs failed: %s", SAPI_RAW_VLOG(1, "Checking active LSMs failed: %s: %s",
std::string(status.message()).c_str()); std::string(status.message()).c_str(),
sapi::StrError(errno).c_str());
return false; return false;
} }
return absl::StrContains(lsm_list, "tomoyo"); return absl::StrContains(lsm_list, "tomoyo");