Commit Graph

63 Commits

Author SHA1 Message Date
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
Stefan Berger fd22ef2fa3 [Pal] Build DkSegmentRegister() only on x86_64 and adapt Symbols test 2020-06-26 03:24:55 +00:00
Jörg Thalheim 82caa0683d [Scripts] Make bash shebangs portable
Unlike /usr/bin/env which is a Posix standard, there is no guarentee
that /bin/bash exists. This is the case for operating systems such
as FreeBSD, NixOS and Guix. By using /usr/bin/env we also give
the user the option to provide their own bash in a different path
by setting the $PATH environemnt variable.
Distributions usually provide their own packaging wrappers
to fixup shebangs upon installation, however those are not convienent
to use when developing in the source tree.

See also other upstream discussions about the topic:

- https://github.com/systemd/systemd/pull/5816
2020-06-24 19:51:55 +02:00
Michał Kowalczyk fcf0a01d7d Remove shebangs from autogenerated manifests
We don't use it in tests, plus it didn't work on SGX - there was a
warning about autogeneration inserted before the autogenerated shebang.

Also, test_106_manifest_with_shebang didn't actually test the shebang
but ran the binary through the loader, so it was meaningless. We'll need
to fix it and implement again after cleaning up Graphene invocation.
2020-06-18 00:44:30 +02:00
Stefan Berger fff09c00af Add -Wmissing-prototypes to CFLAGS and deal with the fallout 2020-06-04 17:22:19 +02:00
Stefan Berger 06ec21be32 [Scripts] Set PAL_HOST to Linux if 'linux' is found in $(SYS)
Also check for unsupported architecture in Makefile.configs.
2020-05-21 07:08:47 +00:00
Stefan Berger 17b1245270 [Examples] Python: adapt Python constants for Fedora
Adapt the python constants so that python-simple also works on
Fedora 31. python-scipy-insecure misses some shared libraries on
Fedora 31, so it does not work there yet.
2020-05-01 20:54:04 +00:00
Stefan Berger 741f5f7cd4 [Examples] Python: move Python constants to Scripts/Makefile.python 2020-05-01 20:54:04 +00:00
Stefan Berger f7f89c2ed2 [Makefiles] Make Graphene compileable and testable on Fedora
Adapt Scripts/Makefile.configs so that we can build and test on
Fedora. Most of the tests in Examples are now also runable on
Fedora. Also add a dependency installation target for Fedora to
TensorFlow example.
2020-05-01 20:54:04 +00:00
Stefan Berger 206eb81eec [Makefiles] Get arch and distro specific vars from Makefile.configs
Extend Makefile.configs and define several variables for make to use
derived from 'gcc -dumpmachine'. In particular:
- ARCH as the architecture, e.g., x86_64
- ARCH_LONG as the long version of the architecture, e.g., x86_64-linux-gnu
- ARCH_LIBDIR as the directory where libraries are located,
  e.g., /lib/x86_64-linux-gnu

In Makefiles and manifest templates, replace the hard-coded
x86_64-linux_gnu and /lib/x86_64-linux-gnu through these variables.
Extend the already existing sed scripts to replace the necessary
variables.
2020-05-01 20:54:04 +00:00
Michał Kowalczyk 4f57ada563 [Pal] Clean up argv handling and PAL invocation
This is a preparation for even more clean-ups and bugfixes, which are
required by protected argv+envp implementation.
2020-04-20 22:00:58 +02:00
Michał Kowalczyk a783fa2f4b Remove unused profiling system 2020-04-13 18:59:03 +02:00
Isaku Yamahata e0dc66bcf6 [Make] Fix Makefile.Host message when run with SGX_RUN=1
Remove leading tab to fix the following error:

> Scripts//Makefile.Host:16: *** recipe commences before first target. Stop.
2020-02-29 02:54:48 +01:00
borysp f2b1d194a1 [Make] Remove std=gnu99 from tests 2020-02-14 05:16:50 +01:00
Isaku Yamahata df358b8ba8 [Make] Consistently use $(RM) instead of rm -f 2020-02-12 01:09:21 +01: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 07722756e5 [Scripts] Include dependency file for .c in Makefile.Test 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 647a8f3953 [LibOS,Pal] Consolidate common CFLAGS in Makefile.configs 2020-02-05 23:21:05 -08:00
Isaku Yamahata 72ddedc065 [Scripts] Remove PAL_LOADER variable from Makefile.test 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 86afe662f3 [Pal/Linux-SGX] Add rule cmulti to build executable from multiple .o files 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 419b5c5a11 [Pal] Introduce common Makefile.manifest and remove Pal/src/Makefile.Test 2020-02-05 23:21:05 -08:00
Isaku Yamahata 08ae3a241c [Pal] Use expand_target_to_{sig,sgx,token} instead of expand_target() 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 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
Simon Gaiser 0daeed847f [Jenkins] Check for missing gitignores and fix found issues 2020-02-05 02:46:13 +01: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
Simon Gaiser 75619fe760 [Scripts/clean-check] Ignore git repos
Newer git versions update some cache in .git/index even on read-only
calls (like git status). So ignore any changes in .git when checking
make clean.
2020-02-04 01:15:59 -08: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
Simon Gaiser 2d29f7aaeb [Makefile] Drop SGX_RUN
For detection of SGX/non-SGX (for example in regression tests) always
use the SGX environment variable. To generate launch/EINIT tokens use
the new 'sgx-tokens' Make target.
2019-09-27 12:38:14 +02:00
Simon Gaiser 8dd19d28fb [Makefile] Check make clean on Jenkins 2019-09-27 03:45:21 +02:00
Simon Gaiser 13cac1df92 [Makefile] Fix missing cleans 2019-09-27 03:45:21 +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
Isaku Yamahata a84fe47843 Clean up .gitignore files
Move generic patterns to the top-level .gitignore and add some more
patterns for convenience.
2019-05-14 03:03:49 +02:00
Simon Gaiser c482288936 [Scripts/regression] Improve subprocess handling
This fixes two problems with subprocess handling:
 1. Use subprocess.communicate to avoid that the pipe can fill up.
 2. Use a process group to ensure that we also kill the subprocess'
    children in case of a timeout.

Note: This does not cover the case that the child returns successfully
but leaves other child processes running. AFAICS this is not easy since
subprocess.communicate() wait(2)s for the process so the pid is no
longer guaranteed to be valid to kill. So we leave this to the outside
environment (Jenkins or whatever).
2019-04-26 17:39:20 +02:00
Simon Gaiser 0a0babc26a [*/regression] Remove trailing whitespace in Python files 2019-04-15 17:27:30 +02: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
Simon Gaiser 483cde8ab7 [Scripts/regression] Treat timeouts as failure 2019-04-12 19:49:17 +02:00
Simon Gaiser f8d516bdb4 [Scripts/regression] Log ignored failure in one line
This makes parsing the output easier visually as well as by machine.
2019-03-18 17:03:15 +01:00
Simon Gaiser 9d1b70bd57 [Scripts/regression] Rename 'flaky' to 'ignore_failure'
There are different reasons why a test failure should be ignored, so
rename the option to avoid confusion if the test isn't flaky.
2019-03-18 17:03:15 +01:00
Michał Kowalczyk c9eb1d84e1 Fix Bash shebangs compatibility 2019-02-05 17:59:25 +01:00