Commit Graph
699 Commits
Author SHA1 Message Date
borysp 6c0c0c526a [Make] Fix LibOS tests build errors 2020-02-14 05:16:50 +01:00
Isaku Yamahata b25bd2aed5 [Make] List object files in plain manner
The current Makefiles are unnecessarily too smart in avoiding
duplication (which is small, I think). As a result, it's hard to
understand what files are listed. Use plain, explicit listing instead.

Also, append .o to objs variables. Usually obj means .o file, not the
base name of file. It was confusing.
2020-02-12 17:09:24 +01:00
Isaku Yamahata 4182c29476 [LibOS] Eliminate unnecessary nested functions
BEGIN_MIGRATION_DEF() is used to define nested functions unnecessarily.
Make them normal (non-nested) functions.
2020-02-12 02:11:58 +01:00
Isaku Yamahata 8ca30edbfa [Make] Remove the use of wildcards
The use of wildcards in Makefiles for targets is undesirable for tests.
For example, if a file is deleted accidentally, Make doesn't detect it.
What needs to be build should be explicit.

This patch replaces the use of wildcards in tests' Makefiles with
explicitly listed executables.
2020-02-12 01:17:22 +01:00
Isaku Yamahata df358b8ba8 [Make] Consistently use $(RM) instead of rm -f 2020-02-12 01:09:21 +01:00
Thomas Knauth 6f0690f223 Remove forcing some cpuid subleafs to zero 2020-02-11 23:59:52 +01:00
Isaku Yamahata ff0fd4d0fd [.gitignore] Remove * from .gitignore files
Plain wildcards `*` in .gitignore are considered a bad practice
because they may cause unintended ignore of files. This commit
replaces `*` with explicit lists of file names.
2020-02-11 12:15:56 -08:00
Isaku Yamahata 5a84d36e8c [LibOS] Use right type, struct wake_queue_node*, instead of void* 2020-02-11 02:30:49 +01:00
Isaku Yamahata ada76139e2 [LibOS] Makefile: Remove OMIT_FRAME_POINTER flag
There is no code depending on it. If it's wanted, one could simply
change CFLAGS.
2020-02-11 00:45:36 +01:00
Isaku Yamahata d2d88e16fe [LibOS] Change ioctl(, int cmd) to ioctl(, unsigned long cmd)
The second argument to ioctl is unsigned long, not int.
2020-02-10 22:38:07 +01:00
Isaku Yamahata 15e298ace9 [LibOS] glibc: Remove INLINE_SYSCALL_ASM and related changes
It's the same as INLINE_SYSCALL, plus the changes to INLINE_SYSCALL are
unnecessary churn now. It seems to be a legacy from old patches.
2020-02-10 01:58:36 +01:00
Isaku Yamahata afddf5c4cc [LibOS] Build test/{benchmark, inline, regression} 2020-02-05 23:21:06 -08:00
Isaku Yamahata 0a7e3dd127 [LibOS,Pal] Move header files from Pal/lib/ under Pal/include/ 2020-02-05 23:21:06 -08:00
Isaku Yamahata 8d65898d91 [LibOS,Pal] Eliminate creation of host_endian.h symlink
This file should be included via include path, not via a symlink.
2020-02-05 23:21:06 -08:00
Isaku Yamahata cff1146892 [LibOS,Pal] Modify Makefiles' logic to simplify checks on SYS
The goal of `$(SYS)` check in Makefiles is to skip all targets on
unsupported systems. This commit defines a default goal `all` as
a no-op for simplicity.
2020-02-05 23:21:06 -08:00
Isaku Yamahata fc0b5c4012 [LibOS,Pal] remove unnecessary .PHONY: default in Makefiles 2020-02-05 23:21:05 -08:00
Isaku Yamahata fa2ed00153 [LibOS] Include Makefile.{config, rule} in test/*/Makefile 2020-02-05 23:21:05 -08:00
Isaku Yamahata 647a8f3953 [LibOS,Pal] Consolidate common CFLAGS in Makefile.configs 2020-02-05 23:21:05 -08:00
Isaku Yamahata 29d907a573 [LibOS,Pal] Consolidate DEBUG, WERROR, PROFILE in Makefile.configs 2020-02-05 23:21:05 -08:00
Isaku Yamahata 88ea5164d6 [LibOS,Pal] Makefiles: use += instead of = in CFLAGS/LDFLAGS/etc 2020-02-05 23:21:05 -08:00
Isaku Yamahata c126c10452 [Pal] Move user_start.S under Pal/crt_init/ directory 2020-02-05 23:21:05 -08:00
Isaku Yamahata 50bdec8a23 [LibOS,Pal] Move Makefile.Host under Scripts/ 2020-02-05 23:21:05 -08:00
Isaku Yamahata 8fc9f0d948 [LibOS] native/Makefile, benchmark/Makefile: Use implicit pattern rules 2020-02-05 23:21:05 -08:00
Isaku Yamahata 35dd8c9423 [LibOS,Pal] Consolidate export DEBUG in Makefile.configs 2020-02-05 23:21:05 -08:00
Isaku Yamahata 0912f20ccf [LibOS,Pal] Unify the setting of CC and remove raw gcc invocations 2020-02-05 23:21:05 -08:00
Isaku Yamahata dd086816b5 [LibOS,Pal] Define AR and ARFLAGS properly 2020-02-05 23:21:05 -08:00
Isaku Yamahata 0612fc8657 [LibOS] Cleanup test/inline/Makefile 2020-02-05 23:21:05 -08:00
Isaku Yamahata a1c534ec56 [LibOS/shim/test] Rename .*.c files to .c files 2020-02-05 23:21:05 -08:00
Isaku Yamahata 9ef2251d66 [LibOS,Pal,Scripts] Add and use recipe to create manifest from template 2020-02-05 23:21:05 -08:00
Isaku Yamahata 732712e23e [LibOS,Pal] Move makefile libraries under Scripts/
This commit moves Makefile.configs, Makefile.rules, and Makefile.Test
under Scripts/ and adjusts their includes.
2020-02-05 23:21:04 -08:00
Isaku Yamahata e6d90c5bd8 [LibOS] test/apps: Update LTP to use its own Makefile.Test
This removes the dependency of test/apps/ on LibOS/shim/tests/Makefile.Test.
Thus, a follow-up commit can safely remove that file.
2020-02-05 23:21:04 -08:00
Isaku Yamahata a09c0897f5 [LibOS] Cleanup of shim_thread::shim_signal_logs
- Make struct shim_signal_log opaque.
- Introduce signal_logs_alloc() and signal_logs_free() to properly
  initialize and free signal_logs.
- Introduce helper signal_logs_pending() to simplify signal_logs check.
- Rename shim_signal_log's {head, tail} to {tail, head}.
- Fix PID leak during get_new_thread().
2020-02-05 13:16:12 -08:00
Simon Gaiser 0daeed847f [Jenkins] Check for missing gitignores and fix found issues 2020-02-05 02:46:13 +01:00
Dmitrii Kuvaiskii bca88eb94d [LibOS] test/apps: Allow SSL/TLS connections in Apache httpd 2020-02-04 18:25:40 -08:00
Dmitrii Kuvaiskii c685e56e67 [LibOS] Update TYPE_DEV handles with correct function pointers in dev_ops
For device handles, `info.dev.dev_ops` contains function pointers into
LibOS. They may become invalid due to relocation of LibOS text section
in the child process on fork. This commit forces an update of these
function pointers.
2020-02-04 18:25:00 -08:00
Simon Gaiser 9052837dfc [Make] Improve download handling
Instead of implementing downloading of external resources in every
Makefile again, use one script. This script adds the following
features:

 - Always check the download against a known SHA-256 hash.

 - Support caching of downloaded resources (set DL_CACHE=/some/dir).

 - Allow offline builds if all files are cached. If DL_OFFLINE=true the
   build will never attempt to download anything.
2020-02-05 00:41:10 +01:00
Isaku Yamahata d379bba600 [LibOS] test: Add missing dependencies in Makefiles 2020-02-04 02:49:18 +01:00
Simon Gaiser 7377a787bc [Makefile] Add distclean target
Before, there was no target that cleaned up downloaded sources. This
commit adds a distclean target to match the 'apps' Makefiles.
2020-02-04 01:15:08 +01:00
borysp 5c37c4d21a [LibOS] Miscellaneous bugfixes, mostly found by the previous commit
The previous commit added some asserts on locks state, which unveiled
a bunch of bugs. This fixes all of them and a bit more found in the
process.
2020-02-02 17:58:51 +01:00
borysp bdc6a48c2c [LibOS] Add a bunch of asserts on locks state 2020-02-02 17:58:39 +01:00
Simon Gaiser 80d34637d0 [LibOS] test/apps/curl: Test against local server 2020-02-01 00:41:58 -08:00
Dmitrii Kuvaiskii 4ad98502fe [LibOS,Pal] Introduce PAL_CREATE_DUALSTACK for IPV6_V6ONLY emulation
Previously, Graphene didn't have emulation of setsockopt(IPV6_V6ONLY).
This flag signals that application doesn't want to create dual-stack
socket (i.e., it wants to bind both IPv4 and IPv6 connections on the
same port).

In reality, different applications require different behavior: e.g.,
Redis sets IPV6_V6ONLY whereas Apache with SSL/TLS unsets it, and
always emulating as set or unset leads to failure of one of these
apps. This commit introduces emulation of IPV6_V6ONLY via a generic
PAL_CREATE_DUALSTACK flag passed to DkStreamOpen(.., create, ..).

Notice that it is impossible to emulate IPV6_V6ONLY as other flags
such as TCP_NODELAY because IPV6_V6ONLY flag makes sense only before
bind, whereas Graphene historically applies other flags only after
bind() syscall. Therefore we introduced PAL_CREATE_DUALSTACK.
2020-02-01 04:24:58 +01:00
Isaku Yamahata a256338634 Add generated-cacert.h and glibc-build to .gitignore 2020-01-29 22:23:13 +01:00
Dmitrii Kuvaiskii 735f54d22c [LibOS,Pal/{lib,Linux-SGX}] Add TLS-PSK protection to process checkpoint IPC
Previously, Graphene-SGX did not protect send/recv of checkpoint from
parent to child. This leaked all memory contents of the parent process.

This commit adds TLS-PSK (TLS with Pre-Shared Key) wrapper for process
communication. Graphene-SGX already has the logic for SGX-based local
attestation and generation of the shared key for each parent <-> child
communication channel via Diffie–Hellman key exchange. This commit
uses this pre-shared key to create an mbedTLS-based session based on
UNIX domain socketpair (parent.process.stream <-> child.process.stream).

_DkStreamSecure{Init,Free,Read,Write} internal Linux-SGX PAL functions
are added and used during child process creation and sending of the
parent-generated checkpoint. These functions are backed by crypto-layer
lib_SSL{Init,Free,Read,Write} functions which in turn use mbedTLS.
Configuration of mbedTLS is expanded to support TLS-PSK; note that for
entropy source we use only rdrand instruction inside SGX enclave (i.e.,
no untrusted host-platform sources of entropy). The only ciphersuite
currently supported for IPC is MBEDTLS_TLS_PSK_WITH_AES_128_GCM_SHA256.

This commit adds protection only for checkpoint IPC. After the checkpoint
is sent/received, the parent/child processes downgrade their sockets to
plain non-secure ones (by disabling TLS). This is done because child
may spawn a grandchild that also wants to communicate with grandparent,
but it is impossible for multiple processes to share same TLS context.

Additionally, this commit sanitizes "process" PAL handles during send-
handle checkpoint send (via DkSendHandle): shared key and TLS context
are zeroed out.
2020-01-28 13:05:48 -08:00
Michał Kowalczyk e09ac87321 [LibOS] test_libos.py: Simplify test_001_strict_fail 2020-01-28 17:03:32 +01:00
Isaku Yamahata 621b6a34b9 pylint: Eliminate pylint warnings in test_{pal,libos}.py 2020-01-28 03:45:04 +01:00
Dmitrii Kuvaiskii a1c340b60b [LibOS] Add EINVAL and EFAULT checks for {get,set}sockopt() 2020-01-25 22:39:56 +01:00
Dmitrii Kuvaiskii eb4849d23a [LibOS] Allow all getsockopt() before bind()
Previously in Graphene, some getsockopt() syscalls, e.g. TCP_NODELAY,
failed because an underlying PAL handle was't created for the LibOS
handle until bind() was called. Thus, a sequence of accept() and
getsockopt() failed. This commit fixes this by returning default
socket options (possibly augmented with setsockopt values). Test
case is also provided.
2020-01-25 22:39:56 +01:00
Yunjong Jeong 9df502b4ab [Pal/Linux-SGX] Add manifest option sgx.enclave_pal_file
Path to enclave file had been a fixed string that is determined at
build time. Therefore Runtime binares were not allowed to move
their location. This commit adds sgx.enclave_pal_file manifest
option to specify the uri of libpal-Linux-SGX.so.
2020-01-26 01:54:46 +09:00
Dmitrii Kuvaiskii 5784d97375 [LibOS] Allow MSG_PEEK on recv()
Previously, Graphene failed if recv() contained MSG_PEEK flag. This
resulted in many TLS-based applications failing, including Nginx,
Apache, and Lighttpd in SSL/TLS mode. This commit adds emulation of
MSG_PEEK at LibOS level. A simple TCP test case is provided.
2020-01-25 02:26:59 +01:00