diff options
author | A. Cody Schuffelen <schuffelen@google.com> | 2023-11-09 03:10:51 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-11-09 03:10:51 +0000 |
commit | bac0c9dbca3335201acb18dc267fc797da48fce9 (patch) | |
tree | 07cee5ada3a50ee626564ab2ce811550c62153ac | |
parent | ca76194ecf9e0acbcd9d0356c1adc2b70247bd2a (diff) | |
parent | 4d5295a93185fccf08bea808e10bb325206089c3 (diff) | |
download | sandboxed-api-bac0c9dbca3335201acb18dc267fc797da48fce9.tar.gz |
Start a build target for building sandbox2 am: a1fed775e7 am: 4d5295a931
Original change: https://android-review.googlesource.com/c/platform/external/sandboxed-api/+/2819716
Change-Id: Iaef4935f3218625620b0c6d21e51675bff5c0db8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-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; |