Commit Graph

9 Commits

Author SHA1 Message Date
LI Qing
215e8ffbdf Add support for robust futex syscalls 2021-07-30 10:25:24 +08:00
Hui, Chunyang
5b695c9539 Format c/c++ files in src, tools and test 2020-05-27 07:09:18 +00:00
Tate, Hongliang Tian
2a1d3d98c5 Refactor the process/thread subsystem
As a major rewrite to the process/thread subsystem, this commits:
1. Implements threads as a first-class object, which represents a group of OS resources
and a thread of execution;
2. Implements processes as a first-class object that manages threads and maintains
the parent-child relationship between processes;
3. Refactors the code in process subsystem to follow the improved coding style and
conventions emerged in recent commits;
4. Refactors the code in other subsystems to use the new process/thread subsystem.
2020-04-15 06:22:41 +00:00
Tate, Hongliang Tian
9713e74ed9 Add the support for setting log level at runtime
Now one can specify the log level of the LibOS by setting `OCCLUM_LOG_LEVEL`
environment variable. The possible values are "off", "error", "warn",
"info", and "trace".

However, for the sake of security, the log level of a release enclave
(DisableDebug = 1 in Enclave.xml) is always "off" (i.e., no log) regardless of
the log level specified by the untrusted environment.
2020-03-25 01:40:47 +00:00
LI Qing
eff91daac9 Add timeout support for futex wait 2020-03-24 20:05:06 +08:00
LI Qing
4ee3396152 Refactor the futex implementation
1. Use multiple futex buckets to reduce lock contention on futex data
strcutures
2. Add FUTEX_REQUEUE support
3. Add the condition variable test case
2019-12-10 06:03:03 +00:00
Tate, Hongliang Tian
663f548f94 Workaround exit_group syscall
BACKGROUND

The exit_group syscall, which is implicitly called by libc after the main function
returns, kills all threads in a thread group, even if these threads are
running, sleeping, or waiting on a futex.

PROBLEM

In normal use cases, exit_group does nothing since a well-written program
should terminate all threads before the main function returns. But when this is
not the case, exit_group can clean up the mess.

Currently, Occlum does not implement exit_group. And the Occlum PAL process
waits for all tasks (i.e., SGX threads) to finish before exiting. So without
exit_group implemented, some tasks may be still running if after the main task
exits. And this causes the Occlum PAL process to wait---forever.

WORKAROUND

To implement a real exit_group, we need signals to kill threads. But we do not
have signals, yet. So we come up with a workaround: instead of waiting all
tasks to finish in PAL, we just wait for the main task. As soon as the main
task exits, the PAL process terminates, killing the remaining tasks.
2019-11-07 13:34:53 +00:00
Tate, Hongliang Tian
bd82b27762 Use mutex in Pthread test 2019-04-06 22:55:16 +08:00
Tate, Hongliang Tian
660d0931cd Add Pthread test 2019-04-06 22:55:16 +08:00