Commit Graph

646 Commits

Author SHA1 Message Date
Zheng, Qi
1eb58a5eb3 Add new_fd range check for dup2/dup3
Signed-off-by: Zheng, Qi <huaiqing.zq@antgroup.com>
2021-10-22 17:50:48 +08:00
Zheng, Qi
3c9e172550 Add RLIMIT_RTTIME to make it compatibale with latest Linux kernel
Signed-off-by: Zheng, Qi <huaiqing.zq@antgroup.com>
2021-10-22 17:50:48 +08:00
Zheng, Qi
a16ba58b31 Set default RLIMIT_NOFILE to 1024
Signed-off-by: Zheng, Qi <huaiqing.zq@antgroup.com>
2021-10-22 17:50:48 +08:00
zongmin.gu
59986df1a5 Bump version to 0.24.2 2021-10-22 17:16:52 +08:00
Hui, Chunyang
1745825e81 Add support for mprotect PROT_GROWSDOWN 2021-10-18 19:49:28 +08:00
Zheng, Qi
0eb3353b7c Return current break if brk failed
Signed-off-by: Zheng, Qi <huaiqing.zq@antgroup.com>
2021-10-18 14:10:19 +08:00
LI Qing
030b1c7fdf Fix the memory leak in procfs 2021-10-18 13:43:02 +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
zongmin.gu
c6d474bb7b Bump version to 0.24.1 2021-10-01 08:29:25 +08:00
LI Qing
a8cd5eadba Fix the type conversion in statfs with TryFrom trait 2021-09-22 15:11:48 +08:00
LI Qing
c9083c787c Fix the return error code of file operations 2021-09-22 15:10:59 +08:00
zongmin.gu
85f9333fbe Bump version to 0.24.0 2021-09-15 14:49:25 +08:00
LI Qing
8f4fbba220 Add file POSIX advisory range lock 2021-09-15 11:15:42 +08:00
LI Qing
d24f89fd9c Add getrandom syscall 2021-09-06 19:20:51 +08:00
LI Qing
85d6977118 Modify the statfs on SEFS or UnionFS with ocall 2021-09-05 16:00:00 +08:00
LI Qing
29eed82a7e Add support for the mode of fallocate 2021-09-01 19:24:22 +08:00
Hui, Chunyang
99688183f0 Add vfork support 2021-08-24 11:24:03 +08:00
Hui, Chunyang
88f04c8df9 Add process group implementation and support set/getpgid, set/getpgrp 2021-08-20 08:34:44 +08:00
zongmin.gu
35229d495e Bump to 0.23.7 2021-08-11 16:13:26 +08:00
zongmin.gu
4e3c9c20c4 Fix exec mode memory leak issue 2021-08-10 12:25:57 +08:00
LI Qing
87c1c9a8b3 Add support for umask 2021-08-09 16:50:53 +08:00
zongmin.gu
7c170807bc Bump to 0.23.6 2021-08-06 12:58:56 +08:00
LI Qing
b390ecaae9 Add creat syscall 2021-08-06 10:40:44 +08:00
LI Qing
c5c18ccd6d Fix the event_monitor when updating host file events
When no events happen, the state of host file events will not be reset,
so the event_monitor should always update the state after polling files.
2021-08-06 10:29:25 +08:00
Hui, Chunyang
80a27bc0f9 Reap zombie children when exit
This can fix memory leakage when parent not wait4 children.
2021-08-05 17:52:45 +08:00
LI Qing
865e38258b Add support for '/proc/[pid]/stat'
Many field values are displayed as 0
2021-08-05 16:10:54 +08:00
LI Qing
28c0d55c88 Re-organize the structure of procfs 2021-08-05 16:10:54 +08:00
Hui, Chunyang
b2b86b796a Add support for /dev/fd 2021-08-03 21:30:15 +08:00
LI Qing
dc37995bf0 Add getdents support for procfs's inode 2021-08-03 20:40:07 +08:00
LI Qing
215e8ffbdf Add support for robust futex syscalls 2021-07-30 10:25:24 +08:00
zongmin.gu
22af91b9e7 Bump version to 0.23.5 2021-07-29 14:09:36 +08:00
zongmin.gu
1e03b34a3f Update Cargo lock file to align resolv-conf change 2021-07-29 14:09:36 +08:00
ClawSeven
d35d98d551 Add resolv-conf parser 2021-07-28 10:52:46 +08:00
Hui, Chunyang
1acfec6b12 Add support for fchdir and support cd for fish 2021-07-28 09:11:19 +08:00
LI Qing
a54de67431 Fix the wrong value returned from getcwd
`getcwd` should return the length of buffer filled
2021-07-27 13:05:35 +08:00
Hui, Chunyang
123369d6ce Fix panic for empty file actions 2021-07-26 19:41:54 +08:00
Hui, Chunyang
5963b70b97 Don't allocate extra memory if already aligned 2021-07-23 13:52:31 +08:00
Hui, Chunyang
3612442adc Fix an error when calculating elf memory usage
VMLayout was mistakenly used to calculate the memory usage. This
commit is to fix this and seperate VMLayout "add" and "extend"
methods.
2021-07-23 13:52:31 +08:00
Hui, Chunyang
f9bafa23a4 Fix uninitialized elf memory for loadable segment 2021-07-23 13:52:31 +08:00
Hui, Chunyang
7d54706a8e Add signal check before sigtimedwait return with timeout 2021-07-22 20:24:35 +08:00
zongmin.gu
6adf171bf7 Bump version to 0.23.4 2021-07-21 21:19:31 +08:00
LI Qing
17e4810d3e Add support for "/proc/[pid]/comm" and fix "/proc/[pid]/cmdline" 2021-07-20 19:56:12 +08:00
Hui, Chunyang
e0811a53d2 Bump version to 0.23.3 2021-07-19 19:08:01 +08:00
Shuocheng Wang
3e7fc94ca7 Fix the return value of sched_getaffinity. 2021-07-19 13:23:44 +08:00
ClawSeven
eb07b01ac0 Support timerfd-related syscall 2021-07-16 14:36:27 +08:00
Hui, Chunyang
1e7d258989 Bump version to 0.23.2 2021-07-15 10:03:59 +08:00
LI Qing
1e24dcea6a Modify the protect-integrity tool to print result on file 2021-06-28 21:11:41 +08:00
Hui, Chunyang
6ff50da5be Bump version to 0.23.1 2021-06-25 21:12:42 +08:00
zongmin.gu
f961b786da Bump Occlum version to 0.23.0 2021-06-11 07:41:12 +08:00
Hui, Chunyang
c62b6d4091 Add support for execve
RFC: https://github.com/occlum/occlum/issues/429
2021-06-10 20:59:06 +08:00
Hui, Chunyang
bad2581a25 Add dummy implementation of getsockopt for unix domain socket 2021-06-10 20:50:30 +08:00
Hui, Chunyang
0dc85f8229 Add support for indexing unix domain socket file with inode 2021-06-10 20:50:30 +08:00
zongmin.gu
2cedafeacb Add getgroups syscall 2021-06-10 20:14:37 +08:00
Hui, Chunyang
883f7b259f Add support for ioctl FIONREAD, FIOCLEX, FIONCLEX for pipe and uds file 2021-06-07 08:28:51 +08:00
zongmin.gu
3756f0658c Update rust-toolchain to nightly-2020-10-25 2021-06-04 11:59:11 +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
LI Qing
001df6f309 Rewrite getdents syscall 2021-06-04 11:37:19 +08:00
LI Qing
789b57c6f7 Add statfs and fstatfs syscall 2021-06-04 11:36:47 +08:00
zongmin.gu
070bdf6f39 Add sendmmsg syscall 2021-06-03 16:24:34 +08:00
Hui, Chunyang
d15a75fafb Add support for POSIX_SPAWN_SETSIGMASK and POSIX_SPAWN_SETSIGDEF 2021-06-01 20:34:51 +08:00
LI Qing
69c79d8252 Fix a potential deadlock when dereference procfs's symlink 2021-06-01 18:40:41 +08:00
LI Qing
9a76ca1888 Add support for '/proc/[pid]/root' 2021-05-25 12:04:50 +08:00
Hui, Chunyang
6d37dd2d90 Add support for mremap with file-backed memory 2021-05-23 15:14:06 +08:00
Hui, Chunyang
a95e26df42 Add support for WNOHANG of waitpid option 2021-05-10 10:11:24 +08:00
LI Qing
ba720dc346 Add fstat support for pipe 2021-05-08 11:25:08 +08:00
Hui, Chunyang
f77e2c5e89 Add support for ioctl TCGETS/TCSETS 2021-04-29 14:23:01 +08:00
zongmin.gu
47349c8d1b Bump the Occlum version to 0.22.0 2021-04-16 09:34:26 +08:00
Hui, Chunyang
df73dd5d7b Remove CLONE_PARENT_SETTID from clone mandatory flags 2021-04-13 20:22:02 +08:00
Hui, Chunyang
a9574ca22e Fix ELF not running when load address not start from zero 2021-04-08 19:04:50 +08:00
Hui, Chunyang
09bac3d4b5 Fix panic for non-specified exec file path
This commit can prevent panic when user input:
	occlum run /bin
2021-04-08 11:16:55 +08:00
LI Qing
8db6a55696 Mount ramfs at '/dev/shm' 2021-04-01 14:16:07 +08:00
LI Qing
64a980f529 Add time syscall and default localtime support 2021-03-26 16:56:57 +08:00
Hui, Chunyang
ef7b663c4d Export error message when parsing Elf header 2021-03-22 18:53:22 +08:00
LI Qing
d1edb0e218 Release the check for maximum leaf in cpuid exception 2021-03-16 14:24:01 +08:00
Hui, Chunyang
d0331bd397 Add detection for FSGSBASE enablement in PAL 2021-03-11 14:51:52 +08:00
zongmin.gu
17fcaf85e1 Bump version to 0.21.0 2021-03-03 16:07:51 +08:00
zongmin.gu
9fc81fcc87 Update exec mode to handle uRTS crash case 2021-03-03 16:07:51 +08:00
zongmin.gu
0252f98d60 Enable exception test cases under simulation mode 2021-03-03 16:07:51 +08:00
LI Qing
be62e2c65d Add posix_fallocate 2021-03-03 11:06:09 +08:00
LI Qing
3dbf050904 Add sync_all, sync_data and poll for hostfs file 2021-03-02 13:47:02 +08:00
zongmin.gu
7122529b6b Fix affinity array size incorrect issue 2021-03-02 13:45:07 +08:00
LI Qing
7deeccb03b Fix the error of demos with encrypted fs image 2021-03-02 13:25:36 +08:00
LI Qing
c3a02ffc28 Add support for the encrypted fs image 2021-03-01 16:45:01 +08:00
Hui, Chunyang
a2959c17df Reduce redundant mprotect ocall 2021-02-24 14:46:41 +08:00
Hui, Chunyang
79b264a6c8 Add support for Address Space Layout Randomization
ASLR is only enabled on release mode. Also manage the whole process
VM with VMManager.
2021-02-24 14:46:41 +08:00
LI Qing
d7b994bc7d Fix getdents cannot output all entries in a directory 2021-02-24 13:24:54 +08:00
Hui, Chunyang
c4c3315c06 Fix false alarm on non-page-aligned size for mprotect 2021-02-23 20:59:17 +08:00
Hui, Chunyang
1fab79681b Use goblin as elf parser and only load segments on demand
Libos now Only read in headers and needed segments. Also reduce a memory
copy.
2021-02-04 15:02:28 +08:00
zongmin.gu
fdde009e5d Bump Occlum version to 0.20.0 2021-01-22 17:36:53 +08:00
He Sun
1788f94bfe Fix the poll of channel according to gvisor pipe poll test 2021-01-22 13:22:02 +08:00
He Sun
2ea7fc1ad6 Add Unix socket support for poll
A relay notifier that observes the underlying endpoint is added as the
notifier for the socket. It broadcasts to its observers when either end
of the channel has IoEvents.
2021-01-21 23:45:36 +08:00
He Sun
0b829ca087 Fix the return IoEvents of channel poll 2021-01-21 23:45:36 +08:00
He Sun
3101d8fa88 Resolve the nested block of Unix socket
Read, write, connect and accept have both blocking and nonblocking mode.
It may block after the status lock is acquired resulting in potential
deadlock. This commit resolve the deadlock issue.
2021-01-21 23:45:36 +08:00
He Sun
1101bdf9e7 Fix multiplication overflow 2021-01-21 18:18:57 +08:00
LI Qing
0b51d83811 Add ProcFS 2021-01-20 12:42:00 +08:00
LI Qing
8bfef4086f Polish the function names in FS 2021-01-20 12:42:00 +08:00
LI Qing
d6cd89f03b Add DevFS for device files 2021-01-20 11:40:39 +08:00
He Sun
b5ea09066a Add support for libos code coverage
1. Add OCCLUM_COV to conditionally enable gcov profiling for libos Rust
code;
2. Add a makefile target to locally generate the coverage report in html
format.
2021-01-19 15:30:26 +08:00
zongmin.gu
e304c9fa23 Bump version to 0.19.1 2021-01-13 11:09:16 +08:00
LI Qing
6416692a16 Fix the wrong definition of StructuredIoctlArgType 2021-01-08 15:38:37 +08:00
He Sun
7c4c5dd7e5 Fix wrong SIGPIPE number 2021-01-07 12:45:38 +08:00
zongmin.gu
3cb3165f8b Bump Occlum version to 0.19.0 2020-12-19 19:53:31 +08:00
LI Qing
e1c9739577 Remove the flags argument handling in fchmodat syscall
The flags argument of fchmodat syscall is handled by the wrapper
function in libc already, so Occlum does not need to accept this argument.
2020-12-19 19:53:31 +08:00
He Sun
f1e5f574ca Add support for DCAP
1. Five new ioctl commands of /dev/sgx are added for occlum
applications to securely get and verify DCAP quote;
2. Not all the functions of the intel DCAP package are open to
developers to simplify the DCAP usage;
3. The test may only run on the platform with DCAP driver installed;
4. A macro OCCLUM_DISABLE_DCAP is used to separate the DCAP code from
the other code.
5. Skip DCAP test when DCAP driver is not detected or in simulation mode
2020-12-19 19:53:31 +08:00
LI Qing
a53562adea Add support to mount FS at any existing directories 2020-12-17 15:55:40 +08:00
zongmin.gu
ce174e1496 Fix the UDS path too long issue 2020-12-16 23:28:24 +08:00
LI Qing
1a00884e1c Optimize the loading process of the ELF file
1. Load ld.so according to the executable automatically
2. Add the position-independent check for ELF file
2020-12-16 19:21:22 +08:00
LI Qing
318f1e6a4f Add posix_spawn support for Glibc 2020-12-16 19:21:22 +08:00
LI Qing
40a52b56be Initialize a randon number on stack for the stack protector 2020-12-16 19:21:22 +08:00
He Sun
3b915db774 Refactor Unix socket
1. Implement type-safe functions;
2. Improve the correctness of nearly all the functions;
3. Improve the readability by introducing Listener and Endpoint for StreamUnix;
4. Substitue RingBuf with Channel in Unix socket.
2020-12-16 01:28:53 +08:00
zongmin.gu
1f1502c7d5 Bump to 0.18.1 2020-12-03 10:57:22 +08:00
zongmin.gu
f699ff3efd Fix Occlum memory leak issue
The enable_backtrace function should only be used in the init function.
2020-12-02 15:08:50 +08:00
zongmin.gu
b5e3558f5f Enable EPC usage measurement feature 2020-12-02 15:08:50 +08:00
Tate, Hongliang Tian
9809d81c4e Fix a bug of channels
This bugfix ensures that when an object of Producer/Consumer for
channels is dropped, its shutdown method is called automatically. This ensures
that the peer of a Producer/Consumer gets notified and won't wait indefinitely.
2020-12-02 14:51:26 +08:00
Hui, Chunyang
0a810b9b58 Add return error code for ecall 2020-12-02 13:29:41 +08:00
zongmin.gu
928cfecf9d Change Tcmalloc as optional feature
The current Tcmalloc has memory leak issue. So change it as optional. By
default, dlmalloc is used. Enable tcmalloc with below command:
make TCMALLOC=Y
2020-11-23 21:26:41 +08:00
zongmin.gu
3163a62963 Bump version to 0.18.0 2020-11-20 09:24:24 +08:00
LI Qing
4769a2600e Add FUTEX_WAIT_BITSET and FUTEX_WAKE_BITSET options for futex syscall 2020-11-20 09:24:24 +08:00
Tate, Hongliang Tian
34288a5e37 Use HostFd to manage the lifetime of host OS resources 2020-11-19 08:13:57 +08:00
Tate, Hongliang Tian
83ce318f6c Unregister a file from epoll files when the file is closed
Usually, files are unregistered from an epoll file via the EPOLL_CTL_DEL command
explicitly. But for the sake of users' convenience, Linux supports
unregistering a file automatically from the epoll files that monitor the file
when the file is closed. This commit adds this capability.
2020-11-18 22:17:23 +08:00
Tate, Hongliang Tian
1de089ac7d Rewrite the select syscall using the new poll implementation 2020-11-18 19:35:04 +08:00
Tate, Hongliang Tian
a857cf9bfb Fix a design flaw in handling events of host files 2020-11-18 19:35:04 +08:00
Tate, Hongliang Tian
798cbfd843 Fix pushing/popping zero-length slices to/from Channel 2020-11-18 19:35:04 +08:00
Tate, Hongliang Tian
10f3ffa9e6 Fix Channel's notifier being inconsistent with poll/epoll 2020-11-18 19:35:04 +08:00
Tate, Hongliang Tian
5b6d06b808 Fix a bug in poll's handling of input pollfds 2020-11-18 19:35:04 +08:00
zongmin.gu
0490164a8f Replace dlmalloc with tcmalloc 2020-11-18 16:46:38 +08:00
LI Qing
9bf2a77e16 Add getdents syscall 2020-11-18 16:44:11 +08:00
Hui, Chunyang
72ad448cf9 Fix cargo fmt error 2020-11-18 11:54:22 +08:00
zongmin.gu
d63bfac61c Remove the FP area initialization code
When using the optimized string lib in Occlum, the memset function would
use xmm0 register, as the result, the FP area initialization code would
modify the FP area before saving it. So just ignor the FP area
initialization code.
2020-11-17 14:42:39 +08:00
LI Qing
5f05c16700 Init the memory for elf to zero 2020-11-16 15:04:13 +08:00
Tate, Hongliang Tian
71df1cf2c8 Add the new poll implementation 2020-11-12 15:49:20 +08:00
Tate, Hongliang Tian
7133315f46 Make the IoEvents type to more complete and robust 2020-11-12 15:49:20 +08:00
He Sun
4260a8defc Fix two cpuid bugs
1. >> has higher precedence than &. Use parentheses to conduct & first;
2. In the latest Intel software developer's manual, cpuid leaf 06H EDX
is related to the logical processor.
2020-11-12 15:48:04 +08:00
Tate, Hongliang Tian
6fdfa57a14 Add the new epoll implementation
Before this commit, the epoll implementation works by simply delegating to the
host OS through OCall. One major problem with this implementation is
that it can only handle files that are backed by a file of the host OS
(e.g., sockets), but not those are are mainly implemented by the LibOS
(e.g., pipes). Therefore, a new epoll implementation that can handle all
kinds of files is needed.

This commit completely rewrites the epoll implementation by leveraging
the new event subsystem. Now the new epoll can handle all file types:

1. Host files, e.g., sockets, eventfd;
2. LibOS files, e.g., pipes;
3. Hybrid files, e.g., epoll files.

For a new file type to support epoll, it only neends to implement no
more than four methods of the File trait:

* poll (required for all file types);
* notifier (required for all file files);
* host_fd (only required for host files);
* recv_host_events (only required for host files).
2020-11-10 14:34:40 +08:00
Tate, Hongliang Tian
2ff4b1c776 Reduce the FileRef type to Arc<dyn File>
The FileRef type was defined as Arc<Box<dyn File>>, where the use of Box is
unnecessary. This commit reduces the type to Arc<dyn File>.
2020-11-10 14:34:40 +08:00
LI Qing
6e83595b74 Fix the return value of getcwd syscall 2020-11-09 19:45:21 +08:00
LI Qing
f87bbc586b Fix the alignment of stack entrypoint
Libc ABI requires 16-byte alignment of the stack entrypoint
2020-11-09 19:43:00 +08:00
He Sun
9dd94cdbd6 Fix the conflict of symbols with glibc 2020-11-05 21:57:48 +08:00
He Sun
0bb8f5922e Use sccache to accelerate Rust build 2020-11-05 21:54:57 +08:00
zongmin.gu
a5c2e553b7 Bump version to 0.17.0 2020-10-22 19:53:20 +08:00
Hui, Chunyang
8d1e1838d3 Fix package build errors
1. Fix repeatedly linking dynamic libraries for occlum-run
2. Fix gcc toolchain deb package build error
3. Remove redundant file from installer file list
4. Change symlink target path to relative path
2020-10-22 16:47:47 +08:00
He Sun
4f02e71160 Only copy the received data to user space in recvmsg
Redundant copy may result in dirty data.
2020-10-22 15:51:07 +08:00
LI Qing
28f47dacce Add ioctl support for FIONBIO command 2020-10-21 12:51:18 +08:00
He Sun
d590486029 Refactor host socket
1. Add Rust memory-safe types, e.g., socket_address, address_family and socket_type;
2. Implement Berkeley Sockets API for HostSocket.
2020-10-21 12:24:00 +08:00
LI Qing
230e6fa380 Report the underlying SGX protected file I/O error 2020-10-21 12:20:52 +08:00
Hui, Chunyang
e82b3dab92 Integrate cargo fmt into make format 2020-10-14 20:34:12 +08:00
Tate, Hongliang Tian
f5ae00895e Refactor pipe with the new event subsystem
1. Introduce channels, which provide an efficient means for IPC;
2. Leverage channels to rewrite pipe, improving the performance (3X),
robustness, and readability.

This pipe rewrite is not done: some more commits will be added to
implement poll and epoll for pipe.
2020-10-09 16:37:11 +08:00
Tate, Hongliang Tian
f39a31cda0 Fix a bug in HostEventFd 2020-10-09 16:37:11 +08:00
Tate, Hongliang Tian
567e965eae Add sigtimedwait syscall 2020-09-29 18:10:30 +08:00
Tate, Hongliang Tian
9bb1baef4e Add the event subsystem
An event can be anything ranging from the exit of a process (interesting
to `wait4`) to the arrival of a blocked signal (interesting to
`sigwaitinfo`), from the completion of a file operation (interesting to
`epoll`) to the change of a file status (interesting to `inotify`).

To meet the event-related demands from various subsystems, this event
subsystem is designed to provide a set of general-purpose primitives:

* `Waiter`, `Waker`, and `WaiterQueue` are primitives to put threads
to sleep and later wake them up.
* `Event`, `Observer`, and `Notifier` are primitives to handle and
broadcast events.
* `WaiterQueueObserver` implements the common pattern of waking up
threads once some interesting events happen.
2020-09-29 18:08:10 +08:00
He Sun
c39b6f1dc2 Eliminate compiler warnings 2020-09-27 14:17:01 +08:00
Tate, Hongliang Tian
01dee44322 Bump version to 0.16.0 2020-09-18 15:40:04 +08:00
zongmin.gu
b28aee68b7 Upgrade Intel SGX SDK to 2.11 and Rust SGX SDK accordingly 2020-09-18 15:39:58 +08:00
Hui, Chunyang
4031216f13 Add timerslack concept for libos and enbale prctl PR_GET_TIMERSLACK option 2020-09-18 12:39:12 +08:00
LI Qing
1a11655169 Fix two bugs related to open directories
1. Support O_DIRECTORY flag for open syscall
2. Disallow to open a directory in write mode
2020-09-18 12:39:12 +08:00
LI Qing
292fc28340 Add "*at()" system calls
The syscalls implemented in this submission are as follows:
fchmodat, fchownat, linkat, mkdirat, renameat, readlinkat, unlinkat
2020-09-18 12:39:12 +08:00
He Sun
9c390923a5 Narrow the focus of exec client/server build
Only change of the proto file should trigger the build script.
2020-09-18 12:39:12 +08:00
He Sun
83fcd47cd0 Reorganize the header files of pal 2020-09-18 12:39:12 +08:00
He Sun
5d5e8d44ec Pass host-generated SIGPIPE to libos
Socket-related ocalls, e.g, sendto, sendmsg and write, may cause SIGPIPE
in host. Since the ocall is called by libos, this kind of signal should
be handled in libos. We ignore SIGPIPE in host and raise the same signal
in libos if the return value of the above ocalls is EPIPE. In this way
the signal is handled by libos.
2020-09-18 12:39:12 +08:00
Hui, Chunyang
7b882bd368 Add support for pal library to run libos outside occlum instance 2020-09-18 12:39:12 +08:00
He Sun
e13242e7e5 Add netdevice ioctl command 2020-09-18 12:39:12 +08:00
Zongmin
edd0980dc3 Fix exec mode occlum server crashes issue (if the client unexpected exit) 2020-09-18 12:39:12 +08:00
Tate, Hongliang Tian
ccb5e6bef4 Bump version to 0.15.1 2020-08-21 00:19:57 +08:00
LI Qing
70d7d10eeb Add support to mkdir & rmdir in hostfs 2020-08-20 17:03:30 +08:00
LI Qing
7d31cb743c Add support to read directory in hostfs 2020-08-20 17:03:30 +08:00
zongmin.gu
85f5bc7ccc Fix a potential memory issue in fpregs' free 2020-08-20 17:01:08 +08:00
duanbing
000cd88756 Get quote size dynamiclly 2020-08-17 01:30:24 +08:00
Tate, Hongliang Tian
3e3a1955af Bump version to 0.15.0 2020-08-15 19:19:53 +08:00
Hui, Chunyang
9435b1a196 Add RPM installer for Occlum and C/C++ toolchains 2020-08-15 19:12:40 +08:00
zongmin.gu
2ca5629b3d Save floating point registers in exception/interrupt flow 2020-08-15 19:12:40 +08:00
zongmin.gu
68c8cc100b Fix the syscall interface bug 2020-08-15 19:12:40 +08:00
Hui, Chunyang
7ac917aa1a Fix PAL library command arguments not follow convention 2020-08-15 19:12:39 +08:00
Hui, Chunyang
66e5cefec2 Add "occlum new" command 2020-08-15 19:12:39 +08:00
Hui, Chunyang
85501d8993 Improve implementation for occlum build
This commit mainly accomplish two things:
1. Use makefile to manage dependencies for `occlum build`, which can save lots of time
2. Take dirs `build`, `run` outside from `.occlum`. Remove env var "OCCLUM_INSTANCE_DIR"
2020-08-15 19:12:39 +08:00
LI Qing
3f6bcec1c5 Substitute ramFS with a temporary SEFS at "/tmp" 2020-08-15 19:12:39 +08:00
He Sun
b04aa2d7ea Fix the dequeuing order of items in a FutexBucket 2020-08-15 19:12:39 +08:00
LI Qing
6d39587c40 Add getcpu syscall 2020-08-15 19:12:39 +08:00
zongmin.gu
c67bdd9a23 Update the syscall interface 2020-08-11 17:35:03 +08:00
Hui, Chunyang
259c485427 Use new build directory arch 2020-08-11 13:47:17 +08:00
He Sun
9b17ac1847 Improve futex performance
1. Enlarge the size of the futex buckets;
2. Wake up the waiting threads in one ocall.
2020-07-28 13:14:27 +08:00
He Sun
2400cc4baa Fix the signal action examination of SIGKILL and SIGSTOP
Sigaction() can be called with a NULL second argument to query the
current signal handler.
2020-07-28 12:20:34 +08:00
LI Qing
572873d9a4 Enable UnionFS 2020-07-23 21:40:34 +08:00
Tate, Hongliang Tian
55eaae8810 Bump version to 0.14.0 2020-07-18 06:36:59 +08:00
Hui, Chunyang
ebd7dc056b Add occlum specific EDL file to decouple with official linux-sgx-sdk psw
In this case, sefs-fuse can run with official linux-sgx-sdk psw.
2020-07-18 06:36:59 +08:00
Tate, Hongliang Tian
8c7b59ad17 Fix a bug in sigaction
The bug would allow the user to block non-blockable signals (SIGKILL and SIGSTOP)
using sigaction syscall. This commit fixes this bug.
2020-07-18 01:39:04 +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
He Sun
c85163ec0a Add notification mechanism for basic IO events
1. Add notification mechanism for select, poll, epoll and blocking IO
2. Add pipe support for select, poll and blocking IO
2020-07-18 00:27:26 +08:00
Hui, Chunyang
9b1d694830 Add support for per-process memory size configuration with rlimit
Rlimit are now on the same page of memory space limits defined in Occlum.json. Specific
memory size configuration can be set to child process with `prlimit` syscall or using `ulimit`
command in shell script.
2020-07-17 22:07:56 +08:00
Hui, Chunyang
c43fbfea7f Fix signal testcase and a bug in sig_set 2020-07-17 18:02:09 +08:00
Hui, Chunyang
4f96790cf3 Fallback to old way for exit process in simulation mode 2020-07-16 21:35:47 +08:00
zongmin.gu
45b799d99f Stop the server within the given seconds.
If a new command comes when the timer is not triggered, stop the timer.
2020-07-16 20:12:12 +08:00
He Sun
3d70ca9355 Substitute SgxRwLock with RwLock 2020-07-16 14:35:38 +08:00
He Sun
4f965fd8db Apply RwLock to the sig_queues of Process and Thread
The new RwLock has better performance than SgxMutex and SgxRwLock.
2020-07-16 14:35:38 +08:00
He Sun
83637d7938 Add a new kind of readers-writer lock 2020-07-16 14:35:32 +08:00
Tate, Hongliang Tian
0db804d131 Support sa_mask for sigaction syscall
Struct sigaction has a field named sa_mask, which specifies the blocked
signals while executing the signal handler. Previously, this field is not
supported. This commit adds this missing feature.
2020-07-15 10:20:36 +08:00
He Sun
cfda47b316 Check the input buffer size against the available CPUs in sched_get/setaffinity
There are scenarios where the available CPUs are less than all the CPUs
on the machine. Therefore, sched_get/setaffinity should be allowed when
the input buffer size is no less than the available CPUs but less than
all the CPUs.
2020-07-15 09:58:23 +08:00
He Sun
b4750c0fcd Revert "Zeroize memory in munmap"
This reverts commit 1e456f025d6b4e34a726180e7a27a04424fe79d1.
This commit results in segmentation fault when the application munmaps
its own stack. Should be committed back after removing the dependency of
sysret on the user space stack.
2020-07-14 10:32:12 +08:00
Tate, Hongliang Tian
518ff76228 Bump version to 0.13.1 2020-07-11 14:19:41 +00:00
Tate, Hongliang Tian
a3ad465ce3 Fix SGX simulation mode broken by the interrupt subsystem
The new interrupt subsystem breaks the simulation mode in two ways:

1. The signal 64 is not handled by Intel SGX SDK in simulation mode. A
handled real-time signal crashes the process.

2. The newly-enabled test case exit_group depends on interrupts. But
enclave interrupts, like enclave exceptions, are not supported in
simulation mode.

This commit ensures signal 64 is ignored by default and exit_group test
case is not enabled in simulation mode.
2020-07-11 14:19:41 +00:00