Commit Graph
78 Commits
Author SHA1 Message Date
Li Lei 30e0b8bfba [PAL/Linux-SGX] Reuse TLS/TCS pages for newly created threads after previous threads exit 2019-08-16 18:17:24 -07:00
Isaku Yamahata 0cb0db9e35 [LibOS] regression: Run bootstrap_static and bootstrap_pie
Add bootstrap_static for SGX and bootstrap_pie tests to test_libos.py as
they now work correctly (after adding VDSO support).
2019-08-15 14:31:03 +02:00
Isaku Yamahata e8cbd4a50a [LibOS] test/regression: Clean up Makefile to use Makefile.rules 2019-08-15 14:31:03 +02:00
Isaku Yamahata 0031ef90c8 [LibOS] Make regression/getsockopt return 0 on success
Previously, `rv` was uninitialized in case of success.
2019-08-02 22:49:53 +02:00
borysp 56f93d3a9f [Pal/Linux-SGX] Fix allowed_files subdirectory check
If the path of allowed directory in a manifest file ended with a '/'
e.g. "sgx.allowed_files.tmp_dir = file:tmp/" anything inside it was
disallowed due to a buggy subdirectory check
2019-08-02 22:05:12 +02:00
borysp dbbaec749e [LibOS/tests] Enable large directory read regression test 2019-08-02 22:05:12 +02:00
Michał Kowalczyk 5ec5e2f24c Delete all reference monitor residues 2019-07-31 02:30:47 +02:00
Wojtek Porczyk 01f3553a25 [LibOS, Pal] Reorganize unit tests
- Deduplicate much of setup code.
- Allow running non-sandbox and sandbox code in single run.
- Use pytest.
- Generate JUnit-XML file for Jenkins.
- Document running a subset of regression tests.
2019-07-29 19:38:14 +02:00
borysp 48156fc17f [LibOS] Add regression test for reading large directory 2019-07-24 12:36:14 -07:00
Dmitrii Kuvaiskii ea234412c9 [LibOS] Emulate vfork() via fork()
Previous implementation of vfork() was both buggy (worked only in simple
cases) and not compatible with the new IPC implementation. We take a
shortcut for now and emulate vfork() via fork(); this is allowed by
POSIX. This commit also adds LibOS regression test for vfork().
2019-07-19 01:03:41 -07:00
Dmitrii Kuvaiskii b0619cb7a6 [LibOS] Rework of IPC subsystem's creation of processes
Previously, Graphene incorrectly treated execve() under SGX PAL:
Graphene would emulate execve() as fork + execve, and the new forked
process didn't try to "assume" the identity of its parent (which
violated execve specification "all process attributes are preserved").

This commit reworks the implementations of clone/fork and execve. In
particular, the IPC subsystem clearly distinguishes between the two
cases: clone/fork works as before whereas execve forks new "real"
process (which starts executing the requested program) and silently
exits the now-useless "temporary" process. New "real" process assumes
the identity of "temporary" process by inheriting its VMID (ID of
process for IPC purposes) and IPC-info objects with their PAL handles.

This commit also cleans up initialization of four IPC-info objects: self
(creates process-unique server pipe for IPC), parent (holds pipe for IPC
with parent process), and two namespace leaders (hold pipes for IPC with
leader processes). To correctly identify new-process server pipe, the
implementation of create_pipe() now allows to create VMID-based pipe URI.
2019-07-19 01:03:41 -07:00
Dmitrii Kuvaiskii 601f17724a [Jenkins-SGX] Increase timeout on LibOS tests to 15 minutes
Also increases timeout on LibOS's "udp" test to 50 seconds. It seems to
timeout frequently otherwise.
2019-07-19 01:03:41 -07:00
Chia-Che Tsai a0803a22b4 [LibOS] Add a regression test for fstat() on a directory 2019-07-16 22:22:25 +02:00
Dmitrii Kuvaiskii dab4c96853 [LibOS] Add special handling in open() syscall (EISDIR, O_TRUNC)
- Add error case: fail with EISDIR if directory is open()'ed with
  writable access.
- Add additional checks: O_TRUNC must work only on regular writable
  files (otherwise do not truncate).

The commit also improves LibOS regression test on FS corner cases and
fixes a tiny bug in DkStreamSetLength() with assert hanging Graphene.
2019-07-03 16:08:25 -07:00
Dmitrii Kuvaiskii 7327aa62ab [LibOS] Fix bug of long relative paths (more than 256B)
Previously, Graphene had a bug when dentry's rel_path was not initialized
to actual relative path if parent + filename length was longer than
256B. The problem was that rel_path was a shim_qstr which could contain
maximum 256 chars. This commit increases the limit to 4096B and adds
checks to fail explicitly if rel_path is still too large. Also, it adds
LibOS regression test.

Note that relative paths greater than 256 chars in length are not
uncommon. Most OSes impose the limit of 4096 chars or no limit at all.
2019-07-03 16:08:25 -07:00
Chia-Che Tsai 728d16aca6 [LibOS] Fix C++ tests support
This commit:
* Fixes compilation and execution errors for C++ programs in LibOS/shim/test/native.
* Adds a C++ regression test.
2019-07-01 14:42:32 +02:00
Dmitrii Kuvaiskii 84ec50a2aa [LibOS/regression] Add OpenMP simple for-loop test
Previously, OpenMP apps failed to run under Graphene-SGX because it did
not support raw system calls (used inside of OpenMP lib, in particular
the futex() syscall). Since recently, Graphene-SGX has support for raw
syscall execution. This commit adds a test showing that OpenMP works.
2019-06-30 23:37:21 +02:00
Isaku Yamahata bdb8b9c36b [LibOS/regression] Add test for syscall instruction redirection
Add LibOS regression test which contains a raw syscall instruction to test
SIGILL handler hook logic (if SIGILL'ed instruction is a syscall, it is
redirected inside LibOS as if syscalldb() was called).
2019-06-18 16:41:41 -07:00
Isaku Yamahata 8c058edfdf [LibOS] Remove warnings in building exec_invalid_args.c 2019-06-14 12:10:41 -07:00
Dmitrii Kuvaiskii b871a962dd [LibOS] Take into account adjacent VMAs on correct-memory check
Previously the check on correct memory region under Linux-SGX
(called is_in_one_vma()) only checked that the whole memory region fits
into one VMA. In some cases (e.g. DATA and BSS sections), memory regions
can span several adjacent VMAs. This commit refines the check and
renames it to is_in_adjacent_vmas(). It also adds a LibOS test.
2019-06-13 12:06:25 -07:00
Chia-Che Tsai be9852784f [All components] Remove all modelines from all source files 2019-06-07 15:30:43 -05:00
Dmitrii Kuvaiskii 3bd067a13b [LibOS/regression] Add test for Unix domain sockets
This commit moves and modifies unix.c test from native/
to regression tests. This tests Unix domain sockets.
2019-05-29 16:11:27 -07:00
Isaku Yamahata c4bcf4ae8c [LibOS] Add logic for SS_DISABLE and SS_ONSTACK in sigaltstack()
This commit also adds LibOS regression test for sigaltstack(). This
test is currently disabled (signal delivery on sigaltstack is not yet
implemented).
2019-05-23 16:25:06 -07:00
Michał Kowalczyk 16d90cfe12 Fix parenthesizing and formatting of C macros 2019-05-23 19:14:23 +02:00
Isaku Yamahata b3ddad0c37 Remove warnings triggered on newer GCC (7.4.0) 2019-05-20 20:53:06 +02:00
Dmitrii Kuvaiskii 880d70a259 [LibOS] Return EFAULT on null file in execve()
Previously, execve(NULL, ...) failed with segfault. This commit adds
memory checks that all arguments of execve() are valid memory regions.
Also adds LibOS regression test on execve(bad-file, bad-args, bad-env).
2019-05-14 19:27:15 -07:00
Dmitrii Kuvaiskii e307eca021 [LibOS] Support of test_user_{memory/string} in SGX PAL
Previously, test_user_{memory/string} failed on Linux-SGX PAL.
These functions check if user-supplied buffer/string is accessible
inside LibOS. There was only one option: setup a segfault handler
to catch memory errors and access one byte of each page in user-supplied
buffer/string. If some byte is inaccessible, then exception is raised
and caught by segfault handler. The handler checks the faulting
address and redirects back to function and it returns with failure.

This option doesn't work under SGX because there is no trusted field
that contains the faulting address. SGX v1 doesn't have such field at
all, SGX v2 introduces a field in SSA.MISC region but only at the
4K-page granularity.

This commit adds a second option used for SGX PAL: functions consult
LibOS's internal VMA bookkeeping. If buffer/string is not in any VMA,
then these functions fail. This option is slightly slower than first one
since it requires locking and traversing a list of VMAs.
2019-05-14 00:23:35 -07:00
Rafał Wojdyła aba21c360e [LibOS] Return proper error code on initialization fail 2019-05-14 00:12:15 +02:00
Biao Lu 2c87e294fc [LibOS] Make /proc/cpuinfo output exactly like in Linux kernel
Some Linux applications get the number of CPU cores by querying
/proc/cpuinfo.  Before, such apps would be confused by a wrong
format of /proc/cpuinfo in Graphene. This commit updates format
to exactly the same as in Linux kernel.

This commit also adds a LibOS regression test for /proc/cpuinfo.
2019-05-07 18:59:37 -07:00
Michał Kowalczyk 2bc2c04194 Remove trailing blanks 2019-05-07 16:32:16 +02:00
Dmitrii Kuvaiskii 402020f8da [LibOS/regression] Add futex-timeout test
Before PR #554, futex() syscall incorrectly failed
if user-supplied timeout expired (also see PR #438).
This patch adds test on futex() with timeout.
2019-05-06 13:46:26 -07:00
Isaku Yamahata 0a8f97af5a [Pal/{Linux, Linux-SGX}] Add NULL check in udp_connect/sgx_ocall_sock_connect
This patch also adds a UDP LibOS regression test.
2019-05-03 12:50:03 -07:00
Don Porter e62a021fd8 Add an open method to /proc and some subdirectories
This addresses issue #461.
2019-05-01 09:04:51 -04:00
Michał Kowalczyk 382a1ec394 Cleanup .gitignore files 2019-04-30 23:16:38 +02:00
Dmitrii Kuvaiskii bd72b968ee [*/regression] Increase timeout of regression tests
On weaker machines (Intel NUCs and SGX-enabled laptops),
SGX regression tests take longer than 5 seconds because
Graphene measures/zeroes all enclave memory at startup.
Increase the timeout for SGX regression tests to 20 sec.
2019-04-29 18:10:32 -07:00
Simon Gaiser f30f7e7575 [*/regression] Use uniform and cleaner SGX environment check
As suggested by @yamahata in PR #612.
2019-04-17 02:08:37 +02:00
Rafał Wojdyła f859f3da77 [LibOS] Add regression test for getdents 2019-04-15 19:34:33 -04:00
Simon Gaiser 79d6fb27ec [*/regression] Migrate to Python 3 2019-04-15 17:27:30 +02:00
Simon Gaiser 3d60004a8c [*/regression] Drop unused shebang
The regression python scripts are not marked executable. Also they
expect that the Makefile has setup the environment correctly so just
marking them executable would not be useful. So drop the unused shebang
to avoid encoding the interpreter in multiple places.

Script/regression.py is a library so it also doesn't need a shebang.
2019-04-15 17:24:27 +02:00
Zhang Chen 06b71fc1a0 [LibOS] shim_namei.c: Fix input absolute path error and add test case
This bug just occurs when reading a symlink on procfs.
If input is an absolute path, it will get wrong my_dent.
So we use stat syscall to check whether the "/proc/1/root"
and "/" is same path in graphene.

Signed-off-by: Zhang Chen <chen.zhang@intel.com>
2019-04-04 08:29:41 -04:00
Zhang Chen 5cd91c596c [LibOS] Add missed error handling and fix codestyle issues in epoll_wait regression test
Signed-off-by: Zhang Chen <chen.zhang@intel.com>
2019-04-03 16:39:00 +02:00
Don Porter 1286dec7ab Ensure unit tests actually return a failure message 2019-04-02 14:55:15 -04:00
Chia-Che Tsai cba6e3278a Add -Werror to CFLAGS with WERROR=1
Signed-off-by: Chia-Che Tsai <chiache@tamu.edu>
2019-02-12 20:09:43 -06:00
Michał Kowalczyk 91f1301bd3 Fix Python shebangs compatibility 2019-02-05 17:59:25 +01:00
Isaku Yamahata 4a63e6a577 [LibOS/benchmark] make LibOS/shim/tests/benchmark build again
This patch fixes up to make LibOS/shim/tests/benchmark build again.
It addresses small 4 issues as follows.

- Runtime/pal_loader
  pass --no-print-directory to make pal_loader doesn't work as
  expected when it's invoked by make command as below.  pal_loader
  invokes make with --quiet. But when pal_loader is called by make as
  sub command, the message, "Entering/Leaving <dir>" is still output.
  pass --no-print-directory to make to suppress Entering/Leaving
  message.

  > /graphene/Runtime/pal-make[1]: Entering
  > directory '/graphene/Pal/test'
  > Linux
  > make[1]: Leaving directory
  > '/graphene/devel/graphene/Pal/test' is not built, or
  > security mode is not supported

- fix up Makefiles to build LibOS/shim/tests/benchmark
  Otherwise the build fails as follows.
  > $ make
  > ln -sf ../../../../Runtime/pal_loader
  > [ fork_latency ]
  > [ test_start.m ]
  > [ rpc_latency.libos ]
  > /usr/bin/ld: cannot find -llibos
  > collect2: error: ld returned 1 exit status
  > Makefile:18: recipe for target 'rpc_latency.libos' failed
  > make: *** [rpc_latency.libos] Error 1

- update stale manifest.template

- update .gitignore
  The change set of 7f5a4cc made Makefile create .lib directory.
  So add it to .gitignore.

Signed-off-by: Isaku Yamahata <isaku.yamahata@gmail.com>
2019-01-22 23:06:45 +01:00
Don Porter 5d8c9ac260 Fix error code propagation on SGX (#205), add unit tests for exit code propagation 2018-12-04 20:43:05 -05:00
Dmitrii Kuvaiskii f58e478e43 Fixes oscarlab/graphene#239 (shim_do_epoll_wait ignores user-supplied timeout)
Better unit test to test shim_do_epoll_wait
2018-11-28 16:58:50 -05:00
Don Porter 203a3920fa Fix a regression on exec in trying to repro #59. Remove an assertion that doesn't seem to be doing much good, given that the size is always statically determined in hex2str.
Fixing the bound of a debug buffer in SGX PAL

Rewrite bytes2hexstr; Add two new macros, alloca_bytes2hexstr() and malloc_bytes2hexstr().

Remove HASHBUF_SIZE

Add comments for the bytes2hexstr() macros.

Add a compile-time assertion
2018-11-13 13:02:42 -05:00
Jat 6a1faf7874 gcc -dumpmachine returns x86_64-xxx-linux-gnu (#242)
This change normalizes the behavior of the Makefile in checking for the host system time, building across a wider range of systems.
2018-10-10 11:35:30 -07:00
Don Porter 83d230a774 Add the shared object unit test to CI/standard unit test suites (#213)
* Add the shared object unit test to CI/standard unit test suites (#54 #56)
2018-07-02 20:25:59 -04:00