diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-11-10 00:14:55 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-11-10 00:14:55 +0000 |
commit | 8f3a3910305677c2c121084c42066b9097cb142a (patch) | |
tree | 07cee5ada3a50ee626564ab2ce811550c62153ac | |
parent | bfbadef7fe1d4dedf29fba4387f0f6b1a45c1fc9 (diff) | |
parent | fb3219221f68b9fc4b792cf3f9a7c82c1a5b97e6 (diff) | |
download | sandboxed-api-8f3a3910305677c2c121084c42066b9097cb142a.tar.gz |
Snap for 11078623 from fb3219221f68b9fc4b792cf3f9a7c82c1a5b97e6 to 24Q1-release
Change-Id: I9d5ad69426c5ef8ef5dd74fec9d5af17d39f3cd6
-rw-r--r-- | Android.bp | 84 | ||||
-rw-r--r-- | sandboxed_api/sandbox2/util/syscall_trap.cc | 5 |
2 files changed, 87 insertions, 2 deletions
@@ -20,3 +20,87 @@ package { "//device/google/cuttlefish:__subpackages__", ] } + +cc_defaults { + name: "sandboxed_api_defaults", + device_supported: false, + host_supported: true, +} + +cc_library { + name: "sandboxed_api_proto", + srcs: [ + "sandboxed_api/proto_arg.proto", + "sandboxed_api/sandbox2/comms_test.proto", + "sandboxed_api/sandbox2/forkserver.proto", + "sandboxed_api/sandbox2/logserver.proto", + "sandboxed_api/sandbox2/mount_tree.proto", + "sandboxed_api/sandbox2/violation.proto", + "sandboxed_api/util/status.proto", + ], + proto: { + canonical_path_from_root: false, + export_proto_headers: true, + type: "full", + }, + defaults: ["sandboxed_api_defaults"], +} + +cc_library { + name: "sandboxed_api", + srcs: [ + "sandboxed_api/config.cc", + "sandboxed_api/sandbox2/bpfdisassembler.cc", + "sandboxed_api/sandbox2/buffer.cc", + "sandboxed_api/sandbox2/comms.cc", + "sandboxed_api/sandbox2/ipc.cc", + "sandboxed_api/sandbox2/logserver.cc", + "sandboxed_api/sandbox2/logsink.cc", + "sandboxed_api/sandbox2/mounts.cc", + "sandboxed_api/sandbox2/namespace.cc", + "sandboxed_api/sandbox2/regs.cc", + "sandboxed_api/sandbox2/result.cc", + "sandboxed_api/sandbox2/syscall.cc", + "sandboxed_api/sandbox2/syscall_defs.cc", + "sandboxed_api/sandbox2/util.cc", + "sandboxed_api/sandbox2/util/bpf_helper.c", + "sandboxed_api/sandbox2/util/maps_parser.cc", + "sandboxed_api/sandbox2/util/minielf.cc", + "sandboxed_api/sandbox2/util/syscall_trap.cc", + "sandboxed_api/util/file_helpers.cc", + "sandboxed_api/util/fileops.cc", + "sandboxed_api/util/path.cc", + "sandboxed_api/util/raw_logging.cc", + "sandboxed_api/util/status.cc", + "sandboxed_api/util/strerror.cc", + "sandboxed_api/util/temp_file.cc", + ], + static_libs: [ + "libabsl_host", + "sandboxed_api_proto", + "libprotobuf-cpp-full", + ], + arch: { + x86: { + enabled: false, + }, + }, + target: { + linux_glibc: { + enabled: false, + cflags: [ + // Typo in old glibc + "-DPTRACE_EVENT_SECCOMP=PTRAVE_EVENT_SECCOMP", + ], + }, + linux_musl: { + enabled: true, + }, + }, + cflags: [ + "-Wno-unused-parameter", + "-fbracket-depth=768", // for syscall_defs.cc + ], + defaults: ["sandboxed_api_defaults"], +} + diff --git a/sandboxed_api/sandbox2/util/syscall_trap.cc b/sandboxed_api/sandbox2/util/syscall_trap.cc index 44ed8e4..f9515e8 100644 --- a/sandboxed_api/sandbox2/util/syscall_trap.cc +++ b/sandboxed_api/sandbox2/util/syscall_trap.cc @@ -30,8 +30,9 @@ namespace { #if defined(SAPI_X86_64) constexpr int kRegResult = REG_RAX; constexpr int kRegSyscall = REG_RAX; -constexpr std::array kRegArgs = {REG_RDI, REG_RSI, REG_RDX, - REG_R10, REG_R8, REG_R9}; +// ANDROID: On musl these are distinct enum types. Coerce to int. +constexpr std::array<int, 6> kRegArgs = {REG_RDI, REG_RSI, REG_RDX, + REG_R10, REG_R8, REG_R9}; #elif defined(SAPI_PPC64_LE) constexpr int kRegResult = 3; constexpr int kRegSyscall = 0; |