25 Commits
Author SHA1 Message Date
Vijay Dhanraj ec4422d415 [Pal,LibOS] Add support for /sys pseudo filesystem
This commit also fixes `pseudo_name_ops::list_name()` function pointer
type: `size_t len` argument instead of `int len`.  It also adds a
regression test to exercise the newly supported /sys pseudo filesystem.
2021-01-28 23:28:29 -08:00
Vijay Dhanraj 227b0d2053 [Pal] Add str_to_ulong() common function 2021-01-28 23:18:45 -08:00
Stefan Berger 74718584b5 [Pal] Enable COMPILER_BARRIER for all architectures 2020-11-23 22:13:57 +01:00
Dmitrii Kuvaiskii 8eee4a4742 [LibOS,Pal,Examples,GSC,Docs] Move manifest parsing to TOML
The manifest syntax stays exactly the same, including 0 and 1
integers to denote boolean values (this is done for ease of porting
and can be fixed in future commits). The only visible change is
surrounding strings in the manifest with quotes (requirement of
TOML). All manifests and Makefiles of our tests and example apps are
ported to the new TOML syntax. Documentation is updated.
2020-11-12 05:45:07 -08:00
Vijay DhanrajandGary 3fa93cc86f [LibOS,Pal] Add sched_setaffinity/sched_getaffinity syscall support
This patch adds syscall support for setting/getting cpu affinity
of threads.

Co-authored-by: Gary <gordon.king@intel.com>
2020-11-06 22:28:32 +01:00
Dmitrii Kuvaiskii 28050d051e [Pal/lib] Add strtoll() and funcs from ctype.h for string manipulation
These functions are required by the TOML C source code, which will
be embedded into Graphene in a future commit.
2020-10-29 02:02:05 -07:00
Michał Kowalczyk 4e26fe7e32 [LibOS+Pal] Clean up string handling utilities 2020-10-16 16:18:43 +02:00
Dmitrii Kuvaiskii 1ac4da9c0f [Pal/lib] Remove unused functions in manifest-config struct
Also move parse_size_str() to a more appropriate atoi.c file.
This is in preparation for replacing the old ad-hoc manifest
syntax with the TOML syntax.
2020-10-16 02:27:11 -07:00
Dmitrii Kuvaiskii bd5d56b1a0 [Pal/lib] Add strncmp() and strspn() string manipulation funcs
These functions are required by the TOML C source code, which will be
embedded into Graphene in a future commit.
2020-10-15 08:27:43 -07:00
Dmitrii Kuvaiskii 70c7264f03 [Pal/Linux-SGX] Add manifest option loader.pal_internal_mem_size
Previously, Graphene preallocated 64MB for PAL internal metadata
like trusted/protected files metadata, handles metadata, etc.
If this limit was depleted, Graphene loudly failed, and the user
had no option but to change constant in source code and rebuild
Graphene. This commit adds the manifest option
`loader.pal_internal_mem_size` to allow increasing this limit.
2020-09-30 08:14:38 -07:00
Dmitrii Kuvaiskii 6f7b07b1d2 [LibOS,Pal] Move parse_int to Pal/lib/config.c 2020-09-30 08:11:28 -07:00
Michał Kowalczyk ad477ec7bf Reformat repository to our C formatting rules (final iteration) 2020-09-15 02:00:54 +02:00
Michał Kowalczyk bdcf29ba33 [Pal] Simplify memset and clean up other string ops 2020-07-23 19:48:15 +02:00
Michał Kowalczyk 7b0c160296 [Pal] Protect env from untrusted world 2020-07-13 22:05:04 +02:00
Michał Kowalczyk f948351243 [Pal] Fix out-of-bounds read in strstartswith_static 2020-07-13 22:05:04 +02:00
Rafał Wojdyła cf84489cd5 [Linux-SGX] Add protected files implementation
Protected files (PF) are a new type of file that can be specified in
the manifest (SGX only). They are encrypted on disk and transparently
decrypted when accessed by the Graphene payload.

Other features:
- data is integrity protected (tamper resistance)
- file swap protection (a PF can only be accessed when in a specific path)
- transparency (Graphene payload sees PFs as regular files, no need to modify
  the payload)

See Linux-SGX/protected-files directory for implementation. PF format is
based on protected files from the SGX SDK:
https://github.com/intel/linux-sgx/tree/master/sdk/protected_fs

The following new manifest elements are added:

sgx.protected_files_key = <16-byte hex value>
sgx.protected_files.<name> = file:<host path>

sgx.protected_files_key specifies the encryption key and is only a temporary
implementation. This key should be provisioned with local/remote attestation
in the future.

Paths specifying PF entries can be files or directories. If a directory is
specified, all files/directories within are registered as protected
recursively (and are expected to be encrypted in the PF format).

Linux-SGX/tools directory contains the pf_crypt utility that converts files
to/from the protected format.
2020-07-13 20:19:42 +02:00
Michał Kowalczyk 0f55c6de04 Use SPDX IDs for licenses in source files 2020-06-13 03:25:33 +02:00
Stefan Berger bf155c7bc9 [Pal/lib] Implement strstr() 2020-06-10 00:27:10 +00:00
borysp c9742cb9cd Add READ_ONCE and WRITE_ONCE macros
Sometimes we need to prevent the compiler from reading or writing to
a memory location twice to prevent certain TOCTOU bugs. This can now
be achieved by using the introduced macros and this commit does so in
enclave_ocalls.c for Linux-SGX.
2020-05-08 01:43:12 +02:00
Michał Kowalczyk 5e2eee0086 [Pal] Remove likely/unlikely macros 2020-04-20 22:00:58 +02:00
Michał Kowalczyk 2b4e50c9bb [LibOS] Clean up PAUSE macros 2020-04-10 19:23:42 -07:00
Michał Kowalczyk e58933a971 [Pal/lib] Simplify static_str* macros 2020-04-02 01:46:48 +02:00
Dmitrii Kuvaiskii 95bfd8aeb5 [Pal/Linux-SGX] Refactor memory management of enclave pages
Previously, Linux-SGX logic of allocating/freeing enclave pages was
complicated and hard to read. This commit refactors this code for
readability, without changes in functionality.
2020-03-04 08:41:28 -08:00
borysp b40862a59c [LibOS,Pal/{Linux, Linux-SGX}] Add bogomips to /proc/cpuinfo 2020-03-02 21:48:55 +01:00
Isaku Yamahata 0a7e3dd127 [LibOS,Pal] Move header files from Pal/lib/ under Pal/include/ 2020-02-05 23:21:06 -08:00