sandboxed-api/sandboxed_api/sandbox2
Christian Blichmann f44cca6c98 Fix path to generated proto sources when embedding
When embedding SAPI in an external CMake project, the version of
`protobuf_generate_cpp` that we lifted from upstream protobuf produces
the wrong generated file paths.

For example, given this project structure:

```
/parent/
+-- myproject/
+-- myproject_build/  <- CMake build directory
+-- sandboxed-api/    <- Checkout from GitHub
```

And a CMake file in `myproject/CMakeLists.txt` that embeds SAPI like
this:

```
cmake_minimum_required(VERSION 3.12)
project(SandboxedTest LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_subdirectory(
  ${PROJECT_SOURCE_DIR}/../sandboxed-api
  ${PROJECT_BINARY_DIR}/sandboxed-api
)
```

Then `protobuf_generate_cpp` correctly invokes the protoc compiler to
generate
`/parent/myproject_build/sandboxed-api/sandboxed_api/proto_arg.proto.pb.cc'.
However, the path of the generated source file that is passed to the C++
compiler will be
`/parent/myproject_build/sandboxed-api/sandboxed_api/../../myproject_build/sandboxed-api/sandboxed_api/proto_arg.pb.cc`.
Note the duplicated project build directory component in the
canonicalized version:
`/parent/myproject_build/myproject_build/sandboxed-api/sandboxed_api/proto_arg.pb.cc`.

This change simple omits the computation of any relative file paths and
simply uses `_pb_PROTOC_OUT_DIR` which defauls to
`CMAKE_CURRENT_BINARY_DIR`, which should always contain the correct
path.

Signed-off-by: Christian Blichmann <mail@blichmann.eu>
2020-03-18 18:47:02 +01:00
..
examples Split network_proxy example to 2 examples: with automatic handler, and without. 2020-03-11 07:32:50 -07:00
network_proxy Replace sapi::Status with absl::Status 2020-02-27 09:24:12 -08:00
testcases Internal change 2020-02-17 06:54:52 -08:00
unwind Fix path to generated proto sources when embedding 2020-03-18 18:47:02 +01:00
util Replace sapi::Status with absl::Status 2020-02-27 09:24:12 -08:00
bpfdisassembler.cc Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
bpfdisassembler.h Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
buffer_test.cc Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
buffer.cc Replace sapi::Status with absl::Status 2020-02-27 09:24:12 -08:00
buffer.h Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
BUILD.bazel Replace sapi::Status with absl::Status 2020-02-27 09:24:12 -08:00
client.cc Replace sapi::Status with absl::Status 2020-02-27 09:24:12 -08:00
client.h Replace sapi::Status with absl::Status 2020-02-27 09:24:12 -08:00
CMakeLists.txt Fix path to generated proto sources when embedding 2020-03-18 18:47:02 +01:00
comms_test.cc Replace sapi::Status with absl::Status 2020-02-27 09:24:12 -08:00
comms_test.proto Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
comms.cc Replace sapi::Status with absl::Status 2020-02-27 09:24:12 -08:00
comms.h Replace sapi::Status with absl::Status 2020-02-27 09:24:12 -08:00
executor.cc Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
executor.h Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
forkingclient.cc Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
forkingclient.h Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
forkserver_bin.cc Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
forkserver_test.cc Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
forkserver.cc Replace sapi::Status with absl::Status 2020-02-27 09:24:12 -08:00
forkserver.h Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
forkserver.proto Internal change 2020-01-31 05:39:25 -08:00
global_forkclient.cc Replace if (!cond) { LOG(FATAL, msg) } with CHECK(cond, msg) 2020-01-28 05:59:33 -08:00
global_forkclient.h Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
ipc_test.cc Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
ipc.cc Now network proxy server supports IP filtering. API to policybuilder is added to make a list of allowed pairs of allowed IP, mask and port where mask and port are optional. 2020-02-20 07:45:44 -08:00
ipc.h Now network proxy server supports IP filtering. API to policybuilder is added to make a list of allowed pairs of allowed IP, mask and port where mask and port are optional. 2020-02-20 07:45:44 -08:00
limits_test.cc Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
limits.h Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
logserver.cc Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
logserver.h Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
logserver.proto Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
logsink.cc Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
logsink.h Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
monitor.cc Qualify uses of std::string 2020-02-27 00:03:55 -08:00
monitor.h Now network proxy server supports IP filtering. API to policybuilder is added to make a list of allowed pairs of allowed IP, mask and port where mask and port are optional. 2020-02-20 07:45:44 -08:00
mounts_test.cc Replace sapi::Status with absl::Status 2020-02-27 09:24:12 -08:00
mounts.cc Replace sapi::Status with absl::Status 2020-02-27 09:24:12 -08:00
mounts.h Replace sapi::Status with absl::Status 2020-02-27 09:24:12 -08:00
mounttree.proto Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
namespace_test.cc Properly test read-only mounts 2020-01-24 02:38:11 -08:00
namespace.cc Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
namespace.h Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
notify_test.cc Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
notify.h Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
policy_test.cc Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
policy.cc Qualify uses of std::string 2020-02-27 00:03:55 -08:00
policy.h Now network proxy server supports IP filtering. API to policybuilder is added to make a list of allowed pairs of allowed IP, mask and port where mask and port are optional. 2020-02-20 07:45:44 -08:00
policybuilder_test.cc Replace sapi::Status with absl::Status 2020-02-27 09:24:12 -08:00
policybuilder.cc Replace sapi::Status with absl::Status 2020-02-27 09:24:12 -08:00
policybuilder.h Replace sapi::Status with absl::Status 2020-02-27 09:24:12 -08:00
README.md Corrects typo in link 2019-10-07 02:36:35 -07:00
regs.cc Replace sapi::Status with absl::Status 2020-02-27 09:24:12 -08:00
regs.h Replace sapi::Status with absl::Status 2020-02-27 09:24:12 -08:00
result.cc Replace sapi::Status with absl::Status 2020-02-27 09:24:12 -08:00
result.h Replace sapi::Status with absl::Status 2020-02-27 09:24:12 -08:00
sandbox2_test.cc Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
sandbox2.cc Replace sapi::Status with absl::Status 2020-02-27 09:24:12 -08:00
sandbox2.h Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
sanitizer_test.cc Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
sanitizer.cc Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
sanitizer.h Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
stack_trace_test.cc Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
stack_trace.cc Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
stack_trace.h Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
syscall_defs.cc Refactor syscall definitions to rely less on macros 2020-01-07 05:27:21 -08:00
syscall_defs.h Refactor syscall definitions to rely less on macros 2020-01-07 05:27:21 -08:00
syscall_test.cc Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
syscall.cc Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
syscall.h Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
testing.cc Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
testing.h Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
util_test.cc Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
util.cc Replace sapi::Status with absl::Status 2020-02-27 09:24:12 -08:00
util.h Update license header with recommended best practices 2020-01-17 05:05:29 -08:00
violation.proto Update license header with recommended best practices 2020-01-17 05:05:29 -08:00

Sandbox2

Sandbox2 is a C++ security sandbox for Linux which can be used to run untrusted programs or portions of programs in confined environments. The idea is that the runtime environment is so restricted that security bugs such as buffer overflows in the protected region cause no harm.

Documentation

Detailed developer documentation is available on the Google Developers site for Sandboxed API under Sandbox2.

There is also a Getting Started guide for Sandbox2.