Skip to content

Commit 111a916

Browse files
Yusong-Gaolzha101
authored andcommitted
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>
1 parent 321a658 commit 111a916

File tree

14 files changed

+54
-5
lines changed

14 files changed

+54
-5
lines changed

Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/untrusted/sample.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ static sgx_errlist_t sgx_errlist[] = {
102102
"Can't open enclave file.",
103103
NULL
104104
},
105+
{
106+
SGX_ERROR_MEMORY_MAP_FAILURE,
107+
"Failed to reserve memory for the enclave.",
108+
NULL
109+
},
105110
};
106111

107112
/* Check error conditions for loading enclave */

SampleCode/Cxx11SGXDemo/App/App.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ static sgx_errlist_t sgx_errlist[] = {
132132
"The enclave is signed as product enclave, and can not be created as debuggable enclave.",
133133
NULL
134134
},
135+
{
136+
SGX_ERROR_MEMORY_MAP_FAILURE,
137+
"Failed to reserve memory for the enclave.",
138+
NULL
139+
},
135140
};
136141

137142
/* Check error conditions for loading enclave */

SampleCode/Cxx14SGXDemo/App/App.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ static sgx_errlist_t sgx_errlist[] = {
132132
"The enclave is signed as product enclave, and can not be created as debuggable enclave.",
133133
NULL
134134
},
135+
{
136+
SGX_ERROR_MEMORY_MAP_FAILURE,
137+
"Failed to reserve memory for the enclave.",
138+
NULL
139+
},
135140
};
136141

137142
/* Check error conditions for loading enclave */

SampleCode/PowerTransition/App/ErrorSupport.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ static sgx_errlist_t sgx_errlist[] = {
5151
{SGX_ERROR_OUT_OF_EPC, "Out of EPC memory."},
5252
{SGX_ERROR_NO_DEVICE, "Invalid SGX device."},
5353
{SGX_ERROR_MEMORY_MAP_CONFLICT, "Memory map conflicted."},
54+
{SGX_ERROR_MEMORY_MAP_FAILURE, "Failed to reserve memory for the enclave."},
5455
{SGX_ERROR_INVALID_METADATA, "Invalid encalve metadata."},
5556
{SGX_ERROR_DEVICE_BUSY, "SGX device is busy."},
5657
{SGX_ERROR_INVALID_VERSION, "Enclave metadata version is invalid."},

SampleCode/ProtobufSGXDemo/App/App.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ static sgx_errlist_t sgx_errlist[] = {
132132
"The enclave is signed as product enclave, and can not be created as debuggable enclave.",
133133
NULL
134134
},
135+
{
136+
SGX_ERROR_MEMORY_MAP_FAILURE,
137+
"Failed to reserve memory for the enclave.",
138+
NULL
139+
},
135140
};
136141

137142
/* Check error conditions for loading enclave */

SampleCode/SampleDNNL/App/App.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ static sgx_errlist_t sgx_errlist[] = {
134134
"Can't open enclave file.",
135135
NULL
136136
},
137+
{
138+
SGX_ERROR_MEMORY_MAP_FAILURE,
139+
"Failed to reserve memory for the enclave.",
140+
NULL
141+
},
137142
};
138143

139144
/* Check error conditions for loading enclave */

SampleCode/SampleEnclave/App/App.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ static sgx_errlist_t sgx_errlist[] = {
128128
"Can't open enclave file.",
129129
NULL
130130
},
131+
{
132+
SGX_ERROR_MEMORY_MAP_FAILURE,
133+
"Failed to reserve memory for the enclave.",
134+
NULL
135+
},
131136
};
132137

133138
/* Check error conditions for loading enclave */

SampleCode/SampleEnclaveGMIPP/App/App.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ static sgx_errlist_t sgx_errlist[] = {
129129
"Can't open enclave file.",
130130
NULL
131131
},
132+
{
133+
SGX_ERROR_MEMORY_MAP_FAILURE,
134+
"Failed to reserve memory for the enclave.",
135+
NULL
136+
},
132137
};
133138

134139
/* Check error conditions for loading enclave */

SampleCode/SampleEnclavePCL/App/App.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,11 @@ static sgx_errlist_t sgx_errlist[] = {
158158
"PCL sealed key GUID mismatch.",
159159
NULL
160160
},
161+
{
162+
SGX_ERROR_MEMORY_MAP_FAILURE,
163+
"Failed to reserve memory for the enclave.",
164+
NULL
165+
},
161166
};
162167

163168
/* Check error conditions for loading enclave */

SampleCode/SealUnseal/App/ErrorSupport.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ static sgx_errlist_t sgx_errlist[] = {
5050
{SGX_ERROR_OUT_OF_EPC, "Out of EPC memory."},
5151
{SGX_ERROR_NO_DEVICE, "Invalid SGX device."},
5252
{SGX_ERROR_MEMORY_MAP_CONFLICT, "Memory map conflicted."},
53+
{SGX_ERROR_MEMORY_MAP_FAILURE, "Failed to reserve memory for the enclave."},
5354
{SGX_ERROR_INVALID_METADATA, "Invalid encalve metadata."},
5455
{SGX_ERROR_DEVICE_BUSY, "SGX device is busy."},
5556
{SGX_ERROR_INVALID_VERSION, "Enclave metadata version is invalid."},

0 commit comments

Comments
 (0)