Commit Graph

19 Commits

Author SHA1 Message Date
Hui, Chunyang
6da887d069 Add testcases for #PF handling 2023-11-07 09:26:20 +08:00
Hui, Chunyang
171faccea7 [libos] Fix munmap conflict chunk range and vma range 2022-09-06 12:57:16 +08:00
Hui, Chunyang
f87ee7c7a4 Support munmap multiple single VMA chunks with remaining ranges 2022-08-23 16:58:03 +08:00
Hui, Chunyang
3e15eb059c Add support for mmap spans over two chunks with MAP_FIXED 2022-03-30 17:38:37 +08:00
Hui, Chunyang
1745825e81 Add support for mprotect PROT_GROWSDOWN 2021-10-18 19:49:28 +08:00
Hui, Chunyang
bdb7825607 Add support for mremap 2021-10-17 15:58:29 +08:00
Hui, Chunyang
6dd73c64b5 Improve userspace VM management
Occlum is a single-address-space library OS. Previously, userspace memory are divided for each process.
And all the memory are allocated when the process is created, which leads to a lot of wasted space and
complicated configuration.

In the current implementation, the whole userspace is managed as a memory pool that consists of chunks. There
are two kinds of chunks:
(1) Single VMA chunk: a chunk with only one VMA. Should be owned by exactly one process.
(2) Multi VMA chunk: a chunk with default chunk size and there could be a lot of VMAs in this chunk. Can be used
by different processes.

This design can help to achieve mainly two goals:
(1) Simplify the configuration: Users don't need to configure the process.default_mmap_size anymore. And multiple processes
running in the same Occlum instance can use dramatically different sizes of memory.
(2) Gain better performance: Two-level management(chunks & VMAs) reduces the time for finding, inserting, deleting, and iterating.
2021-10-17 15:58:29 +08:00
LI Qing
eb046d4241 Add O_TRUNC support in open syscall and rewrite the truncate test 2021-06-04 11:47:38 +08:00
Hui, Chunyang
6d37dd2d90 Add support for mremap with file-backed memory 2021-05-23 15:14:06 +08:00
Hui, Chunyang
c4c3315c06 Fix false alarm on non-page-aligned size for mprotect 2021-02-23 20:59:17 +08:00
Tate, Hongliang Tian
a6dbce21cc Add msync system call and flush updates to shared file memory mappings
1. Add msync-related methods to VMManager;
2. Add msync system call;
3. Fix munmap, fsync, and fdatasync system calls;
4. Add test cases.
2020-07-17 16:57:00 +00:00
Tate, Hongliang Tian
bca0663972 Add mprotect system call 2020-06-19 07:32:31 +00:00
Tate, Hongliang Tian
70d3991ff5 Rewrite mremap system call
This rewrite serves three purposes:
1. Fix some subtle bugs in the old implementation;
2. Implement mremap using mmap and munmap so that mremap can automatically
enjoy new features (e.g., mprotect and memory permissions) once mmap and
munmap support the feature.
3. Write down the invariants hold by VMManager explictly so that the correctness
of the new implementation can be reason more easily.
2020-06-13 03:33:32 +00:00
LI Qing
e6996f3c45 Add mremap system call 2020-05-29 03:38:49 +00:00
Hui, Chunyang
5b695c9539 Format c/c++ files in src, tools and test 2020-05-27 07:09:18 +00:00
He Sun
2357f8ed1c Refactor THROW_ERROR macro in tests
1. Rename the macro name as all uppercase letters
2. Rewrite the macro in `do { ... } while (0)` instead of `while (1) { ... }`
2019-11-28 11:10:23 +00:00
Shuang Liu
68e02962d5 Harden SEFS with extra MAC and permission checks 2019-10-12 16:55:57 +00:00
Tate, Hongliang Tian
e1e46c9935 Add clock_gettimeofday 2019-07-18 10:51:12 +00:00
Tate, Hongliang Tian
56c69b5f3c Refactor mmap implementation
1. Add a full test suite for mmap
2. Implement file-backed memory mapping
3. Implement fixed, anonymous memory mapping
4. Implement hinted, anonymous memory mapping
5. Implement munmap that covers partial/multiple memory mappings
2019-07-01 11:56:04 +08:00