Full syscall info in Result::ToString

PiperOrigin-RevId: 501522999
Change-Id: I90c63984c053a5e7deaf4b7619e70c360cc892bb
This commit is contained in:
Wiktor Garbacz 2023-01-12 03:57:13 -08:00 committed by Copybara-Service
parent 858c407521
commit 2ae5370cfb

View File

@ -78,14 +78,14 @@ std::string Result::ToString() const {
ReasonCodeEnumToString(static_cast<ReasonCodeEnum>(reason_code())));
break;
case sandbox2::Result::VIOLATION:
if (reason_code() == sandbox2::Result::VIOLATION_NETWORK) {
if (syscall_) {
result = absl::StrCat("SYSCALL VIOLATION - Violating Syscall ",
syscall_->GetDescription(),
" Stack: ", GetStackTrace());
} else if (reason_code() == sandbox2::Result::VIOLATION_NETWORK) {
result = absl::StrCat("NETWORK VIOLATION: ", GetNetworkViolation());
} else {
result = absl::StrCat(
"SYSCALL VIOLATION - Violating Syscall ",
Syscall::GetArchDescription(GetSyscallArch()), "[", reason_code(),
"/", Syscall(GetSyscallArch(), reason_code()).GetName(),
"] Stack: ", GetStackTrace());
result = "SYSCALL VIOLATION - Unknown Violation";
}
break;
case sandbox2::Result::SIGNALED: