summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kazmin <a.kazmin@partner.samsung.com>2020-04-14 09:12:13 (GMT)
committerAndrey Kazmin <a.kazmin@partner.samsung.com>2020-05-07 09:37:43 (GMT)
commit95bd392c0e11710bb0c6a179b1a606c6f8c969f5 (patch)
tree67ef72b16b2f82703b6e1668f5f532fa84fa4045
parent9df87a133b0f29f4932f38b7307c87d09ab80d5d (diff)
downloadcoreclr-sandbox/akazmin/asan_annotate_buff.zip
coreclr-sandbox/akazmin/asan_annotate_buff.tar.gz
coreclr-sandbox/akazmin/asan_annotate_buff.tar.bz2
Annotate CLR to native buffers for ASan runtimesandbox/akazmin/asan_annotate_buff
Signed-off-by: Andrey Kazmin <a.kazmin@partner.samsung.com>
-rw-r--r--src/pal/src/memory/local.cpp32
-rw-r--r--src/vm/ilmarshalers.cpp3
2 files changed, 33 insertions, 2 deletions
diff --git a/src/pal/src/memory/local.cpp b/src/pal/src/memory/local.cpp
index 3a0f40f..9fba1d1 100644
--- a/src/pal/src/memory/local.cpp
+++ b/src/pal/src/memory/local.cpp
@@ -26,6 +26,14 @@ Revision History:
SET_DEFAULT_DEBUG_CHANNEL(MEM);
+#ifdef TIZEN_ASAN_ENVIRONMENT
+extern "C" {
+extern void __sanitizer_disable_interceptors() __attribute__ ((weak));
+extern void __sanitizer_enable_interceptors() __attribute__ ((weak));
+extern bool __sanitizer_interceptors_are_enabled() __attribute__ ((weak));
+}
+#endif
+
static
int
AllocFlagsToHeapAllocFlags (IN UINT AllocFlags,
@@ -70,7 +78,18 @@ LocalAlloc(
goto done;
}
+#ifdef TIZEN_ASAN_ENVIRONMENT
+ _ASSERTE(__sanitizer_interceptors_are_enabled != NULL);
+ bool san_enabled;
+ san_enabled = __sanitizer_interceptors_are_enabled();
+ if (!san_enabled)
+ __sanitizer_enable_interceptors();
+ lpRetVal = HeapAlloc( GetProcessHeap(), uFlags, uBytes );
+ if (!san_enabled)
+ __sanitizer_disable_interceptors();
+#else
lpRetVal = HeapAlloc( GetProcessHeap(), uFlags, uBytes );
+#endif
done:
LOGEXIT( "LocalAlloc returning %p.\n", lpRetVal );
@@ -128,7 +147,18 @@ LocalFree(
if ( hMem )
{
- bRetVal = HeapFree( GetProcessHeap(), 0, hMem );
+#ifdef TIZEN_ASAN_ENVIRONMENT
+ _ASSERTE(__sanitizer_interceptors_are_enabled != NULL);
+ bool san_enabled;
+ san_enabled = __sanitizer_interceptors_are_enabled();
+ if (!san_enabled)
+ __sanitizer_enable_interceptors();
+ bRetVal = HeapFree( GetProcessHeap(), 0, hMem );
+ if (!san_enabled)
+ __sanitizer_disable_interceptors();
+#else
+ bRetVal = HeapFree( GetProcessHeap(), 0, hMem );
+#endif
}
else
{
diff --git a/src/vm/ilmarshalers.cpp b/src/vm/ilmarshalers.cpp
index a89aeaf..9e7ee17 100644
--- a/src/vm/ilmarshalers.cpp
+++ b/src/vm/ilmarshalers.cpp
@@ -3808,11 +3808,12 @@ void ILMngdMarshaler::EmitCallMngdMarshalerMethod(ILCodeStream* pslILEmit, Metho
bool ILNativeArrayMarshaler::UsePinnedArraySpecialCase()
{
+#ifndef TIZEN_ASAN_ENVIRONMENT
if (IsCLRToNative(m_dwMarshalFlags) && !IsByref(m_dwMarshalFlags) && (NULL != m_pargs->na.m_pArrayMT) && (NULL == OleVariant::GetMarshalerForVarType(m_pargs->na.m_vt, TRUE)))
{
return true;
}
-
+#endif
return false;
}