Skip to content

Commit

Permalink
Added more descriptive Syscall argument types, and an API for introsp…
Browse files Browse the repository at this point in the history
…ecting arguments.

PiperOrigin-RevId: 612904089
Change-Id: Ia0ef7b0559f7eed923981b13fa8224bc891e8c37
  • Loading branch information
Sandboxed API Team authored and copybara-github committed Mar 5, 2024
1 parent 1f390c2 commit c6bab97
Show file tree
Hide file tree
Showing 8 changed files with 1,855 additions and 1,521 deletions.
3 changes: 3 additions & 0 deletions sandboxed_api/sandbox2/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ cc_library(
deps = [
":util",
"//sandboxed_api:config",
"//sandboxed_api/util:status",
"@com_google_absl//absl/algorithm:container",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
Expand Down Expand Up @@ -799,6 +800,8 @@ cc_library(
"//sandboxed_api/util:file_helpers",
"//sandboxed_api/util:fileops",
"//sandboxed_api/util:raw_logging",
"//sandboxed_api/util:status",
"@com_google_absl//absl/algorithm:container",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
Expand Down
5 changes: 4 additions & 1 deletion sandboxed_api/sandbox2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ target_link_libraries(sandbox2_syscall
absl::strings
sandbox2::util
sapi::base
sapi::status
PUBLIC absl::log
)

Expand Down Expand Up @@ -687,7 +688,8 @@ add_library(sandbox2_util ${SAPI_LIB_TYPE}
)
add_library(sandbox2::util ALIAS sandbox2_util)
target_link_libraries(sandbox2_util
PRIVATE absl::core_headers
PRIVATE absl::algorithm_container
absl::core_headers
absl::str_format
absl::strings
sapi::config
Expand All @@ -696,6 +698,7 @@ target_link_libraries(sandbox2_util
sapi::fileops
sapi::base
sapi::raw_logging
sapi::status
PUBLIC absl::status
absl::statusor
)
Expand Down
4 changes: 4 additions & 0 deletions sandboxed_api/sandbox2/syscall.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ std::string Syscall::GetName() const {
return absl::StrFormat("UNKNOWN[%d/0x%x]", nr_, nr_);
}

std::vector<syscalls::ArgData> Syscall::GetArgumentsData() const {
return SyscallTable::get(arch_).GetArgumentsData(nr_, args_.data(), pid_);
}

std::vector<std::string> Syscall::GetArgumentsDescription() const {
return SyscallTable::get(arch_).GetArgumentsDescription(nr_, args_.data(),
pid_);
Expand Down
3 changes: 2 additions & 1 deletion sandboxed_api/sandbox2/syscall.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <vector>

#include "sandboxed_api/config.h" // IWYU pragma: export
#include "sandboxed_api/sandbox2/syscall_defs.h"

namespace sandbox2 {

Expand Down Expand Up @@ -59,7 +60,7 @@ class Syscall {
uint64_t instruction_pointer() const { return ip_; }

std::string GetName() const;

std::vector<syscalls::ArgData> GetArgumentsData() const;
std::vector<std::string> GetArgumentsDescription() const;
std::string GetDescription() const;

Expand Down
Loading

0 comments on commit c6bab97

Please sign in to comment.