-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set the user and group IDs for the sandboxed process
This commit fixes some issues with `write_uid_gid_maps()` which in turn allows us to finally assign a proper user ID and group ID to our sandboxed process, so now the `Sandbox::uid()` and `Sandbox::gid()` builder methods actually do something. If the user doesn't specify them, the sandbox defaults to inheriting the same user and group as the parent process. There were a handful of issues with coaxing the `openat` library to do the right thing, first of which was described in tailhook/openat#26. Another unsolved issue is that `writeln!()` and `write!()` sometimes strangely fails when writing to files opened with `openat::Dir::write_file()`, namely it throws an `std::io::ErrorKind::InvalidInput` with the message "Invalid argument". The panic itself appears to be coming from `std::io::Write::write_fmt()` specfically when invoked on `/proc/self/{uid_map,gid_map}`. Thankfully, when I use `<File as Write>::write_all()`, it works just fine, and I can verify from within the sandboxed process that the UIDs and GIDs are indeed set up correctly from the write. Strange, but at least this works. :shrug:
- Loading branch information
1 parent
dc0e22f
commit 6c89aad
Showing
2 changed files
with
36 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters