diff --git a/0079-Optimize-the-registration-shared-memory.patch b/0079-Optimize-the-registration-shared-memory.patch index f1c9341bf1c2d2c9879eab20acaee39f32592cc7..9d9efa59ffed79327365588b56f665bc028628a1 100644 --- a/0079-Optimize-the-registration-shared-memory.patch +++ b/0079-Optimize-the-registration-shared-memory.patch @@ -189,8 +189,37 @@ index 861cea7..b7f886a 100644 /* * Summary: Frees the memory space pointed to by ptr, which must have been returned by sgx_malloc_shared_memory. --- -2.27.0 +diff --git a/src/enclave_src/gp/gp.c b/src/enclave_src/gp/gp.c +index 3f30a16..4f3c3b2 100644 +--- a/src/enclave_src/gp/gp.c ++++ b/src/enclave_src/gp/gp.c +@@ -69,6 +69,13 @@ TEE_Result TA_OpenSessionEntryPoint(uint32_t paramTypes, + TEE_Result ret = TEE_SUCCESS; + SLogTrace("---- TA_OpenSessionEntryPoint -------- "); + ++ uint32_t param_in = 0; ++ uint32_t param_shared_mem = 1; ++ if (TEE_PARAM_TYPE_GET(paramTypes, param_shared_mem) == TEE_PARAM_TYPE_MEMREF_REGISTER_INOUT) { ++ ret = register_shared_memory_by_session(params[param_in].memref.buffer, ++ params[param_shared_mem].memref.buffer, sessionContext); ++ tlogi("[secGear]TA_OpenSessionEntryPoint register shared memory ret:%d, shared_mem:%p", ret, *sessionContext); ++ } + return ret; + } + +@@ -83,6 +90,12 @@ void TA_CloseSessionEntryPoint(void *sessionContext) + { + (void)sessionContext; /* -Wunused-parameter */ + SLogTrace("---- TA_CloseSessionEntryPoint ----- "); ++ ++ // find shared mem block by session, and destroy ++ if (sessionContext != NULL) { ++ tlogi("[secGear]TA_CloseSessionEntryPoint unregister shared_mem:%p", sessionContext); ++ open_session_unregister_shared_memory(sessionContext); ++ } + } + + /** -- 2.27.0 diff --git a/secGear.spec b/secGear.spec index deebcafab9fde6cc5af6b83e5e0539009134cfdb..4e4f0ff54ba4e6b27ddf392b5160e1de6794c521 100644 --- a/secGear.spec +++ b/secGear.spec @@ -1,6 +1,6 @@ Name: secGear Version: 0.1.0 -Release: 48 +Release: 49 Summary: secGear is an SDK to develop confidential computing apps based on hardware enclave features @@ -220,6 +220,9 @@ popd systemctl restart rsyslog %changelog +* Tue Aug 20 2024 zhengxiaoxiao - 0.1.0-49 +- fix 0079-Optimize-the-registration-shared-memory.patch + * Tue Aug 20 2024 zhengxiaoxiao - 0.1.0-48 - Optimize the registration shared memory