Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory sandboxing #636

Open
9 tasks
udoprog opened this issue Oct 1, 2023 · 0 comments
Open
9 tasks

Memory sandboxing #636

udoprog opened this issue Oct 1, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@udoprog
Copy link
Collaborator

udoprog commented Oct 1, 2023

The following are enumerations of missing pieces for supporting memory sandboxing. Note that this is not an exhaustive list:

  • The stack is not limited. So sufficiently nested code could use up unsupervised amounts of memory.
  • Allocation metadata is not accounted for, so in particular many small allocations might end up using up more system memory than what is being accounted for. This plugs in at the Rust allocated level, and uses the global allocation APIs which are currently provided in stable. This could eventually be remedied using a custom allocator, or by using an allocator which reports overhead.
  • CLI arguments. This is not critical since the CLI is usually not fed untrusted input.
  • Sorting using [_]::sort, which uses timsort that might allocate a cache up to half the size of the elements being sorted.
  • Path / PathBuf and I/O related functions uses their std counterparts. But they (and filesystem interactions) can be disabled by disabling the std feature or configuring the source loader to not use a filesystem based one.
  • RelativePath / RelativePathBuf which is used in some places internally.
  • Anything using serde. While any types we convert into will take allocated memory into account (and error through serde accordingly) serializations might use internal buffering which bypasses this, such as serde_json using a string buffer. Owned types being passed in are not accounted for until they've been converted to internal types.
  • So far Rc and Arc have not been forked. Mainly because their memory overhead is fixed and relative to other collections which store them internally, We might still decide to fork them to ensure that we get full coverage.
  • A few more internal uses of std / alloc types such as String and Vec which just haven't been ported yet because they're not considered important (Remove last possible std::collections and alloc uses #635).
@udoprog udoprog added the enhancement New feature or request label Oct 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant