Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/linyaps_box/container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ void syscall_mount(const char *_special_file,
if (_dir == nullptr) {
return "nullptr";
}

if (auto str = std::string_view{ _dir }; str.rfind(fd_prefix, 0) == 0) {
return linyaps_box::utils::inspect_fd(std::stoi(str.data() + fd_prefix.size()));
}
Expand Down Expand Up @@ -790,6 +791,8 @@ class mounter
return;
}

LINYAPS_BOX_DEBUG() << "make readonly paths";

for (const auto &path : *linux->readonly_paths) {
linyaps_box::utils::file_descriptor dst;
try {
Expand Down Expand Up @@ -836,10 +839,14 @@ class mounter
return;
}

LINYAPS_BOX_DEBUG() << "make masked paths";

for (const auto &path : *linux->masked_paths) {
linyaps_box::utils::file_descriptor dst;
try {
dst = linyaps_box::utils::open_at(root, path);
// we only need to open a fd to refer to the path
// so O_PATH is sufficient.
dst = linyaps_box::utils::open_at(root, path, O_PATH | O_CLOEXEC);
} catch (const std::system_error &e) {
if (auto err = e.code().value(); err == ENOENT || err == EACCES) {
continue;
Expand Down