Skip to content

Commit c00054f

Browse files
committed
LLVM pass: Allow nested ECALLs from OCALLs in EDL file
1 parent a766db3 commit c00054f

File tree

37 files changed

+105
-36
lines changed

37 files changed

+105
-36
lines changed

Diff for: llvm-patches/0001-Add-Enclavization-Pass.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 524a8c60c04c166881065ceb0ea48a30d283f12e Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Tue, 23 Mar 2021 15:17:42 +0000
4-
Subject: [PATCH 01/36] Add Enclavization Pass
4+
Subject: [PATCH 01/37] Add Enclavization Pass
55

66
Moved here from an out-of-tree pass, adjusted to an in-tree pass and
77
edited to work with the legacy Pass Manager (because rucstc uses that

Diff for: llvm-patches/0002-Enclavization-Pass-Fix-typo.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 4c3f864c5e0430b28860f597c5327b800897cf76 Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Tue, 23 Mar 2021 17:01:48 +0000
4-
Subject: [PATCH 02/36] Enclavization Pass: Fix typo
4+
Subject: [PATCH 02/37] Enclavization Pass: Fix typo
55

66
---
77
llvm/include/llvm/Transforms/Utils/Enclavization/Names.h | 2 +-

Diff for: llvm-patches/0003-Enclavization-Pass-Set-DEBUG_TYPE-in-shared-header.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From a8ecd1f0fff5ecd6158e4fd88859cd10a414a25a Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Tue, 23 Mar 2021 17:37:26 +0000
4-
Subject: [PATCH 03/36] Enclavization Pass: Set `DEBUG_TYPE` in shared header
4+
Subject: [PATCH 03/37] Enclavization Pass: Set `DEBUG_TYPE` in shared header
55

66
To make it usable in all sources files.
77
---

Diff for: llvm-patches/0004-Enclavization-Pass-Split-into-two-passes-for-binary-.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From a4b187f9c8a7d287bbffa59af388d75f8092100f Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Fri, 2 Apr 2021 16:21:50 +0000
4-
Subject: [PATCH 04/36] Enclavization Pass: Split into two passes for binary
4+
Subject: [PATCH 04/37] Enclavization Pass: Split into two passes for binary
55
and lib
66

77
Both are supposed to be run on the same code in separate steps. One is

Diff for: llvm-patches/0005-Enclavization-Passes-Use-exception-for-error-handlin.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 919e36314bcfe4af5e5d0d632260729668f3bb71 Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Tue, 6 Apr 2021 07:45:48 +0000
4-
Subject: [PATCH 05/36] Enclavization Passes: Use exception for error handling
4+
Subject: [PATCH 05/37] Enclavization Passes: Use exception for error handling
55

66
LLVM needs to be compiled with `-DLLVM_ENABLE_EH=ON`.
77
---

Diff for: llvm-patches/0006-Enclavization-Pass-Generate-valid-EDL-files.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From bb167294b0dd55ac22a395f1cdf14b342c8e2144 Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Tue, 6 Apr 2021 15:46:39 +0000
4-
Subject: [PATCH 06/36] Enclavization Pass: Generate valid EDL files
4+
Subject: [PATCH 06/37] Enclavization Pass: Generate valid EDL files
55

66
A pointer is either completely `user_check`ed, or not at all.
77
---

Diff for: llvm-patches/0007-Enclavization-Pass-Adjust-name-of-generated-EDL-file.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From e0a04b5e3e559f4f262a2b10a1448adab02fdf86 Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Tue, 6 Apr 2021 15:48:05 +0000
4-
Subject: [PATCH 07/36] Enclavization Pass: Adjust name of generated EDL file
4+
Subject: [PATCH 07/37] Enclavization Pass: Adjust name of generated EDL file
55

66
---
77
llvm/lib/Transforms/Utils/EnclavizationLibPass.cpp | 2 +-

Diff for: llvm-patches/0008-Enclavization-Pass-Make-first-version-of-automatic-e.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 2b1f0a065de3e6b64dfd47c379fe6c28dfb045fe Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Fri, 16 Apr 2021 09:42:12 +0000
4-
Subject: [PATCH 08/36] Enclavization Pass: Make first version of automatic
4+
Subject: [PATCH 08/37] Enclavization Pass: Make first version of automatic
55
enclavization work
66

77
* Differentiate between real and proxy generated postgate declarations

Diff for: llvm-patches/0009-Enclavization-Pass-Add-support-for-structs-to-EDL-ex.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 4c4aec924eaff0544c1fd2a6a1c48f24a760688f Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Fri, 16 Apr 2021 14:59:51 +0000
4-
Subject: [PATCH 09/36] Enclavization Pass: Add support for structs to EDL
4+
Subject: [PATCH 09/37] Enclavization Pass: Add support for structs to EDL
55
export
66

77
---

Diff for: llvm-patches/0010-Enclavization-Pass-Declare-all-pointers-as-user_chec.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From cb6dd29b839d581b4f3cb7efba1202aab3dd73c2 Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Tue, 20 Apr 2021 11:38:34 +0000
4-
Subject: [PATCH 10/36] Enclavization Pass: Declare all pointers as
4+
Subject: [PATCH 10/37] Enclavization Pass: Declare all pointers as
55
`user_check` in EDL file
66

77
Letting the Intel bridges handle just one layer of pointers (but no deep

Diff for: llvm-patches/0011-Enclavization-Pass-Insert-runtime-checks-for-args-an.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 3fba78a2e2293501d552de579df05f16ce9d8c4a Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Tue, 20 Apr 2021 15:47:49 +0000
4-
Subject: [PATCH 11/36] Enclavization Pass: Insert runtime checks for args and
4+
Subject: [PATCH 11/37] Enclavization Pass: Insert runtime checks for args and
55
return values
66

77
---

Diff for: llvm-patches/0012-Enclavization-Pass-Add-support-for-LLVM-integers-wid.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From d833e0081c795f298e5abb9781cc246c2d25137d Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Fri, 23 Apr 2021 09:32:02 +0000
4-
Subject: [PATCH 12/36] Enclavization Pass: Add support for LLVM integers wider
4+
Subject: [PATCH 12/37] Enclavization Pass: Add support for LLVM integers wider
55
than the ones regularly supported
66

77
---

Diff for: llvm-patches/0013-Enclavization-Pass-Add-support-for-LLVM-type-i1-bool.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From e6edd2e4a3a27e389a810c59b38e8eff161d61ad Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Tue, 11 May 2021 08:53:42 +0000
4-
Subject: [PATCH 13/36] Enclavization Pass: Add support for LLVM type i1/bool
4+
Subject: [PATCH 13/37] Enclavization Pass: Add support for LLVM type i1/bool
55
to EDL files
66

77
---

Diff for: llvm-patches/0014-Enclavization-Pass-Add-support-to-convert-filesystem.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 089f931650360ba4f232eb83beb5b302427f2314 Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Tue, 11 May 2021 08:56:27 +0000
4-
Subject: [PATCH 14/36] Enclavization Pass: Add support to convert filesystem
4+
Subject: [PATCH 14/37] Enclavization Pass: Add support to convert filesystem
55
operations to sgxfs
66

77
---

Diff for: llvm-patches/0015-Enclavization-Pass-Add-calls-for-automatic-IO-Result.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 62253db9ccfcd9e7b69c1ace0a78c6b894145241 Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Wed, 12 May 2021 14:09:29 +0000
4-
Subject: [PATCH 15/36] Enclavization Pass: Add calls for automatic IO Result
4+
Subject: [PATCH 15/37] Enclavization Pass: Add calls for automatic IO Result
55
transformation
66
MIME-Version: 1.0
77
Content-Type: text/plain; charset=UTF-8

Diff for: llvm-patches/0016-Enclavization-Pass-Update-mangled-names.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 766269a3a982e2acdc84dfb676d16e7043fd313b Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Wed, 12 May 2021 14:10:43 +0000
4-
Subject: [PATCH 16/36] Enclavization Pass: Update mangled names
4+
Subject: [PATCH 16/37] Enclavization Pass: Update mangled names
55

66
---
77
llvm/lib/Transforms/Utils/Enclavization/EnclaveModify.cpp | 8 ++++----

Diff for: llvm-patches/0017-Enclavization-Pass-Refactor-main-pass-files.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 3875450a11b0a54061b35e75ea6b404ee52e5169 Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Thu, 13 May 2021 13:07:18 +0000
4-
Subject: [PATCH 17/36] Enclavization Pass: Refactor main pass files
4+
Subject: [PATCH 17/37] Enclavization Pass: Refactor main pass files
55

66
The main change is that EnclavizationLibPass will generate its list of
77
functions to wrap directly from a module's functions, not through calls.

Diff for: llvm-patches/0018-Enclavization-Pass-Redesign-output-and-error-handlin.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 3440cb9881df2ac438b32ab071963ac72cea12c9 Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Fri, 14 May 2021 11:48:34 +0000
4-
Subject: [PATCH 18/36] Enclavization Pass: Redesign output and error handling
4+
Subject: [PATCH 18/37] Enclavization Pass: Redesign output and error handling
55

66
* Don't use exceptions, since the Rust compiler handles them badly. Use
77
assertions instead, as we actually already rely on them being enabled

Diff for: llvm-patches/0019-Fix-copy-paste-oversights.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 3cda9875737491481846dbeb2454c9456d3725d9 Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Mon, 17 May 2021 11:19:15 +0000
4-
Subject: [PATCH 19/36] Fix copy/paste oversights
4+
Subject: [PATCH 19/37] Fix copy/paste oversights
55

66
---
77
llvm/lib/Transforms/Utils/Enclavization/EnclaveModify.cpp | 4 ++--

Diff for: llvm-patches/0020-Enclavization-Pass-Fix-critical-typo-preventing-encl.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From f2c2768d0949c8e5f2961a556a89e986ac2b579e Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Mon, 17 May 2021 11:35:06 +0000
4-
Subject: [PATCH 20/36] Enclavization Pass: Fix critical typo preventing
4+
Subject: [PATCH 20/37] Enclavization Pass: Fix critical typo preventing
55
enclavization
66

77
This was... bad.

Diff for: llvm-patches/0021-Enclavization-Pass-Insert-SGX-usage-for-OpenOptions-.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 801d2f4b51e0dad27d8f2febfae4a8b6e9a5fdd2 Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Mon, 17 May 2021 15:41:17 +0000
4-
Subject: [PATCH 21/36] Enclavization Pass: Insert SGX usage for
4+
Subject: [PATCH 21/37] Enclavization Pass: Insert SGX usage for
55
OpenOptions::write() and Read::read_to_end()
66

77
---

Diff for: llvm-patches/0022-Enclavization-Pass-Remove-obsolete-hack-for-EDL-file.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 98801ecf23270afe6e6faac92e6cfeece4e943b9 Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Tue, 18 May 2021 10:36:02 +0000
4-
Subject: [PATCH 22/36] Enclavization Pass: Remove obsolete hack for EDL file
4+
Subject: [PATCH 22/37] Enclavization Pass: Remove obsolete hack for EDL file
55
generation
66

77
The comment about safety does not apply anymore, since our Postgate

Diff for: llvm-patches/0023-Enclavization-Pass-Fix-casing-for-helper-function-na.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From d954ce2237e81687fdb484a1474c7356df8d1488 Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Tue, 18 May 2021 10:40:37 +0000
4-
Subject: [PATCH 23/36] Enclavization Pass: Fix casing for helper function name
4+
Subject: [PATCH 23/37] Enclavization Pass: Fix casing for helper function name
55

66
---
77
llvm/include/llvm/Transforms/Utils/Enclavization/Support.h | 2 +-

Diff for: llvm-patches/0024-Update-mangled-names.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 9f5ff985d768693f5fedc7277c94b6c69eb010f4 Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Tue, 18 May 2021 17:57:56 +0000
4-
Subject: [PATCH 24/36] Update mangled names
4+
Subject: [PATCH 24/37] Update mangled names
55

66
---
77
.../Transforms/Utils/Enclavization/EnclaveModify.cpp | 10 +++++-----

Diff for: llvm-patches/0025-Enclavization-Pass-Add-support-for-untrusted-functio.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From cc9581f8e19bc4ad7a27a94de67af31cb1861f24 Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Tue, 18 May 2021 17:58:48 +0000
4-
Subject: [PATCH 25/36] Enclavization Pass: Add support for untrusted functions
4+
Subject: [PATCH 25/37] Enclavization Pass: Add support for untrusted functions
55
to EDL file export
66

77
---

Diff for: llvm-patches/0026-Enclavization-Pass-Add-support-for-reverse-gates.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 5da59532824291e48306dd1e254af297e393cfbc Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Tue, 18 May 2021 18:00:41 +0000
4-
Subject: [PATCH 26/36] Enclavization Pass: Add support for reverse gates
4+
Subject: [PATCH 26/37] Enclavization Pass: Add support for reverse gates
55

66
(i.e. untrusted functions, i.e. OCALLs)
77
---

Diff for: llvm-patches/0027-Enclavization-Pass-Fix-EDL-file-export-for-reverse-g.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 9dec692c3390434d376bf839e2e6d6e32f3f2af0 Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Wed, 19 May 2021 14:31:12 +0000
4-
Subject: [PATCH 27/36] Enclavization Pass: Fix EDL file export for reverse
4+
Subject: [PATCH 27/37] Enclavization Pass: Fix EDL file export for reverse
55
gates
66

77
---

Diff for: llvm-patches/0028-Enclavization-Pass-Insert-pointer-checks-in-reverse-.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 01ebbe68bda7de472af9d6371ac3e210cca1e619 Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Wed, 19 May 2021 16:43:04 +0000
4-
Subject: [PATCH 28/36] Enclavization Pass: Insert pointer checks in reverse
4+
Subject: [PATCH 28/37] Enclavization Pass: Insert pointer checks in reverse
55
gates
66

77
---

Diff for: llvm-patches/0029-Enclavization-Pass-Do-not-adopt-dereferencable-attri.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 05fac54e18b2d7de103daaefe81461b77291c499 Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Fri, 21 May 2021 14:02:00 +0000
4-
Subject: [PATCH 29/36] Enclavization Pass: Do not adopt `dereferencable`
4+
Subject: [PATCH 29/37] Enclavization Pass: Do not adopt `dereferencable`
55
attributes for `sret` arguments
66

77
This could not work, since the attribute is valid for the original

Diff for: llvm-patches/0030-Enclavization-Pass-Implement-memory-copies-in-postca.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 4d8157519b6eedd91b620d1e6b09e3ba9d6edb2e Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Mon, 28 Jun 2021 20:23:56 +0000
4-
Subject: [PATCH 30/36] Enclavization Pass: Implement memory copies in postcall
4+
Subject: [PATCH 30/37] Enclavization Pass: Implement memory copies in postcall
55
functions
66

77
---

Diff for: llvm-patches/0031-Enclavization-Pass-Do-not-copy-sret-style-pointers-r.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From ab6acb114a00edda0f8c2f322689e7dd765aa0f9 Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Tue, 29 Jun 2021 10:14:58 +0000
4-
Subject: [PATCH 31/36] Enclavization Pass: Do not copy `sret`-style pointers
4+
Subject: [PATCH 31/37] Enclavization Pass: Do not copy `sret`-style pointers
55
recursively
66

77
Their pointer targets may be unintialized at first.

Diff for: llvm-patches/0032-Enclavization-Pass-Make-enclave-modifications-work-w.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 37851a4efb9712434b66e80c443db29af5752857 Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Wed, 30 Jun 2021 11:56:19 +0000
4-
Subject: [PATCH 32/36] Enclavization Pass: Make enclave modifications work
4+
Subject: [PATCH 32/37] Enclavization Pass: Make enclave modifications work
55
with non-debug Rust builds
66

77
---

Diff for: llvm-patches/0033-Enclavization-Pass-Use-wrappers-instead-of-mangled-n.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 650d0cd60a154f2cc9ad2b63a555211cafbdb6dd Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Wed, 30 Jun 2021 13:07:20 +0000
4-
Subject: [PATCH 33/36] Enclavization Pass: Use wrappers instead of mangled
4+
Subject: [PATCH 33/37] Enclavization Pass: Use wrappers instead of mangled
55
names in enclave modifications
66

77
---

Diff for: llvm-patches/0034-Enclavization-Pass-Implement-memory-copies-in-revers.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From ecbf4f3cb3d6679b93e53e06b1a6d23c72311ad9 Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Wed, 21 Jul 2021 20:09:33 +0000
4-
Subject: [PATCH 34/36] Enclavization Pass: Implement memory copies in reverse
4+
Subject: [PATCH 34/37] Enclavization Pass: Implement memory copies in reverse
55
pregate functions
66

77
---

Diff for: llvm-patches/0035-Enclavization-Pass-Add-missing-debug-output.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From d227d495f4c9ca185a52e8696547713511152ca8 Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Wed, 18 Aug 2021 19:04:01 +0000
4-
Subject: [PATCH 35/36] Enclavization Pass: Add missing debug output
4+
Subject: [PATCH 35/37] Enclavization Pass: Add missing debug output
55

66
Probably an oversight that this hasn't been committed before.
77
---

Diff for: llvm-patches/0036-Add-commented-out-debug-output-for-IR-code.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From aa45190a65158224cc4f3152ceedc92328bfe19c Mon Sep 17 00:00:00 2001
22
From: Felix Dreissig <[email protected]>
33
Date: Wed, 18 Aug 2021 19:39:19 +0000
4-
Subject: [PATCH 36/36] Add (commented-out) debug output for IR code
4+
Subject: [PATCH 36/37] Add (commented-out) debug output for IR code
55

66
Document what I used for debugging.
77
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
From d7d9055a8cf089f0a93caafa73699a9338b53bfc Mon Sep 17 00:00:00 2001
2+
From: Felix Dreissig <[email protected]>
3+
Date: Fri, 20 Aug 2021 13:24:50 +0000
4+
Subject: [PATCH 37/37] Enclavization Pass: Allow nested ECALLs from OCALLs in
5+
EDL file
6+
7+
---
8+
.../llvm/Transforms/Utils/Enclavization/Export.h | 1 +
9+
llvm/lib/Transforms/Utils/Enclavization/Export.cpp | 12 +++++++++++-
10+
2 files changed, 12 insertions(+), 1 deletion(-)
11+
12+
diff --git a/llvm/include/llvm/Transforms/Utils/Enclavization/Export.h b/llvm/include/llvm/Transforms/Utils/Enclavization/Export.h
13+
index 1c9e92316dfc..2e3f5d4e99f5 100644
14+
--- a/llvm/include/llvm/Transforms/Utils/Enclavization/Export.h
15+
+++ b/llvm/include/llvm/Transforms/Utils/Enclavization/Export.h
16+
@@ -32,6 +32,7 @@ class EdlFile {
17+
std::vector<std::string> structs;
18+
std::unordered_set<unsigned int> wideInts;
19+
std::vector<std::string> trustedFuncs;
20+
+ std::vector<std::string> trustedFuncNames;
21+
std::vector<std::string> untrustedFuncs;
22+
};
23+
24+
diff --git a/llvm/lib/Transforms/Utils/Enclavization/Export.cpp b/llvm/lib/Transforms/Utils/Enclavization/Export.cpp
25+
index 0b103e65b02e..a4996c2da164 100644
26+
--- a/llvm/lib/Transforms/Utils/Enclavization/Export.cpp
27+
+++ b/llvm/lib/Transforms/Utils/Enclavization/Export.cpp
28+
@@ -51,12 +51,21 @@ void EdlFile::writeFile() {
29+
for (auto entry : trustedFuncs) {
30+
fstream << "public ";
31+
fstream << entry;
32+
+ fstream << ";\n";
33+
}
34+
fstream << "};\n";
35+
36+
fstream << "untrusted {\n";
37+
for (auto entry : untrustedFuncs) {
38+
fstream << entry;
39+
+ fstream << " allow (";
40+
+ for (size_t i = 0; i < trustedFuncNames.size(); ++i) {
41+
+ fstream << trustedFuncNames[i];
42+
+ if (i != trustedFuncNames.size() - 1){
43+
+ fstream << ", ";
44+
+ }
45+
+ }
46+
+ fstream << ");\n";
47+
}
48+
fstream << "};\n";
49+
50+
@@ -114,6 +123,7 @@ std::string EdlFile::addWideInt(unsigned int width) {
51+
52+
void EdlFile::addTrustedFunction(Function *postgateFunc) {
53+
addFunction(postgateFunc, trustedFuncs);
54+
+ trustedFuncNames.push_back(postgateFunc->getName().str());
55+
}
56+
57+
void EdlFile::addUntrustedFunction(Function *func) {
58+
@@ -146,7 +156,7 @@ void EdlFile::addFunction(llvm::Function *func, std::vector<std::string> &target
59+
entryStream << edlType << " arg" << i;
60+
}
61+
62+
- entryStream << ");\n";
63+
+ entryStream << ")";
64+
65+
target.push_back(funcEntry);
66+
}
67+
--
68+
2.25.1
69+

0 commit comments

Comments
 (0)