From: Giridhar Trivedi Date: Mon, 10 Jul 2023 14:17:11 +0000 (+0530) Subject: Fix crash happening due to invalid pointer to free() (#86868) X-Git-Tag: accepted/tizen/unified/riscv/20231226.055536~1157 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=228a59662e2f6149d1ea7b230bd52023dd6259c9;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Fix crash happening due to invalid pointer to free() (#86868) While working on netcore debugger for mono,the crash was happening. This crash was due to an invalid pointer to the free(). Valgrind was showing the traces of mismatch between the new() and delete(). After debugging the issue, even though hidden flag was set on shared library the objdump on the shared library showed that the overloaded new() operator was taken from a local scoped library but overloaded delete() operator was overidden by defaults setting of underlying system libraries in which delete() was hosted. Changed the fvisibility flag to ensure that clang picks up the local new() and delete() overloaded operators. Co-authored-by: Giridhar Trivedi --- diff --git a/src/mono/dlls/mscordbi/CMakeLists.txt b/src/mono/dlls/mscordbi/CMakeLists.txt index 2cae447..52b4e62 100644 --- a/src/mono/dlls/mscordbi/CMakeLists.txt +++ b/src/mono/dlls/mscordbi/CMakeLists.txt @@ -13,6 +13,9 @@ set(CMAKE_EXE_LINKER_FLAGS_CHECKED "") set(CMAKE_SHARED_LINKER_FLAGS_CHECKED "") set(CLR_CMAKE_HOST_ARCH ${CMAKE_GENERATOR_PLATFORM}) set(FEATURE_EVENT_TRACE 0) +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_definitions(-fvisibility-global-new-delete-hidden) +endif() if(HOST_WIN32) if(HOST_X86)