Commit Graph

355 Commits

Author SHA1 Message Date
Tate, Hongliang Tian
6d7cf7b9f6 Add more info to log messages (e.g., timestamp, thread, and round) 2020-03-25 01:34:41 +00:00
Tate, Hongliang Tian
dddcb89f7e Refactor the LibOS entry point by introducing system call table
This commit introduces a system call table, which brings several benefits:

1. The table is a centralized info hub that one can find an answer for every
question about system calls, e.g., what is the number and arguments of a
system call, is it implemented or supported, and if so, what is the
function that actual implements it.

2. System call-related code can be automatically derived from the system call
table through a clever use of macros. In this way, the code avoids repeating
itself.
2020-03-25 01:15:18 +00:00
He Sun
65694815a4 Add eventfd file type and system call 2020-03-24 22:16:41 +08:00
LI Qing
f7ce60e764 Fix the emulation of RDTSC instruction with ocall 2020-03-24 22:06:14 +08:00
He Sun
e2edaa49c0 Change the flags used in sendmsg/recvmsg from raw int to memory-safe type 2020-03-24 21:51:04 +08:00
LI Qing
eff91daac9 Add timeout support for futex wait 2020-03-24 20:05:06 +08:00
LI Qing
96876b2935 Add rename for hostfs 2020-03-23 02:45:47 +00:00
LI Qing
23817fc659 Add fstatat and openat system calls 2020-03-09 16:20:51 +00:00
Tate, Hongliang Tian
66dec604e4 Update the version number to 0.10.0 2020-03-09 04:17:48 +00:00
Hui,Chunyang
4ebedd9bf5 Improve simulation mode user experience
Simulation mode and hardware mode can both work without rebuild Occlum.
2020-03-07 09:44:49 +00:00
He Sun
06f7763d55 Fix a bug in poll that modifies input fds 2020-03-07 17:37:52 +08:00
He Sun
74fad28938 Add performance profiler for threads and system calls 2020-03-07 17:35:39 +08:00
zongmin.gu
a1e003ebdb Fix two bugs by updating SDK's stack ranges on user/kernel switch
Before this commit, there are two strange bugs:
1. No backtraces are displayed on panic by Rust; and,
2. Thread local storage in Rust sometimes causes panics.

It turns out that the the root cause of the two bugs are the same: Occlum's
patch to Intel SGX SDK that informs SDK about the stack range of the currnet
LibOS user-level thread. The problem about this patch is that it modifies some
fundamental data structures and Rust SGX SDK does not know the modification.
This causes Rust SGX SDK to panic in certain conditions.

To resolve the conflict for good, this commit gets rid of the patch to Intel
SGX SDK by updating SDK's stack ranges upon user/kernel switch.
2020-03-07 08:17:40 +00:00
LI Qing
6f986855e9 Fix the issue that process resource cannot be freed in some cases
If untrusted app calls "occlum_pal_exec" sequentially or concurrently,
Occlum cannot free the resource of the enclave process correctly.
2020-03-02 14:42:19 +00:00
sanqian.hcy
b08f5b9ceb Add support for SGX simulation mode
1. Use arch_prctl to replace RDFSBASE/WRFSBASE
Ptrace can't get right value if WRFSBASE is called which
will make debugger fail in simulation mode. Use arch_prctl
to replace these instructions in simulation mode.

2. Disable the busy thread in exit_group test
exit_group doesn't have a real implementation yet but test
under SGX simulation mode give core dump for exit_group test.
Disable the busy loop thread and the core dump disappear.

3. Add SDK lib path to LD_LIBRARY_PATH
Linker sometims can't find urts_sim and uae_service_sim when
running. Explicitly add path to LD_LIBRARY_PATH when running
occlum command.

Signed-off-by: sanqian.hcy <sanqian.hcy@antfin.com>
2020-03-01 06:42:33 +00:00
LI Qing
045ea46e9f Extend CPUID emulation for Intel Celeron and newer Intel CPUs 2020-02-28 10:53:38 +00:00
LI Qing
bbd4cd9be2 Add fstat() and poll() for the random device 2020-02-27 03:41:05 +00:00
LI Qing
9f1fa883df Fix GDB cannot work in release build 2020-02-26 06:58:18 +00:00
LI Qing
551fb8f9d8 Add a dummy implementation for file advisory locks
This commits is a dummy implementation of file advisory locks.
Specifically, for regular files, fcntl `F_SETLK` (i.e., acquiring
or releasing locks) always succeeds and fcntl `F_GETLK` (i.e., testing locks)
always returns no locks.
2020-02-25 17:31:02 +08:00
Tate, Hongliang Tian
a6e55881b9 Add ioctls for SGX local attestation 2020-02-19 14:48:12 +00:00
LI Qing
76b90efa8f Fix read_at() in SEFS if offset beyond the end of the file 2020-02-14 08:05:29 +00:00
LI Qing
bd56504b20 Add GDB support for apps running upon Occlum
Please see the "gdb_support" in demos to find out how to
use GDB to debug your apps running upon Occlum.
2020-02-14 07:52:45 +00:00
LI Qing
de904bf628 Refactor the structure of FS subsystem
1. Move the system call handling functions into the "syscalls.rs"
2. Split syscall memory safe implementations into small sub-modules
3. Move the unix_socket and io_multiplexing into "net"
4. Remove some unnecessary code
2020-02-14 06:19:49 +00:00
He Sun
cfa6532768 Fix bugs that fail CentOS Dockerfile 2020-02-14 06:19:48 +00:00
LI Qing
2372ef0d4e Fix make submodule command error 2020-02-10 12:02:23 +00:00
Tate, Hongliang Tian
e96892d348 Update version number to 0.9.0 2020-01-23 10:04:38 +00:00
He Sun
e352a190ea Optimize the perf of sendmsg/recvmsg by allocating untrusted buffers directly
It is slow to allocate big buffers using SGX SDK's malloc. Even worse, it
consumes a large amount of precious trusted memory inside enclaves. This
commit avoids using trusted buffers and allocates untrusted buffers for
sendmsg/recvmsg directly via OCall, thus improving the performance of
sendmsg/recvmsg. Note that this optimization does not affect the security of
network data as it has to be sent/received via OCalls.
2020-01-23 06:58:51 +00:00
Tate, Hongliang Tian
c3d042dcd0 Refactor EDL for adding custom C types easily
Before this commit, using custom C types in ECalls/OCalls defined in Occlum's
EDL is cumbersme. Now this issue is resolved by providing `occlum_edl_types.h`
header file. There are two versions of this file: one is under
`src/libos/include/edl/` for LibOS, the other is under
`src/pal/include/edl/` for PAL. So now to define a new custom C type, just
edit the two versions of `occlum_edl_types.h` to define the type.
2020-01-23 06:58:46 +00:00
Tate, Hongliang Tian
986d1d2e44 Fix ioctl SGX_IOC_GET_EPID_GROUP_ID for EBUSY error
SGX SDK's sgx_init_quote may return SGX_ERROR_BUSY, which is previously not
handled. The implementation of ioctl for /dev/sgx is now fixed to handle this
error.
2020-01-23 04:40:54 +00:00
Tate, Hongliang Tian
c6bcbaf442 Fix some typos 2020-01-23 04:40:54 +00:00
Tate, Hongliang Tian
671da280d8 Add support for compiling C code as well as Rust in release mode
We can now build all source code (.S, .c, and .rs) under `src/` in release
mode with `OCCLUM_RELEASE_BUILD=1 make` command.
2020-01-23 04:40:54 +00:00
LI Qing
d825351f02 Fix potential overflow or underflow of offset in INodeFile's seek 2020-01-23 04:40:54 +00:00
He Sun
295d52fbe8 Add pipe support for fcntl's F_GETFL and F_SETFL commands 2020-01-23 04:40:54 +00:00
LI Qing
488ec48fe7 Upgrade Rust SGX SDK and its deps to the latest
1. Upgrade Rust SGX SDK to v1.1.0
2. Upgrade Intel SGX SDK to v2.7.1
3. Upgrade Rust to nightly-2019-11-25
2020-01-23 04:40:54 +00:00
LI Qing
040fe89661 Fix the inet socket file to support fcntl()'s F_GETFL and F_SETFL 2020-01-23 04:40:54 +00:00
Tate, Hongliang Tian
a84803e951 Refactor Occlum PAL as a shared library
By providing Occlum PAL as a shared library, it is now possible to embed and
use Occlum in an user-controled process (instead of an Occlum-controlled one).

The APIs of Occlum PAL can be found in `src/pal/include/occlum_pal_api.h`. The
Occlum PAL library, namely `libocclum-pal.so`, can be found in `.occlum/build/lib`.
To use the library, check out the source code of `occlum-run` (under
`src/run`), which can be seen as a sample code for using the Occlum PAL
library.
2020-01-23 04:40:54 +00:00
LI Qing
61cf75e68b Add readlink from /proc/self/fd/<fd> to get file paths
* Fix readlink from `/proc/self/exe` to get absolute path of the executable file
* Add readlink from`/proc/self/fd/<fd>` to get the file's real path

Note that for now we only support read links _statically_, meaning that even
if the file or any of its ancestors is moved after the file is opened, the
absolute paths obtained from the API does not change.
2020-01-23 04:40:54 +00:00
LI Qing
daed89007a Add fcntl's subcommands: F_GETFL and F_SETFL
* Modify fcntl system call to support F_GETFL and F_SETFL
* Separate OpenFlags to CreationsFlags, AccessMode and StatusFlags
2020-01-23 04:40:54 +00:00
LI Qing
b610e5b8b8 Fix getdents when the next dir entry cannot fit into the output buffer
The output buffer given to getdents may not be large enough for the next directory
entry. If no directory entries has been loaded into the buffer, just return
EINVAL. Otherwise, return the total length of the directory entries already
loaded in the buffer
2020-01-23 04:40:54 +00:00
Tate, Hongliang Tian
fe926ed8b3 Update version to 0.8.0 2019-12-13 12:36:01 +00:00
He Sun
0cef5b1b53 Add sendmsg/recvmsg syscalls
1. Add a separate net/ directory for the network subsystem;
2. Move some existing socket code to net/;
3. Implement sendmsg/recvmsg with OCalls;
4. Extend client/server test cases.
2019-12-13 12:00:55 +00: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
He Sun
b91566d486 Fix atomic counting in socketpair's bind_until_success 2019-12-07 10:35:27 +00:00
Tate, Hongliang Tian
3c1378b7eb Add ioctls on /dev/sgx for SGX remote attestation
1. Add ioctl command `SGXIOC_GET_EPID_GROUP_ID` for /dev/sgx
2. Add ioctl command `SGXIOC_GEN_QUOTE` for /dev/sgx
3. Add test cases
2019-12-07 10:21:01 +00:00
Tate, Hongliang Tian
814ea21997 Update README for version 0.7.0 2019-11-30 13:41:42 +00:00
LI Qing
ab89421f96 Add sched_yield syscall 2019-11-29 12:03:15 +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
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
Shuang Liu
d61edad08f Randomize the file names of SEFS inodes on the host FS 2019-09-06 15:08:13 +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
347791f235 Add install target for Makefile 2019-08-31 06:01:16 +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
Wang Runji
c656776eb1 Fix MountFS sync 2019-08-02 08:34:40 +00:00
Tate, Hongliang Tian
a2169e63e8 Upgrade Dockerfile for dynamic-linking support 2019-08-01 12:23:37 +00:00
Tate, Hongliang Tian
e11c30c5c5 Run dynamically-linked hello world 2019-07-20 03:34:00 +00:00
Tate, Hongliang Tian
33739cc00b Program loader loads ld.so now 2019-07-20 03:34:00 +00:00
Tate, Hongliang Tian
a579f84e90 Enable new system call mechanism via Auxiliary Vector
The old system call mechanism works by relocating the symbol __occlum_syscall
provided by libocclum_stub.so to the real entry point of the LibOS. This symbol
relocation is done by the program loader. Now, the new system call mechanism is
based on passing the entry point via the auxiliary vector. This new mechanism
is simpler and is more compatible with the upcoming support for ld.so.

Changes:
1. Fix a bug in serializing auxiliary vector in the stack of a user program;
2. Passing syscall entry via auxiliary vector;
3. Remove relocating for the __occlum_syscall symbol;
4. Remove the dependency on libocclum_stub.so in tests.
2019-07-20 03:34:00 +00:00
geding.lq
9c226c9a9f Fix a bug in cpuid, which mistakenly use %rax where %eax is actually needed 2019-07-20 03:23:50 +00:00
Tate, Hongliang Tian
8686322afb Add /dev/zero, /dev/random, /dev/urandom, and /dev/arandom 2019-07-19 12:30:15 +00:00
Tate, Hongliang Tian
8cda63ab3a Use SEFS at /, HostFS at /host, and RamFS at /tmp 2019-07-19 10:25:33 +00:00
Wang Runji
7f229cef50 add simple HostFS, mount it at /host 2019-07-19 03:51:38 +00:00
Wang Runji
29278db8f4 support multiple fs
- use RamFS as rootfs, mount SEFS at /test
- for testing convenience, set default cwd to /test
- fix spawn path and change_cwd
2019-07-19 03:49:18 +00:00
Tate, Hongliang Tian
e1e46c9935 Add clock_gettimeofday 2019-07-18 10:51:12 +00:00
Tate, Hongliang Tian
c096e7d0b9 Inform Intel SGX SDK about Occlum-defined stacks
There are two types of stacks: the kernel ones and the user ones. The kernel
stacks are used by Occlum and managed by Intel SGX SDK itself, while the user
stacks are used by the threads created and managed by Occlum. These user stacks
are transparent to Intel SGX SDK so far.

The problem is that Intel SGX SDK needs to be aware of the user stacks.
SGX exception handlers will check whether the rsp value---when the exception
happened---is within the stack of the current SGX thread. If the check fails,
the registered exception handler will not be triggered. But when exceptions are
triggered by the threads running upon Occlum, the rsp value points to the user
stacks, which Intel SGX SDK are completely unware of. So the check always
fails.

Therefore, we extend Intel SGX SDK with two new APIs:

  int sgx_enable_user_stack(size_t stack_base, size_t stack_limit);
  void sgx_disable_user_stack(void);

And this commit uses the two APIs to inform Intel SGX SDK about the
Occlum-managed stacks. And the rsp checks in SGX exception handlers will
check whether rsp is within the user stacks.
2019-07-18 07:16:17 +00:00
散樗
2553298b1d Handle cpuid and rdtsc instruction
Init support for cpuid and rdtsc instruction handling in occlum.

This patch includes:
1. cpuid exception handler for all information leaves;
2. rdtsc exception handler;
3. handler registration;
4. cpuid test;
5. rdtsc test.

Signed-off-by: 散樗 <kailun.qkl@antfin.com>
2019-07-18 13:51:50 +08:00
Tate, Hongliang Tian
56c69b5f3c Refactor mmap implementation
1. Add a full test suite for mmap
2. Implement file-backed memory mapping
3. Implement fixed, anonymous memory mapping
4. Implement hinted, anonymous memory mapping
5. Implement munmap that covers partial/multiple memory mappings
2019-07-01 11:56:04 +08:00
Tate, Hongliang Tian
3465477cc1 Fix two bugs that prevents compilation and tests working 2019-04-29 00:01:17 +08:00
WangRunji
413586f729 add integrity_only_opt and sgx_file_cache feature 2019-04-26 22:48:00 +08:00
WangRunji
6e871f7948 reformat code using cargo fmt 2019-04-26 21:26:30 +08:00
WangRunji
dd3de96b8e hack unix socket for php 2019-04-24 19:25:09 +08:00
WangRunji
9797a64f06 enable unix socket and add test for it 2019-04-24 13:28:35 +08:00
WangRunji
9106bd46f2 fix for php. include incomplete code for UnixSocket 2019-04-23 22:00:38 +08:00
WangRunji
f846ba11f2 fix wait4 not removing child 2019-04-23 14:00:44 +08:00
WangRunji
0437e81f36 fix impl File for Stdin/Stdout 2019-04-23 12:58:28 +08:00
WangRunji
26189dddaa implement fcntl & ioctl for socket. fix lighttpd performance 2019-04-23 01:43:41 +08:00
WangRunji
1326924dbb fix errno = 0 and introduce macro 'try_libc' 2019-04-23 00:49:37 +08:00
WangRunji
141094e95e fix return value from libc::ocall 2019-04-22 21:55:57 +08:00
WangRunji
76f9ff380b add timing for syscall 2019-04-22 17:42:20 +08:00
WangRunji
9c9d1eed3a implement /dev/null 2019-04-22 16:32:40 +08:00
WangRunji
54243c543a use errno! macro for all error 2019-04-22 15:54:39 +08:00
WangRunji
b99344d7f5 implement sys_sendfile 2019-04-22 15:37:19 +08:00
WangRunji
f4dacdc01d add cache for SgxFile 2019-04-21 18:04:48 +08:00
WangRunji
ad98a1698e add timing
by shenyouren
2019-04-21 17:28:06 +08:00
WangRunji
5d9b8e4fa3 implement missing IO function for SocketFile 2019-04-21 17:26:17 +08:00
WangRunji
58ff7b88b5 fix SgxFile seek after the end 2019-04-14 20:31:19 +08:00
WangRunji
4811044c14 fix SgxFile read/write empty buffer 2019-04-13 21:03:10 +08:00
WangRunji
d19676032d implement add_open in posix_spawn 2019-04-13 12:05:50 +08:00
WangRunji
58a7f7c126 simplify epoll_ctl 2019-04-12 18:02:40 +08:00
WangRunji
82f4169618 enlarge preallocated space. sync file system on exit. 2019-04-12 16:54:49 +08:00
WangRunji
b2d75f386c support readlink "/proc/self/exe". impl dummy fcntl.getfl 2019-04-12 15:17:27 +08:00
WangRunji
a8060f0b24 add simple epoll test. fix epoll_wait, accept4 2019-04-12 15:14:11 +08:00
WangRunji
80a73eaa0d fix close_on_spawn and file_actions 2019-04-12 14:27:48 +08:00
WangRunji
6d432b0a03 fix deadlock when log getting pid 2019-04-12 13:42:19 +08:00
WangRunji
b5697ab611 Merge remote-tracking branch 'official/master' into net
# Conflicts:
#	src/libos/src/fs/mod.rs
#	src/libos/src/syscall/mod.rs
#	test/Makefile
2019-04-11 19:13:29 +08:00
WangRunji
bd9a3dd578 fix epoll_ctl deadlock 2019-04-11 19:10:12 +08:00
Tate, Hongliang Tian
2957fa99d5 Make sure VMRange fills its memory with zeros if necessary 2019-04-11 18:19:49 +08:00
Tate, Hongliang Tian
862601604c Refactor VMRange code and fix two bugs
The first bug is that a VMRange may not be allocated to a 4KB-aligned address.
The second bug is that a VMRange may not be deallocated by its parent VMRange.
2019-04-11 18:19:49 +08:00
Tate, Hongliang Tian
895f70a2dc Refactor VMRange allocation for readability 2019-04-11 09:13:53 +08:00
Tate, Hongliang Tian
356884679b Add readlink 2019-04-11 09:13:53 +08:00
Tate, Hongliang Tian
44ef19726f Add fcntl 2019-04-11 09:13:53 +08:00
WangRunji
f9121a025e implement epoll 2019-04-10 14:07:50 +08:00
Tate, Hongliang Tian
785d3237b9 Add getuid, getgid, geteuid, getegid, etc. 2019-04-10 09:03:41 +08:00
Tate, Hongliang Tian
e335e8df1d Add sigaction and sigprocmask (but not implemented) 2019-04-10 09:03:41 +08:00
Tate, Hongliang Tian
d7e266d0e3 Add access and faccessat 2019-04-10 09:03:41 +08:00
Tate, Hongliang Tian
b003f4ce43 Add prlimit64, getrlimit, and setrlimit 2019-04-10 09:03:41 +08:00
Tate, Hongliang Tian
8846c62b5e Add uname 2019-04-10 09:03:41 +08:00
WangRunji
7bd2ce50f2 implement select and poll without test 2019-04-09 00:04:44 +08:00
WangRunji
f62809096e use libc::off_t 2019-04-08 16:22:52 +08:00
WangRunji
5b90d90643 implement SocketFile. pass socket test 2019-04-07 11:47:54 +08:00
WangRunji
e5bc58d3f0 simplify log color 2019-04-07 11:28:05 +08:00
WangRunji
f711d20475 add socket syscalls, directly forward to libc 2019-04-07 11:28:05 +08:00
Tate, Hongliang Tian
660d0931cd Add Pthread test 2019-04-06 22:55:16 +08:00
Tate, Hongliang Tian
13e4a898dd Add gettid 2019-04-06 22:55:16 +08:00
Tate, Hongliang Tian
2f2b74a570 Add set_tid_address 2019-04-06 22:55:16 +08:00
Tate, Hongliang Tian
8dfeb71c90 Pass arg5 for system calls 2019-04-06 22:55:16 +08:00
Tate, Hongliang Tian
db40e8f52b Enable Thread Local Storage (TLS)
Add arch_prctl and pass necessary ELF info to libc via aux vector
2019-04-06 22:55:16 +08:00
Tate, Hongliang Tian
b2e626760b Add futex 2019-04-03 13:41:55 +08:00
Tate, Hongliang Tian
4cf8777592 Add clone system call 2019-04-03 13:41:55 +08:00
WangRunji
6c61ab5f56 optimize imports and run cargo fmt 2019-03-29 14:20:25 +08:00
WangRunji
4e8801850d update SEFS crate, move sgx_impl to libos 2019-03-29 14:20:25 +08:00
WangRunji
d5e8d43e7b fix and add test for readv, writev, lseek 2019-03-29 14:20:25 +08:00
WangRunji
e095e8a4f0 fix split_path. add test for getcwd, mkdir, rmdir, chdir. 2019-03-29 14:20:25 +08:00
WangRunji
002d1f1dd2 add sys_rmdir. fix sys_sync, sys_unlink. 2019-03-29 14:20:25 +08:00
WangRunji
694fb32a35 add sys_chdir, sys_rename, sys_mkdir, sys_(un)link 2019-03-29 14:20:25 +08:00
WangRunji
fc145097b2 add sys_pread, sys_pwrite 2019-03-29 14:20:25 +08:00
WangRunji
c1c61c4e21 find out the STUPID bug. recover syscall consts. 2019-03-29 14:20:25 +08:00
WangRunji
6e9f00b5db fix process cwd. fix open path 2019-03-29 14:20:25 +08:00
WangRunji
0ec4ba9305 load program bin from SEFS 2019-03-29 14:20:25 +08:00
WangRunji
6ac31aedd7 fix WEIRD STUPID RUST bug: replace consts by literals 2019-03-29 14:20:25 +08:00
WangRunji
168c2ddf0a add logger 2019-03-29 14:20:25 +08:00
WangRunji
7c855d7f5f implement a lot fs syscalls without test 2019-03-29 14:20:25 +08:00
WangRunji
3b38c3b75a refactor syscall: move dispatch_syscall to Rust 2019-03-29 14:20:25 +08:00
WangRunji
0cf714f54e add sys_getcwd 2019-03-29 14:20:25 +08:00
WangRunji
a3c49c2a3e use crate bitflags 2019-03-29 14:20:25 +08:00
WangRunji
557eb7dc60 fix sys_open. import crate log. 2019-03-29 14:20:25 +08:00
WangRunji
d56378d96a fix TimeProvider. enable INodeFile 2019-03-29 14:20:25 +08:00
WangRunji
0105756897 add fs submodule. import fs crate to libos 2019-03-29 14:20:25 +08:00
Tate, Hongliang Tian
7fcf195359 Upgrade Rust SGX SDK to v1.0.6
... and Intel SGX SDK to v2.4, Rust to nightly-2019-01-28
2019-02-23 16:31:01 +08:00
Tate, Hongliang Tian
602fef10f8 Reformat Rust code using cargo fmt 2019-02-17 22:41:51 +08:00
Tate, Hongliang Tian
78e94fe29b Add sync syscall 2019-02-16 16:24:08 +08:00
Tate, Hongliang Tian
a1ea05dc41 Add a few comments to vm subsystem 2019-02-16 16:24:08 +08:00
Tate, Hongliang Tian
22edefc349 Add pipe throughput benchmark 2019-02-16 16:24:08 +08:00
Tate, Hongliang Tian
d1731162eb Add perf test for spawn+wait4 2019-02-16 16:24:08 +08:00
Tate, Hongliang Tian
71d119181e Support argc and argv for child process after spawn 2019-02-16 16:24:08 +08:00
Tate, Hongliang Tian
ad704c421f Add argc and argv support 2019-02-16 16:24:08 +08:00
Tate, Hongliang Tian
d3009db10b Add gettimeofday 2019-02-16 16:24:08 +08:00
Tate, Hongliang Tian
cdf3a2c3e0 Small fix to malloc test 2019-02-16 16:24:08 +08:00
Tate, Hongliang Tian
a712bfe70a Add pipe test 2019-02-16 16:24:08 +08:00
Tate, Hongliang Tian
a2b62891cc Add file I/O test 2019-02-16 16:24:08 +08:00
Tate, Hongliang Tian
2b4c8255c6 Improve the build system 2019-02-16 16:24:08 +08:00
Tate, Hongliang Tian
77a18bbc4d Add dup, dup2, and dup3 2019-02-16 16:23:30 +08:00
Tate, Hongliang Tian
d40af94aaf Support O_CLOEXEC on open() or pipe2() 2019-02-16 16:23:30 +08:00
Tate, Hongliang Tian
c00fddd2bf Add pipe syscall 2019-02-16 16:23:30 +08:00
Tate, Hongliang Tian
37f724c656 Release Process resources via Weak reference 2019-02-16 16:23:30 +08:00
Tate, Hongliang Tian
c31f5334d7 Small fix to Waiter and WaitQueue 2019-02-16 16:23:30 +08:00
Tate, Hongliang Tian
5b7048976e Add spawn and wait4 test 2019-02-16 16:23:30 +08:00
Tate, Hongliang Tian
d960792ef3 Add Waiter and WaitQueue 2019-02-16 16:23:30 +08:00
Tate, Hongliang Tian
372649f3d6 Add getpid and getppid 2019-02-16 16:23:30 +08:00
Tate, Hongliang Tian
b717842113 Switch user/kernel fsbase 2019-02-16 16:23:30 +08:00
Tate, Hongliang Tian
05e5efdb57 Handle exit status correctly 2019-02-16 16:23:30 +08:00
Tate, Hongliang Tian
e5d3ab3cf9 Enable MPX 2019-02-16 16:23:30 +08:00
Tate, Hongliang Tian
8601c5da35 Refactor syscall- and fs-related code into modules 2019-02-16 16:23:30 +08:00
Tate, Hongliang Tian
0cda8dffe7 Works on SGX 1.0 2019-02-16 16:23:30 +08:00
Tate, Hongliang Tian
e9064e3914 Upgrade Rust SGX SDK to v1.0.4 2019-02-16 16:23:30 +08:00
Tate, Hongliang Tian
ea00690e68 Add mmap, munmap, mremap and brk syscalls 2019-02-16 16:23:30 +08:00
Tate, Hongliang Tian
852903de20 Add virtual memory subsystem 2019-02-16 16:23:30 +08:00
Tate, Hongliang Tian
4107a65248 Enable libc's printf 2019-02-16 16:23:30 +08:00
Tate, Hongliang Tian
10e3da87cc Add lseek 2019-02-16 16:23:30 +08:00
Tate, Hongliang Tian
f2ebc5c330 Add readv and writev 2019-02-16 16:23:30 +08:00
Tate, Hongliang Tian
4c3f556c7d Do relocation for .rela.dyn section 2019-02-16 16:23:30 +08:00
Tate, Hongliang Tian
cf77c3a9a8 Init program stack to pass argc, argv, etc. 2019-02-16 16:23:30 +08:00
Tate, Hongliang Tian
f0e7bae0d7 Works with a minimal version of Occlum's libc 2019-02-16 16:23:30 +08:00
Tate, Hongliang Tian
a4f37f8917 Use new name Occlum in code 2019-02-16 16:23:30 +08:00
Tate, Hongliang Tian
a66c55f95f Add open, read, write and close 2019-02-16 16:23:30 +08:00
Tate, Hongliang Tian
757d3f2f4d Use my forked xmas-elf as a submodule 2019-02-16 16:23:30 +08:00
Tate, Hongliang Tian
68d459975d Minimize the # of memory pages whose permissions are modified 2019-02-16 16:23:30 +08:00
Tate, Hongliang Tian
b041dee55c Release resources when processes destroyed 2019-02-16 16:23:30 +08:00