Skip to content

Commit

Permalink
Only mount /proc/self for native Java.
Browse files Browse the repository at this point in the history
Bug: 376434190
Change-Id: I1aefe988afea81f13bb3c993017be1819d092bd2
GitOrigin-RevId: 795edcb517b59c24191a2bb923026bd0b93a0ba2
  • Loading branch information
Privacy Sandbox Team authored and copybara-github committed Oct 30, 2024
1 parent b4fe350 commit 3160ad4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
25 changes: 20 additions & 5 deletions src/roma/byob/benchmark/roma_byob_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,21 @@ std::string LoadCode(ByobSampleService<>& roma_service,
return *std::move(code_id);
}

ByobSampleService<> GetRomaService(
Mode mode, ::privacy_sandbox::server_common::byob::Config<> config) {
absl::StatusOr<ByobSampleService<>> sample_interface =
ByobSampleService<>::Create(config, mode);
CHECK_OK(sample_interface);
return *std::move(sample_interface);
}

ByobSampleService<> GetRomaService(Mode mode, int num_workers) {
::privacy_sandbox::server_common::byob::Config<> config = {
.num_workers = num_workers,
.roma_container_name = "roma_server",
.function_bindings = {FunctionBindingObjectV2<>{"example", [](auto&) {}}},
};
absl::StatusOr<ByobSampleService<>> sample_interface =
ByobSampleService<>::Create(config, mode);
CHECK_OK(sample_interface);
return *std::move(sample_interface);
return GetRomaService(mode, std::move(config));
}

void VerifyResponse(SampleResponse bin_response,
Expand Down Expand Up @@ -386,8 +391,18 @@ void BM_ProcessRequestUsingCallback(benchmark::State& state) {

void BM_ProcessRequestMultipleLanguages(benchmark::State& state) {
Language lang = static_cast<Language>(state.range(0));
std::string mounts = "/lib,/lib64,/usr";
if (lang == Language::kJava) {
mounts += ",/proc/self";
}
::privacy_sandbox::server_common::byob::Config<> config = {
.num_workers = 2,
.roma_container_name = "roma_server",
.lib_mounts = std::move(mounts),
.function_bindings = {FunctionBindingObjectV2<>{"example", [](auto&) {}}},
};
ByobSampleService<> roma_service =
GetRomaService(Mode::kModeSandbox, /*num_workers=*/2);
GetRomaService(Mode::kModeSandbox, std::move(config));

std::string code_token =
LoadCode(roma_service, GetFilePathFromLanguage(lang));
Expand Down
4 changes: 2 additions & 2 deletions src/roma/byob/interface/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ cc_library(
'CONTAINER_ROOT_RELPATH=\\"{}\\"'.format(roma_container_root_dir),
] + select({
"@platforms//cpu:arm64": [
'LIB_MOUNTS=\\"/lib,/usr,/proc/self\\"',
'LIB_MOUNTS=\\"/lib,/usr\\"',
],
"@platforms//cpu:x86_64": [
'LIB_MOUNTS=\\"/lib,/lib64,/usr,/proc/self\\"',
'LIB_MOUNTS=\\"/lib,/lib64,/usr\\"',
],
}),
visibility = ["//visibility:public"],
Expand Down

0 comments on commit 3160ad4

Please sign in to comment.