Commit Graph

331 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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