microsoft / microsoft/litebox

Move litebox::mm back to linux kernel platform

Open
#43 0 comments 0 reactions 1 assignee View on GitHub

@CvvT is already working on this.

Since Mar 20, 2025.

discussion layer-litebox layer-platform
Dominant language
Rust
Stars
2.7k
Forks
144
Avg merge
12h 21m
Merged PRs (30d)
146

Description

One issue I noticed when I was implementing syscall hooking was that intercepting `mmap` may lead to deadlock because our hook for `mmap` may also allocate objects on heap and thus cause infinite loop (allocator has lock so it is just deadlock). One solution is to replace the global allocator so that it knows how to call `mmap` "correctly" without causing deadlock.

After discussing it with @wdcui , it seems that we shouldn't intercept regular `mmap` (file-backed mapping still needs to be handled by litebox) because eventually the backend still calls `mmap`. What `PageManager` does is essentially managing all allocated memory, which is unnecessary for userland if we just forward all `mmap`, `munmap`, and `mprotect` to Linux. The only benefit is that we add an extra layer of defense.

We should probably move litebox::mm back to litebox_platform_linux_kernel.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.