Commit Graph

731 Commits

Author SHA1 Message Date
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
Hui, Chunyang
306c0333ad Fix occlum PAL library compatibility issues in demos 2020-07-14 11:22:11 +00: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
zongmin.gu
3382a68807 Fix docker image build failure 2020-07-11 20:35:21 +08:00
Tate, Hongliang Tian
b585fce65d Add the interrupt subsystem
Before this commit, events like signals and exit_group are handled by
LibOS threads in a cooperative fashion: if the user code executed by a
LibOS thread does not invoke system calls (e.g., a busy loop), then the LibOS
won't have any opportunity to take control and handle events.

With the help from the POSIX signal-based interrupt mechanism of
Occlum's version of Intel SGX SDK, the LibOS can now interrupt the
execution of arbitrary user code in a LibOS thread by sending real-time
POSIX signals (the signal number is 64) to it. These signals are sent by
a helper thread spawn by Occlum PAL. The helper thread periodically
enters into the enclave to check if there are any LibOS threads with
pending events. If any, the helper thread broadcast POSIX signals to
them. When interrupted by a signal, the receiver LibOS thread may be in
one of the two previously problematic states in terms of event handling:

1. Executing non-cooperative user code (e.g., a busy loop). In this
case, the signal will trigger an interrupt handler inside the enclave,
which can then enter the LibOS kernel to deal with any pending events.

2. Executing an OCall that invokes blocking system calls (e.g., futex,
nanosleep, or blocking I/O). In this case, the signal will interrupt the
blocking system call so that the OCall can return back to the enclave.

Thanks to the new interrupt subsystem, some event-based system calls
are made robust. One such example is exit_group. We can now guarantee
that exit_group can force any thread in a process to exit.
2020-07-10 11:52:01 +00:00
zongmin.gu
f52a732d50 Remove the occlum server auto destory policy 2020-07-10 19:23:57 +08:00
Tate, Hongliang Tian
35787be29d Fix two bugs on process exit
The first bug is a race condition when acquiring the lock of a process's
parent. An example code with race condition looks like below:

```rust
let process : ProessRef = current!().process();
let parent : ProcessRef = process.parent();
let parent_guard : SgxMutexGuard<ProesssInner> = parent.inner();
// This assertion may fail because the process's parent may change to another
// process before the lock is acquired
assert!(parent.pid() == process.parent().pid());
```

The second bug is that when a process exits, its children processes are
not transfered to the idle process correctly.
2020-07-10 19:08:26 +08:00
LI Qing
686ec343b2 Fix the dirfd issue when path is absolute 2020-07-10 18:08:03 +08:00
LI Qing
1ad8f22170 Add support to handle symbolic link file 2020-07-10 18:08:03 +08:00
Hui, Chunyang
3cd46fd224 Add prctl support of PR_SET/GET_NAME options 2020-07-10 08:31:54 +00:00
Zongmin
b86d8ed490 Fix occlum pal build issue 2020-07-09 19:12:02 +08:00
Hui, Chunyang
406f30ec7a Polish build and install process
Remove redundent files and make processes for SGX simulation mode and hardware mode.
2020-07-08 11:51:33 +00:00
Hui, Chunyang
bf736ff09d Fix sign-key option in README 2020-07-02 02:36:23 +00:00
Hui, Chunyang
e4ef6ac7fa Disable backup file when make format 2020-07-01 21:22:29 +08:00
He Sun
1e456f025d Zeroize memory in munmap
1. Move the memory zeroization of mmap to munmap to increase mmap
performance
2. Do memory zeroizaiton during the drop of VMManager to guarentee all
allocated memory is zeroized before the next allocation
2020-07-01 20:23:54 +08:00
Hui, Chunyang
6ccd30ee3b Remove fish and busybox binaries from entrypoints to make it more secure 2020-06-27 07:56:31 +00:00
Hui, Chunyang
92207d5535 Add support for executing a script that begins with a shebang 2020-06-27 07:56:06 +00:00
He Sun
ec970f0e76 Refactor performance profiler
1. Add the thread profiler to Thread structure
2. Fix bugs introduced by previous commits
2020-06-23 22:17:41 +08:00
Junxian Xiao
86d11e9d44 Refactor the remote attestation demo
This commits consists of three major changes:

1. Support a new interface to get the base64 quote only.
This is useful in the case that application sends the quote
to service provider server and get the final IAS report there.
The application itself doesn't depend on IAS in this case.

2. Improve the C++ programming style. Now, we only provide
C++ classes and limited C APIs(for configuration and sgx device).

3. Use the more general keywords as names prefix.

Signed-off-by: Junxian Xiao <junxian.xjx@antfin.com>
2020-06-23 16:59:33 +08:00
Hui, Chunyang
6909629241 Add Occlum version for dynamic libraries 2020-06-22 07:36:03 +00:00
He Sun
f854950416 Optimize ProcessVM to be interiorly mutable 2020-06-21 16:22:03 +08:00
Tate, Hongliang Tian
bca0663972 Add mprotect system call 2020-06-19 07:32:31 +00:00
He Sun
b9b9b1032c Avoid locking for checking if a process has been forced to exit
It turns out taking a lock in every system call is a significant
performance bottleneck. In light of this finding, we replace a mutex in
a critical path of system call with an atomic boolean.
2020-06-17 22:54:33 +08:00
LI Qing
340e2188f5 Fix the path handling bug of SEFS when doing inode lookup 2020-06-17 14:51:30 +08:00
He Sun
3a5793be4f Fix set_tid_address not supporting null pointers 2020-06-17 07:44:47 +08:00
Tate, Hongliang Tian
9cefcb08b6 Bump version to 0.13.0 2020-06-13 04:29:50 +00:00
Zongmin
898967554c Link uRTS static library 2020-06-13 04:19:45 +00:00
Hui, Chunyang
6e57937b45 Add support for sysinfo syscall 2020-06-13 03:33:32 +00:00
LI Qing
c8a4f2f8aa Update SEFS to generate deterministic MAC for integrity only SEFS 2020-06-13 03:33:32 +00:00
Hui, Chunyang
9ce23a8c08 Add symbolic file support for FISH demo 2020-06-13 03:33:32 +00:00
Hui, Chunyang
bddb87a11b Fix stat for symbolic file 2020-06-13 03:33:32 +00:00
LI Qing
c8e3e0ffc6 Add clock_getres syscall 2020-06-13 03:33:32 +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
He Sun
28440b0d69 Build in the MAC of the occlum configuration file with objcopy
1. Objcopy the MAC of Occlum.json to libocclum-libos.so before signature
during occlum build.
2. Remove the files and codes no longer used.
2020-06-13 03:33:32 +00:00
He Sun
f020fed2ae Use Intel SGX SDK reserved memory as the user space memory 2020-06-13 03:33:32 +00:00
jack.wxz
cfbab68a9d Use pal api interface without prefix of libos type.
Signed-off-by: jack.wxz <wangxiaozhe@linux.alibaba.com>
2020-06-12 09:02:07 +08:00
LI Qing
a0d7b96a8f Polish the XGBoost demo
1. Remove some useless installed packages
2. Adjust max number of threads according to CPU cores
2020-06-05 15:09:26 +08:00
Junxian Xiao
e8e14350a5 Support access key in remote attestaion demo
1. add access key configuration and code
2. Upgrade libcurl to support https
3. Support debug compile mode

Signed-off-by: Junxian Xiao <junxian.xjx@antfin.com>
2020-06-05 14:52:31 +08:00
zongmin.gu
4e02db367e Update occlum exec to support kill 2020-06-05 14:52:10 +08:00
Hui, Chunyang
f4d9a7f4e1 Fix travis test script 2020-06-05 14:51:12 +08:00
Tate, Hongliang Tian
37ca75da47 Update README to explain the new Occlum.json format 2020-06-05 04:16:16 +00:00
Tate, Hongliang Tian
ffbae880f2 Reorder the config entries in Occlum.json
Not all config entries are created equal: some are more likely to be
customized by users, some are not so often. This commit reorders the
config entries in descending order of expected popularity.
2020-06-05 04:16:16 +00:00
LI Qing
c1b4814703 Rewrite Python demo with NumPy, scikit-learn, and pandas 2020-06-05 11:56:31 +08:00
zongmin.gu
942321363d Combine the enclave configuration into the occlum configuration file
Update the occlum.json to align with the gen_enclave_conf design.
Below is the two updated structures:
   "metadata": {
        "product_id": 0,
        "version_number": 0,
        "debuggable": true
    },
    "resource_limits": {
        "max_num_of_threads": 32,
        "kernel_space_heap_size": "32MB",
        "kernel_space_stack_size": "1MB",
        "user_space_size": "256MB"
    }
2020-06-05 11:03:47 +08:00
Tate, Hongliang Tian
c87ce9dd34 Bump version to 0.12.2 2020-06-04 21:39:56 +00:00
LI Qing
f54abc78a2 Support to execute a symlink file 2020-06-04 20:46:50 +08:00