Commit Graph

684 Commits

Author SHA1 Message Date
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