From c0bc40fd5d8464a449ef6592be4a84c00c3e5f34 Mon Sep 17 00:00:00 2001 From: Ammar ELWazir Date: Fri, 20 Oct 2023 00:58:32 +0000 Subject: [PATCH] Fixing Usage of session after free If hsa_shut_down() is not called from the application then we may still have async calls back to the rocprofiler to use session parameters, thats why we need to leak the session up till this is fixed in the ROCR-Runtime Change-Id: Ia8fcdaa859815d88a272296770d702968132e3e6 [ROCm/rocprofiler commit: c9b5d73ca842020ddb70843f175a28e1ea0c38c1] --- projects/rocprofiler/src/tools/tool.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/projects/rocprofiler/src/tools/tool.cpp b/projects/rocprofiler/src/tools/tool.cpp index 1ee84c6d38..c67f569382 100644 --- a/projects/rocprofiler/src/tools/tool.cpp +++ b/projects/rocprofiler/src/tools/tool.cpp @@ -428,9 +428,13 @@ void finish() { rocprofiler::TraceBufferBase::FlushAll(); CHECK_ROCPROFILER(rocprofiler_terminate_session(session_id)); } - if (session_id.handle > 0) { - CHECK_ROCPROFILER(rocprofiler_destroy_session(session_id)); - } + // If hsa_shut_down() is not called from the application then we may still have async calls back + // to the rocprofiler to use session parameters, thats why we need to leak the session up till + // this is fixed in the ROCR-Runtime + + // if (session_id.handle > 0) { + // CHECK_ROCPROFILER(rocprofiler_destroy_session(session_id)); + // } } static bool env_var_search(std::string& s) {