mirror of
https://github.com/intel/linux-sgx
synced 2026-06-08 14:49:32 +00:00
Merge pull request #215 from deeglaze/sgx_is_enclave_crashed
Adds an API function to check if the enclave has crashed. Signed-off-by: Zhang Lili Z <lili.z.zhang@intel.com>
This commit is contained in:
@@ -74,6 +74,13 @@ int SGXAPI sgx_is_outside_enclave(const void *addr, size_t size);
|
||||
*/
|
||||
sgx_status_t SGXAPI sgx_read_rand(unsigned char *rand, size_t length_in_bytes);
|
||||
|
||||
/* sgx_is_enclave_crashed()
|
||||
* Return Value:
|
||||
* 1 - The global enclave state is crashed.
|
||||
* 0 - The global enclave state is not crashed.
|
||||
*/
|
||||
int SGXAPI sgx_is_enclave_crashed(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
+5
-1
@@ -291,6 +291,11 @@ sgx_status_t sgx_read_rand(unsigned char *rand, size_t length_in_bytes)
|
||||
return SGX_SUCCESS;
|
||||
}
|
||||
|
||||
int sgx_is_enclave_crashed()
|
||||
{
|
||||
return get_enclave_state() == ENCLAVE_CRASHED;
|
||||
}
|
||||
|
||||
extern uintptr_t __stack_chk_guard;
|
||||
int check_static_stack_canary(void *tcs)
|
||||
{
|
||||
@@ -301,4 +306,3 @@ int check_static_stack_canary(void *tcs)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ static void init_stack_guard(void *tcs)
|
||||
|
||||
extern "C" int enter_enclave(int index, void *ms, void *tcs, int cssa)
|
||||
{
|
||||
if(get_enclave_state() == ENCLAVE_CRASHED)
|
||||
if(sgx_is_enclave_crashed())
|
||||
{
|
||||
return SGX_ERROR_ENCLAVE_CRASHED;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user