Commit Graph

844 Commits

Author SHA1 Message Date
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
He Sun
aed572064b Fix potential address-in-use errors in epoll_server test
Wait for all the children to exit before server exits to release all the
resource used by the test.
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
614ec88242 Remove tabs in the source files of test cases 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
490e45a52e Fix git submodule update failure in some environments
Submodules of Occlum may have a very big size and under some environments git submodule
update can always fail. Now OCCLUM_GIT_OPTIONS can read from environment. And user can
specify the depth of the submodule like this: OCCLUM_GIT_OPTIONS="--depth 1" make submodule,
which can make it more possible to succeed.
2020-05-15 02:59:16 +00:00
Hui, Chunyang
5bd5e1bc68 Fix cpuid failed for unprivileged user
Add "-1" to display information only for the current CPU.
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
f9df83f559 Fix the demo's compiling failure in some cases
Some demos based on CMake may search installed packages out of
Occlum toolchain's directory, this could cause some building
errors sometimes. By setting the $PKG_CONFIG_LIBDIR, we can make
CMake searching for packages in Occlum toolchain's directory only.
2020-04-15 14:14:00 +08:00
Hui, Chunyang
3034cb992b Fix cpuid test for non-SGX platforms 2020-04-14 09:43:11 +00:00
Hui, Chunyang
7372d0277c Fix tty ioctl test for non-tty stdout 2020-04-14 06:32:21 +00:00
Hui, Chunyang
0ffc127bff Add travis CI for Occlum 2020-04-13 05:45:02 +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
60b1e2c28d Make the command line tool more robust
The CLI tool is robust in the sense that it can handle the execution of
init/build/run/gdb commands in any order (as long as the commands are invoked
sequentially, not concurrently).
2020-04-02 10:51:03 +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