Commit Graph

684 Commits

Author SHA1 Message Date
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
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
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
zongmin.gu
4e02db367e Update occlum exec to support kill 2020-06-05 14:52:10 +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
LI Qing
f54abc78a2 Support to execute a symlink file 2020-06-04 20:46:50 +08:00
Tate, Hongliang Tian
655869711a Support page fault 2020-06-04 20:36:29 +08:00
Tate, Hongliang Tian
8c113eb8a2 Fix a minor format issue 2020-06-04 11:47:48 +00:00
Tianjia Zhang
aed88145f2 pal: Fix crash caused by getpwuid() returning NULL
On lightweight Linux distribution, like alpine, getpwuid()
returns NULL, and errno is ENOENT, this patch fix crash
caused by this situation.

Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
2020-06-04 19:36:15 +08:00
Tianjia Zhang
e8c48161b5 pal: Fix typo error in saving token file
The address of the `token` should be used by fwrite().

Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
2020-06-04 19:33:57 +08:00
He Sun
eb4bb860ce Add the unix socket support for sendto system call 2020-06-03 17:57:38 +08:00
He Sun
987e06a458 Move networking system call interfaces to net module 2020-06-03 17:57:38 +08:00
Hui, Chunyang
ed664d1143 Fix sched set/get affinity wrong behaviour
1. Fix child process not inherit affinity from parent process
2. Add warning for buffer length gap with kernel when getaffinity
2020-06-02 17:36:36 +08:00
Hui, Chunyang
73b4f8b08c Add support for PAL API v2 2020-05-29 05:26:38 +00:00
LI Qing
e6996f3c45 Add mremap system call 2020-05-29 03:38:49 +00:00
Hui, Chunyang
5b695c9539 Format c/c++ files in src, tools and test 2020-05-27 07:09:18 +00:00
Hui, Chunyang
03ba13aec7 Add "make format" and "make format-check" to check format for c/c++ files 2020-05-27 07:08:59 +00:00
He Sun
cd2f13ae54 Refactor select syscall
1. Substitute the underlying poll OCall to select OCall to update the
timeout argument correctly.
2. Add more checks for the inputs.
2020-05-26 11:44:46 +08:00
Hui, Chunyang
c14ee62678 Add untrusted environment variable override
Add "untrusted" sections for environment variables defined in Occlum.json. Environment
variable defined in "default" will be shown in libos directly. Environment variable
defined in "untrusted" can be passed from occlum run or PAL layer and can override
the value in "default" and thus is considered "untrusted".
2020-05-25 03:14:54 +00:00
Hui, Chunyang
dadffb9f17 Fix sendfile syscall write buffer length 2020-05-21 17:20:12 +08:00
Hui, Chunyang
c6e0e06768 Clean up the build files generated in src/exec 2020-05-21 08:54:42 +00:00
Zongmin
17b4912055 Send SIGCHLD to parent process 2020-05-18 20:24:14 +08:00
Tate, Hongliang Tian
e1789dc89f Bump version to 0.12.0
Also, update the docs accordingly.
2020-05-15 11:32:44 +00:00
He Sun
9252a1a993 Fix two bugs of ioctl
1. Add length of the argument to the ioctl ocall to guard sgx sdk to do
the copy.
2. Handle non-zero return value of ioctl.
2020-05-15 12:50:31 +08:00
Zongmin
0c3466f4ad Add three new occlum commands: start, exec and stop
Usage:
//start the occlum server
occlum start

//execute the command inside occlum
occlum exec [cmd] [-- <args>]

//stop the occlum server
occlum stop
2020-05-15 03:02:42 +00:00
LI Qing
2d34ee349e Add the sigaltstack system call 2020-05-15 03:02:42 +00:00
Hui, Chunyang
0bb1cbfbb5 Add PAL version api 2020-05-15 03:02:42 +00:00
He Sun
f9486bf7a9 Add resource limit check for the number of the fds in poll 2020-05-15 03:02:42 +00:00
zongmin.gu
eca27408be Support user manage stack
Go/Java/JIT code manage their own stack
So we need to help them to handle exception
2020-05-15 03:02:42 +00:00
Zongmin
a6d97d5b4f Update the sdk version to 2.9.1
Fix std::alloc::Alloc not found
The lastest Rust changes the trait to std::alloc::AllocRef.

Update the docker files to support sgx 2.9.1

Remove the compilerRT dependency for rust sdk update
2020-05-15 03:02:42 +00:00
Tate, Hongliang Tian
1d1330772c Add new API occlum_pal_kill
This API enables sending signals to one or multiple LibOS processes from
outside the enclave.
2020-05-15 03:02:42 +00:00
Tate, Hongliang Tian
6e140a0d38 Add errno info for ECalls
Before this commit, the three ECalls of the LibOS enclave do not give
the exact reason on error. In this commit, we modify the enclave entry code
to return the errno and list all possible values of errno in Enclave.edl.
2020-05-15 02:59:16 +00:00
He Sun
1c707eda30 Add support for monitoring epoll fds with epoll 2020-05-15 02:59:16 +00:00
Hui, Chunyang
25350b0e85 Fix sched agent failure for offline core 2020-05-15 02:59:16 +00:00
He Sun
7a87d77509 Fix error when PF_UNIX is passed as protocol to create unix socket
Zero and PF_UNIX are both supported as protocol when creating unix
socket.
2020-05-15 02:59:16 +00:00
Tate, Hongliang Tian
e166382923 Add the signal subsystem
In this commit, we add eight signal-related syscalls
* kill
* tkill
* tgkill
* rt_sigaction
* rt_sigreturn
* rt_sigprocmask
* rt_sigpending
* exit_group

We implement the following major features for signals:
* Generate, mask, and deliver signals
* Support user-defined signal handlers
    * Support nested invocation of signal handlers
    * Support passing arguments: signum, sigaction, and ucontext
* Support both process-directed and thread-directed signals
* Capture hardware exceptions and convert them to signals
* Deliver fatal signals (like SIGKILL) to kill processes gracefully

But we still have gaps, including but not limited to the points below:
* Convert #PF (page fault) and #GP (general protection) exceptions to signals
* Force delivery of signals via interrupt
* Support simulation mode
2020-05-15 02:59:16 +00:00
LI Qing
1172c25677 Modify occlum_entry to be compatible with Linux syscall ABI 2020-05-15 02:59:16 +00:00
Hui, Chunyang
72f2a33e2a Add log level alignment with OCI 2020-05-15 02:59:16 +00:00
He Sun
71475c3e96 Fix wrong assert in recvmsg for MSG_TRUNC flag 2020-05-15 02:59:16 +00:00
He Sun
bbb52f6990 Refine check for pointers from user space and outside enclave
Implement the check functions that are empty before and do some
adjustment where they are called.
2020-05-15 02:59:16 +00:00
LI Qing
1dcabb09cd Fix the access and faccessat system calls 2020-05-15 02:59:16 +00:00
LI Qing
6d27595195 Fix the negative offset check for pread/pwrite 2020-05-15 02:59:16 +00:00
He Sun
48d7f8df3e Fix the invalid epoll_event pointer introduced by compilation optimization
That pointer does not point to the libc::epoll_event after release
build. Explicitly declaring the libc::epoll_event avoids the
invalidation.
2020-05-15 02:59:16 +00:00
Hui, Chunyang
6a17e6292c Add support for user specified instance dir name
The default instance dir of Occlum is ".occlum". User now can specify the name
by declaring environment variable "OCCLUM_INSTANCE_DIR"
2020-05-15 02:59:16 +00:00
LI Qing
03bb09abdf Add the emulation of SYSCALL instruction
1. Refactor the exception handling process
2. Support to emulate the SYSCALL instruction in the exception handler
2020-05-15 02:59:16 +00:00
Hui, Chunyang
79fd6570f5 Change log level to warning for ioctl TIOCGWINSZ 2020-05-15 02:59:16 +00:00
He Sun
aa10d96f89 Fix u32::MAX not found error
Using std::u32 instead of u32 passes the compilation.
2020-05-15 02:59:16 +00:00
He Sun
e651be4403 Fix not passing null pointers to ocalls for empty slices
It gets a non-null fat pointer when an empty slice simply calls as_ptr
or as_mut_ptr.
2020-05-15 02:59:16 +00:00
He Sun
58403f8415 Fix panic when dropping unix socket
When a unix socket only calls function listen, its object is not created
but its status becomes listening. At this time closing the socket would
cause a panic before this commit.
2020-05-15 02:59:16 +00:00
He Sun
9815523a95 Fix panic when there is no enough memory for a new ringbuffer 2020-05-15 02:59:16 +00:00
Hui, Chunyang
53f8ade4de Fix a typo 2020-05-15 02:59:16 +00:00
yuanwu
ed7f83562a Check the MPX status of platform before enabling
Signed-off-by: yuanwu <yuan.wu@intel.com>
2020-04-26 15:02:26 +08:00
Tate, Hongliang Tian
5b4b72a81a Bump the version number to 0.11.0 2020-04-17 17:52:17 +08:00
Tate, Hongliang Tian
ad077d644a Fix the demo for the embedded mode 2020-04-16 08:46:56 +00:00
Tate, Hongliang Tian
df71872f76 Disable Intel MPX by default
The next generation of Intel CPUs does not support Intel MPX. Enabling MPX
by default crashes the LibOS on startup. So we disable MPX by default. The
long term plan is to turn on/off MPX via compiling options.
2020-04-15 21:25:24 +08:00
Tate, Hongliang Tian
2b556f8de9 Refactor the CPU scheduling subsystem
This commits improves both readability and correctness of the scheduling-related
system calls. In terms of readability, it extracts all scheduling-related code
ouf of the process/ directory and put it in a sched/ directory. In terms
of correctness, the new scheduling subsystem introduces CpuSet and SchedAgent
types to maintain and manipulate CPU scheduler settings in a secure and robust way.
2020-04-15 09:43:38 +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
LI Qing
bbc3b8a467 Fix RDTSC emulation's changing app's TLS by mistake
This commit switches from user mode to kernel mode before handling
the exception caused by RDTSC instruction.
2020-04-10 09:53:39 +00:00
He Sun
52cb897436 Fix F_DUPFD crash when there is no space in file table 2020-04-03 12:47:04 +08:00
LI Qing
978edf8a17 Add chmod and chown system calls 2020-04-03 03:39:57 +00:00
LI Qing
e1648fc870 Add the redirection of standard I/O for process 2020-04-02 11:07:24 +00:00
He Sun
221f5b78e8 Rewrite epoll implementation and the test 2020-04-02 17:43:24 +08:00
Tate, Hongliang Tian
a7400ca6dc Fix thread exiting but not being freed 2020-03-31 14:47:31 +00:00
LI Qing
23329efe14 Fix the broken dependency on SEFS
SEFS depends on version 0.9 of bitvec crate, which has been yanked on crates.io
by the crate author for some reasons. To fix this, we upgrade to the latest
version of bitvec crate.
2020-03-30 08:58:57 +00:00
Tate, Hongliang Tian
1eefa0a123 Fix poll when given negative fds 2020-03-27 18:00:49 +08:00
Tate, Hongliang Tian
6dbdbfdcf0 Fix potential deadlocks caused by epoll/poll/select 2020-03-27 05:42:20 +00:00
Tate, Hongliang Tian
1a35188212 Simplify the frequent code of getting a file reference 2020-03-26 10:34:14 +00:00
Tate, Hongliang Tian
5933499f9b Refactor LibOS to conform with logging strategy
This commit introduces a unified logging strategy, summarized as below:

1. Use `error!` to mark errors or unexpected conditions, e.g., a
 `Result::Err` returned from a system call.
2. Use `warn!` to warn about potentially problematic issues, e.g.,
 executing a workaround or fake implementation.
3. Use `info!` to show important events (from users' perspective) in
 normal execution, e.g., creating/exiting a process/thread.
4. Use `debug!` to track major events in normal execution, e.g., the
 high-level arguments of a system call.
5. Use `trace!` to record the most detailed info, e.g., when a system
 call enters and exits the LibOS.
2020-03-25 02:53:31 +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
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
Tate, Hongliang Tian
4fbfe7bf0c Add syscall getpid and wait4 (this latter one is fake) 2019-02-16 16:23:30 +08:00
Tate, Hongliang Tian
637e15f6c6 Add syscall spawn 2019-02-16 16:23:30 +08:00
Tate, Hongliang Tian
7671dbf470 Load and run a Hello World program 2019-02-16 16:23:30 +08:00
Tate, Hongliang Tian
c1ddfac700 Remove unnecessary copyright header 2019-02-16 16:16:50 +08:00
Tate, Hongliang Tian
264ac7f993 Add write syscall and prints Hello World 2018-07-01 15:57:41 +08:00