Commit Graph

448 Commits

Author SHA1 Message Date
volcano 387e220401 Fix missing mm_modify_permissions in sim mode (#928)
Signed-off-by: volcano0dr <volcano_dr@163.com>
2023-01-05 17:02:50 +08:00
Maja Kądziołka 3be7be4060 Fix data races around g_enclave_state (#889)
Before this commit, the memory access within `do_init_enclave` setting
`g_enclave_state` to `ENCLAVE_INIT_DONE` was entirely unsynchronized.
This could cause the compiler to reorder this access, performing it
earlier than actually written. This would effectively unlock the memory
being initialized for use within other threads before the initialization
is finished.

The issue isn't entirely theoretical, as such an optimization could for
example allow to make one of the calls to `memset_s` a tailcall. The
only thing preventing this is the difficulty of proving that the memset
doesn't alias `g_enclave_state`.

One way to fix this would be to access `g_enclave_state` with C11
atomics of ordering `acq_rel` or stronger. However, the freestanding
environment of the SDK doesn't support C11 atomics. Thus we use the
existing assembly wrappers, which are sufficient as achieving `acq_rel`
semantics in x86 assembly doesn't require any special instructions.

To make it less likely that a similar flaw is reintroduced, we remove
the `extern` declaration of `g_enclave_state` from the header files.

Signed-off-by: Maja Kądziołka <maya@invisiblethingslab.com>
2023-01-05 13:57:46 +08:00
volcano ec0a8ed3f8 Support KSS on simulation mode (#885)
* Support KSS on simulation mode

Signed-off-by: volcano0dr <volcano_dr@163.com>
2022-12-21 10:36:32 +08:00
Haitao Huang 131434961a Merge pull request #922 from intel/docker_build_fix
PSW: fix docker build and psw bin installer for urts version update
2022-12-15 12:10:52 -06:00
Haitao Huang a504531ce9 Docker build: expose new kernel sgx dev nodes
Signed-off-by: Haitao Huang <haitao.huang@linux.intel.com>
2022-12-14 21:49:41 -08:00
Haitao Huang 816df5c360 PSW: fix docker build and psw bin installer for urts version update
Signed-off-by: Haitao Huang <haitao.huang@linux.intel.com>
2022-12-14 21:49:41 -08:00
Haitao Huang 2fef5c1288 Merge pull request #919 from JunjunGu1/fix-driver-node
merge the fix for driver node detection
2022-12-14 10:08:31 -06:00
JunjunGu1 c37095cf6a merge the fix for driver node detection
Signed-off-by: JunjunGu1 <junjun.gu@intel.com>
2022-12-13 11:05:44 +08:00
Li, Xun 4cab878689 Fix submodule branch
Signed-off-by: Li, Xun <xun.li@intel.com>
2022-11-30 09:32:54 +08:00
Muhammad El-Hindi ef38c57bba Removed uncessary creation of apply_patch file 2022-11-30 09:05:27 +08:00
Muhammad El-Hindi a597187c5f Check if dnnl preparation step is required 2022-11-30 09:05:27 +08:00
melhindi e20be7e459 Update Makefile of dnnl for unattended installs
The proposed change makes it easier to perform unattended installations in e.g. docker containers or VMs.
The `git am` command applies patches and attempts to commit the changes.
Yet, in order to commit git requires `user.name` and `user.email` to be configured, which are both usually not set in containers or VMs.

Based on my testing it is enough to simply apply the patch to avoid git asking for the user's name and email.

Signed-off-by: Muhammad El-Hindi muhammad.el-hindi@cs.tu-darmstadt.com
2022-11-30 09:05:27 +08:00
Li, Xun b0af6e75ac Linux 2.18 Open Source Gold Release
Along with the latest processor microcode address CVE-2022-21233.
  Modified the Switchless library to have mitigations for the associated issue.
Added support for the Linux kernel APIs for the Enclave Dynamic Memory
  Management (EDMM) features that are available with the Linux kernel v6.0 or
  later. Refer to the SGX SDK developer reference for details on new trusted
  APIs and enclave configuration for the EDMM features.
Enabled C++17 within SGX SDK.
Supported AMX (Advanced Matrix Extensions) in Enclave.
Replace hardcoded Enclave signing keys in all sample projects with dynamically
generated keys.
Added a new API to allow user to configure enclave internal cache size in the
  Protected File System library.
Upgraded to OpenSSL 1.1.1q and upgraded Intel(R) SGX Quote Verification Enclave
  to integrate SgxSSL/OpenSSL version 1.1.1q.
Supported new OS: Ubuntu* 22.04 LTS 64-bit Server version, CentOS* 8.3 64bits,
  Red Hat* Enterprise Linux* Server 8.6 (for x86_64), SUSE* Linux* Enterprise
  Server 15.4 64bits, Debian* 10 and Anolis* OS 8.6.
Upgraded Intel SGX QE3 to make it backward compatible.
Improved ECDSA quote generation and verification performance by caching PCK
  certificates and collaterals in memory and disk drive.
Added Java support for quote verification library.
Added new APIs to unify Intel SGX and TDX quote verification in Quote
  Verification Library.
Added Advisory ID in ECDSA quote verification supplemental data.
Added Intel TDX support in RA-TLS (Remote Attestation based TLS) library.
Improved TDX quote generation throughput in vsock mode.
Added Rust support for TDX quote generation.
Fixed bugs.

Signed-off-by: Li, Xun <xun.li@intel.com>
sgx_2.18
2022-11-24 13:48:25 +08:00
Henry Wang 4887b30b51 Fix pthread_self for untrusted threads that Ecall
Only threads created inside Enclave have pthread_info_tls.m_pthread set. If some untrusted thread does Ecall and then pthread_self() within Enclave, it will return NULL. This errorneous return value ends up causing thread synchronization errors inside the Enclave.
2022-09-06 10:12:03 +08:00
melhindi ced74d68f6 Enable parallelization of build in dnnl make file (#845)
the current Makefile does not use the special `$(MAKE)` command, instead `make` is hard coded.
This prevents the use of the `-j` flag, making the build slow.

Signed-off-by: Muhammad El-Hindi <muhammad.el-hindi@cs.tu-darmstadt.com>
2022-08-26 14:53:16 +08:00
Qiu Feng e151e2a6dd Remove AE debugInfo packages to pass build on some distros (#876)
* Remove AE debugInfo packages to pass build on some distros
* Update DCAP submodule commit reference
2022-08-26 14:22:31 +08:00
Li, Xun 70e1535caa Linux 2.17.1 Open Source Gold Release
Along with the latest processor microcode address CVE-2022-21233.
- Modified the Edger8r to generate code with mitigations for the associated issue.
- Modified the API memcpy and memcpy_s to have mitigations for the associated issue.

Signed-off-by: Li, Xun <xun.li@intel.com>
sgx_2.17.1
2022-08-10 08:55:34 +08:00
Li Xun 15098e70d7 Merge pull request #858 from yuguorui/master
Fix aesmd booting error after RPM upgrade.
2022-07-27 13:04:33 +08:00
yuguorui 7523535879 Fix aesmd booting error after RPM upgrade.
According to the spec [1], the scriptlet %post of a new package executes
before %preun of the old package.

This will cause the startup.sh of the new package to be executed first,
and then the cleanup.sh of the old package to be executed when
sgx-aesm-service is upgraded, and the user aesmd will be deleted,
which leading aesmd booting error.

Replace %post with %posttrans to make sure the prerequisites for service
aesmd are met.

[1]. https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/

Signed-off-by: yuguorui <yuguorui@pku.edu.cn>
2022-06-24 13:33:34 +08:00
Zhang Lili fdb3b8b469 Fix pthread tls bug.
Signed-off-by: Zhang Lili <lili.z.zhang@intel.com>
2022-06-17 17:10:03 +08:00
Li, Xun effae62802 Linux 2.17 Open Source Gold Release
Along with the latest processor microcode and re-signed all the Intel(R) SGX
  Architecture Enclaves (AEs) to address CVE-2022-21123, CVE-2022-21125 and
  CVE-2022-21166.
Upgraded to Protobuf 3.20.
Upgraded to SgxSSL/OpenSSL 1.1.1o.
Added Intel TDX Attestation support.
Added Rust support for ECDSA quote verification.
Fixed bugs.

Signed-off-by: Li, Xun <xun.li@intel.com>
sgx_2.17
2022-06-15 09:34:27 +08:00
Haitao Huang da3ce11c64 Merge pull request #810 from haitaohuang/deb_docker
Dockerfile: add debian package build
2022-06-06 10:49:55 -05:00
junjungu 0746daab39 fix comments
Signed-off-by: junjungu <junjun.gu@intel.com>
2022-05-16 13:36:18 +08:00
junjungu 957ce9383e remove the stored config when destroy enclave
Signed-off-by: junjungu <junjun.gu@intel.com>
2022-05-16 13:36:18 +08:00
junjungu 2eed93a0d9 fix the issue that s_enclave_elrange_map destructor is invalid
which is reported from https://github.com/intel/linux-sgx/issues/818

Signed-off-by: junjungu <junjun.gu@intel.com>
2022-05-16 13:36:18 +08:00
Le Yao 508b5ee37c Remove duplicated headers
Signed-off-by: Le Yao <le.yao@intel.com>
2022-05-05 14:17:41 +08:00
Yu Ding 917d20d0f6 fix: typo
Signed-off-by: Yu Ding <dingelish@gmail.com>
2022-05-05 14:10:42 +08:00
junjungu e1a37bdc38 fix a issue for vdso reported from msft
Signed-off-by: junjungu <junjun.gu@intel.com>
2022-04-13 12:55:37 +08:00
Zhang Lili e636b6c42b Fix psw installer failure casued by PATH.
Signed-off-by: Zhang Lili <lili.z.zhang@intel.com>
2022-04-13 09:51:32 +08:00
Zhang Lili 1a98debccc Fix get_max_tcs_num() API for SGX1.
Signed-off-by: Zhang Lili <lili.z.zhang@intel.com>
2022-04-08 14:31:15 +08:00
gaoyusong 111a916b5d Fix sgx_create_enclave retry mechanism
Fix sgx_create_enclave retry mechanism when load_enclave
just return SGX_ERROR_MEMORY_MAP_FAILURE. Deprecated the
SGX_ERROR_MEMORY_MAP_CONFLICT. Make the retry mechanism
compatible with new driver and urts.

Signed-off-by: gaoyusong <a869920004@163.com>
2022-04-08 10:29:29 +08:00
Li, Xun 321a6580fb Linux 2.16 Open Source Gold Release
Upgraded to OpenSSL 1.1.1m.
Provided RA-TLS (Remote Attestation based Transport Layer Security) APIs and
  Samples.
Supported PKRU (Protection Key rights Register) in Enclave.
Added APIs of SHA384 and VerifyReport2 to support TDX.
Enhanced QPL (Quote Provider Library) to support caching Intel PCK
  (Provisioning Certificate Key) certificate chain in local memory, or
  retrieving Intel PCK cert chain from local HTTP/S address.
Upgraded Intel ECDSA Quote Verification Enclave to integrate SgxSSL/OpenSSL
  version 1.1.1m.
Introduced Intel ID enclave for QE identity generation.
Fixed bugs.

Signed-off-by: Li, Xun <xun.li@intel.com>
sgx_2.16
2022-04-06 12:06:27 +08:00
Haitao Huang dd65737a2f Dockerfile: add debian package build
Updated README
Also revert aesm docker to run as root inside
This was to ensure access to /dev/sgx_provision

Signed-off-by: Haitao Huang <4699115+haitaohuang@users.noreply.github.com>
2022-03-23 17:22:36 -07:00
Li Xun 0af6a83ef9 Merge pull request #808 from llly/update_readme
Update toolset instruction in README
2022-03-11 16:20:07 +08:00
Li, Xun acb9c84b9b Update toolset instruction in README
Toolset file names in prebuilt package are changed.

Signed-off-by: Li, Xun <xun.li@intel.com>
2022-03-11 09:53:26 +08:00
Vincent Haupert f607f89ab1 Fix Nix detection (#773)
Detect Nix by probing for the presence of the `NIX_STORE` environment
variable instead of `NIX_PATH`. The latter is only set in a `nix-shell`
session but isn't when building a derivation through `nix-build`. In
contrast, the `NIX_STORE` environment variable is set in both cases.

Signed-off-by: Vincent Haupert <mail@vincent-haupert.de>
2022-02-14 08:59:45 +08:00
Sylvain Bellemare 2ee53db4e8 Replace /bin/cp with cp for nix-build (#730)
* Replace /bin/cp with cp for nix-build

When using nix-build, /bin/cp cannot be found as there's nothing under
/bin except for sh.

Signed-off-by: Sylvain Bellemare <sbellem@gmail.com>

* Call getconf(1) relative to `PATH`

Signed-off-by: Vincent Haupert <mail@vincent-haupert.de>

Co-authored-by: Vincent Haupert <mail@vincent-haupert.de>
2022-01-05 16:36:25 +08:00
Guorui Yu 71211efb54 Fix aesmd service permission in linksgx.sh. (#736)
This commit ensures that no matter what the order of package installation is,
aesmd can have access to the sgx_provision device file.

Signed-off-by: yuguorui <yuguorui@pku.edu.cn>
2022-01-05 15:52:19 +08:00
Sylvain Bellemare 51d1087b70 Add sgx_ippcp.h to build sdk 2.15 from source (#752)
(when ipp crypto is built from source)

Related to: #719

Signed-off-by: Sylvain Bellemare <sbellem@gmail.com>
2021-12-07 13:19:54 +08:00
Li, Xun a59e51e223 Linux 2.15.1 Open Source Gold Release
Upgraded to OpenSSL 1.1.1l

Signed-off-by: Li, Xun <xun.li@intel.com>
sgx_2.15.1
2021-11-18 15:30:52 +08:00
lzha101 e6d626d0ba Add SECURITY.md
Signed-off-by: Zhang Lili lili.z.zhang@intel.com
2021-11-10 13:17:26 +08:00
lzha101 8ade0f2297 Update README.md
Fix the broken documentation link.

Signed-off-by: Zhang Lili <lili.z.zhang@intel.com>
sgx_2.15
2021-09-30 14:25:28 +08:00
Zhang Lili 6bb988fd7c Linux 2.15 Open Source Gold Release
Upgraded Intel(R) Integrated Performance Primitives Cryptography library to version 2021 update 3.
Upgraded Intel(R) SGX Architecture Enclaves based on new IPP crypto library.
Added software prevention of fault injection attacks.
Upgraded to GNU Binutils 2.36.1. Stopped providing ld.gold (developers should use ld instead).
Supported Google Protobuf C++.
Enabled C++14 within SGX SDK.
Added SM2/3/4 Samples.
Fixed bugs.

Signed-off-by: Zhang Lili <lili.z.zhang@intel.com>
2021-09-30 00:32:18 +00:00
Li Xun 6b8d2d14d0 Merge pull request #746 from LeoneChen/FixTypo
Fix URL
2021-09-15 14:27:06 +08:00
leone d36736dba0 fix typo 2021-09-07 22:29:18 +08:00
lzha101 8abc6dd8cb Merge pull request #743 from theShmoo/fix-malloc-without-free-#739
fix malloc without free
Signed-off-by: Zhang Lili <lili.z.zhang@intel.com>
2021-08-31 08:40:53 +08:00
David Pfahler f6a7fa2728 fix malloc without free
Signed-off-by: David Pfahler <david@pfahler.at>
2021-08-30 11:15:17 +02:00
lzha101 ca3795bdfb Change some type definitions in pthread. (#738)
Make sure the pthread structures be initialized by PTHREAD_*_INITIALIZER.
Also fix one potential race condition issue.

Signed-off-by: Zhang Lili <lili.z.zhang@intel.com>
2021-08-23 16:25:06 +08:00
Li Xun ebcab67e1e Merge pull request #735 from llly/fix_gcc11
Fix aesm_service optimization issue for GCC11
2021-07-30 13:01:18 +08:00
Li, Xun f97ea5bdb8 Fix optimization issue for GCC11
Tail call optimization breaks __builtin_return_address in aesm_service.
Add -fno-optimize-sibling-calls to an aesm_service source file to disable it.

Signed-off-by: Li, Xun <xun.li@intel.com>
2021-07-26 16:20:41 +08:00