Commit Graph

233 Commits

Author SHA1 Message Date
Tate, Hongliang Tian
7024fa81ec Fix benchmark programs by correcting program paths 2019-12-02 05:55:36 +00:00
Tate, Hongliang Tian
e09c747b84 Fix Dockerfile by using LIBOS_RELEASE=1 2019-12-02 05:55:23 +00:00
Tate, Hongliang Tian
814ea21997 Update README for version 0.7.0 2019-11-30 13:41:42 +00:00
LI Qing
ba3813bea8 Add XGBoost demo 2019-11-30 13:39:26 +00:00
LI Qing
ab89421f96 Add sched_yield syscall 2019-11-29 12:03:15 +00:00
LI Qing
1304f5388d Improve Occlum GCC toolchain with new wrappers for binaries
This commit makes the toolchain easier to use in two folds:
1. When compiling C/C++ source files, no need to add "-fPIC -pie" flags manually;
2. When running executables generated by the Occlum toolchain on Linux, no
need to set the `LD_LIBRARY_PATH` manually.
2019-11-29 11:20:00 +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
Zhengde Zhai
434dff9128 Harden the two enclave entry functions 2019-11-23 15:34:25 +00:00
He Sun
dc14f27a29 Add socketpair syscall
1. Support creating socket pairs of the UNIX domain
2. Add test for socketpair in test/unix_socket
3. Refactor unix_socket test
2019-11-23 15:02:47 +00:00
Tate, Hongliang Tian
9c4391b32d Introduce new infrastructure for ioctls
1. Introduce the new infrastructure for ioctl support
2. Refactor the old ioctls to use the new infrastructure
3. Implement builtin ioctls (e.g., TIOCGWINSZ and TIOCSWINSZ for stdout)
4. Implement non-builtin, driver-specific ioctls (e.g., ioctls for /dev/sgx)
2019-11-22 10:38:34 +00:00
Tate, Hongliang Tian
1024360b8c Refactor File trait with default implementation 2019-11-22 10:38:34 +00:00
He Sun
b0dfc1d69d Add epoll_pwait syscall and the test case
1. Use epoll_wait to support epoll_pwait as there is no signal mechanism
2. The timeout is fixed to zero for not waiting for any signal to come
to speed up
3. Change the test case of server_epoll to use epoll_pwait
2019-11-15 10:01:59 +00:00
He Sun
7e311ed6de Hack epoll_ctl to ignore non-socket fds 2019-11-15 10:01:47 +00:00
Tate, Hongliang Tian
5fa91becfa Build C++ source files under libos/ and pal/ 2019-11-12 16:28:17 +00:00
Tate, Hongliang Tian
91b30c19ae Fix a typo in error message from entry point checking 2019-11-12 16:26:33 +00:00
Tate, Hongliang Tian
83f479ab54 Fix the return value of pal 2019-11-12 16:24:45 +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
30c99add6f Add nanosleep syscall 2019-11-07 13:24:02 +00:00
Tate, Hongliang Tian
c8a921fd4b Refactor program loader to handle many loadable segments
The original implementation of program loader is written under the assumption
that there are only two loadable segments per ELF, one is code, and the other
is data. But this assumption is unnecessary and proves to be wrong for an ELF
on Alpine Linux, which has two extra read-only, loadable segments for security
hardening. This commit clears the obstacle towards running unmodified
executables from Alpine Linux.

In addition to getting rid of  the false assumption of two fixed loadable segments,
this commit improves the quality of the code related to program loading and
process initialization.
2019-11-07 13:19:09 +00:00
Zhengde Zhai
1a56fc4b72 Check program paths against entry points in Occlum.json 2019-11-07 02:42:59 +00:00
Tate, Hongliang Tian
4cb63a4d99 Fix a mistaken assert for debug build 2019-10-21 08:34:27 +00:00
Tate, Hongliang Tian
8f3ff6d866 Fix minor bugs in Dockerfile 2019-10-19 06:03:50 +00:00
Tate, Hongliang Tian
f9376ec4ba Polish the demos
1. Rename demo/ to demos/
2. Add demos/README.md
2019-10-19 02:04:13 +00:00
Tate, Hongliang Tian
6dc9906c8e Preinstall Occlum in Docker 2019-10-18 13:40:09 +00:00
Tate, Hongliang Tian
ebd3608e4a Start up AESM service automatically in Docker 2019-10-18 13:40:09 +00:00
LI Qing
ba6b4cc028 Add HTTPS file server Demo
The demo shows how to run the unmodified HTTPS file server with Occlum.
2019-10-18 13:32:05 +00:00
LI Qing
5f26bfc1fb Add C/C++ Hello World with Makefile, CMake, and Bazel 2019-10-18 12:54:07 +00:00
LI Qing
ba7db98e49 Add Tensorflow Lite Demo
The demo shows how to run the unmodified Tensorflow Lite on Occlum.
2019-10-14 08:55:45 +00:00
He Sun
24116c426f Fix address-in-use error in server and server_epoll tests 2019-10-14 14:33:27 +08:00
Tate, Hongliang Tian
1a365de08f Introduce the new error handling mechanism
* Fast error diagnosing (e.g., backtrace and code location)
* First-class POSIX errno (e.g., every error has an errno)
* Zero-overhead abstraction (e.g., no heap allocation for simple errors)
* Ergonomic grammar (e.g., providing convenient macros)
2019-10-14 03:50:20 +00:00
LI Qing
d8d51fcfd4 Support running enclaves in SGX release mode.
* 'occlum init' does not copy signing key file any more.
* 'occlum build' supports to set signing key and signing tool in args.
* 'occlum run' supports to run enclave in sgx release mode.
2019-10-12 17:16:06 +00:00
Shuang Liu
68e02962d5 Harden SEFS with extra MAC and permission checks 2019-10-12 16:55:57 +00:00
Tate, Hongliang Tian
70fd9dc210 Fix the broken backtrace info on panic 2019-10-08 03:44:04 +00:00
Tate, Hongliang Tian
ae46caa63a Fix the permissions of user-editable config files 2019-10-08 03:42:50 +00:00
He Sun
dba6467c2d Fix server_epoll test
1. Change the port for server_poll to listen to avoid "address in use" conflict
between test/server and test/server_epoll, and add port as an argument for
test/client to send message
2. As posix-spwan may fail, change the fixed number of processes to spawn to
the number of processes successfully spawned in server_epoll
2019-10-07 04:36:12 +00:00
Tate, Hongliang Tian
f414aa3eec Fix typos in README.md 2019-09-23 15:44:04 +00:00
Tate, Hongliang Tian
f04c33aae2 Update README for version 0.5.0 2019-09-07 07:35:37 +00:00
Tate, Hongliang Tian
6aa49d867a Update copyright information in LICENSE 2019-09-06 15:37:45 +00:00
Shuang Liu
d61edad08f Randomize the file names of SEFS inodes on the host FS 2019-09-06 15:08:13 +00:00
Tate, Hongliang Tian
00949d9741 Introduce GCC-base toolchain and use it by default 2019-09-06 13:02:45 +00:00
LI Qing
8ef52c7c2d Support environmental variables in Occlum.json
1. Now we support set App's env in Occlum.json, for example:
    "env": [
        "OCCLUM=yes",
        "TEST=true"
    ]
2. Rewrite env test cases
3. Update Dockerfile to install "jq" tool
2019-09-05 13:50:55 +00:00
LI Qing
f37eb34038 Rewrite cpuid and rdtsc exception handlers
1. Rewrite cpuid and rdtsc exception handle in Rust
2. Rewrite cpuid test cases
3. Update Dockerfile to install cpuid tool for test
2019-09-05 13:50:34 +00:00
Tate, Hongliang Tian
ba78f09d1c Add Hello World demo 2019-08-31 06:39:33 +00:00
Tate, Hongliang Tian
347791f235 Add install target for Makefile 2019-08-31 06:01:16 +00:00
Tate, Hongliang Tian
5c5b0ea429 Add Git hooks that check Rust code format issues 2019-08-28 06:32:50 +00:00
Tate, Hongliang Tian
d77c21f98c Add a command-line interface tool named occlum
1. All generated, build files are now in a separate build directory;
2. The CLI tool supports three sub-commands: init, build, and run;
3. Refactor tests to use the new tool.
2019-08-28 06:05:12 +00:00
Tate, Hongliang Tian
7001b32a4a Format all Rust code with cargo fmt
In addition, to ensure that all future Rust code complies with
`cargo fmt`, we add a Git post-commit hook that generates warnings
if the commited code is not formated consistently.
2019-08-17 07:38:16 +00:00
Tate, Hongliang Tian
dff0dbf77d Add the integrity-only mode SEFS
* Add patch to Rust SGX SDK to enable integrity-only SgxFile
* Upgrade to the new SEFS extended with the integrity-only mode
* Use integrity-only SEFS for /bin and /lib in test
* Add the MAC of integrity-only SEFS to Occlum.json in test
* Mount multiple FS according to Occlum.json
* Check the MACs of integrity-only SEFS images
2019-08-17 04:20:11 +00:00
Tate, Hongliang Tian
76f91a1aa3 Add Occlum.json. No more configs hardcoded in code
1. Add Occlum.json as Occlum's config file
2. Add tools/bin/build_enclave
3. Add tools/bin/protect_integrity
4. Validate Occlum.json.protected on LibOS startup
5. Parse Occlum.json.protected on LibOS startup
6. Config enclave size using Occlum.json
7. Config process memory sizes using Occlum.json
2019-08-09 09:19:51 +00:00
LI Qing
cff0de1c39 Add sched_xetaffinity() system calls in Occlum
1. LibOS support sched_getaffinity() and sched_setaffinity() system calls
2. Add sched_cpu_affinity test cases in occlum/test/sched
2019-08-05 15:22:20 +08:00