Bug 1252072 - Prevent ASan instrumentation for unsafe xpcom functions. r=froydnj
MozReview-Commit-ID: 5k2RAVPlcAI
--- a/xpcom/reflect/xptcall/md/unix/xptcinvoke_arm.cpp
+++ b/xpcom/reflect/xptcall/md/unix/xptcinvoke_arm.cpp
@@ -108,16 +108,17 @@ invoke_copy_to_stack(uint32_t* stk, uint
*((void**)d) = s->val.p;
break;
}
}
}
typedef nsresult (*vtable_func)(nsISupports *, uint32_t, uint32_t, uint32_t);
+MOZ_ASAN_BLACKLIST
EXPORT_XPCOM_API(nsresult)
NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
uint32_t paramCount, nsXPTCVariant* params)
{
/* This is to call a given method of class that.
* The parameters are in params, the number is in paramCount.
* The routine will issue calls to count the number of words
--- a/xpcom/reflect/xptcall/md/unix/xptcinvoke_linux_s390.cpp
+++ b/xpcom/reflect/xptcall/md/unix/xptcinvoke_linux_s390.cpp
@@ -165,16 +165,17 @@ invoke_copy_to_stack(uint32_t paramCount
*((void**) d_ov ) = s->val.p, d_ov++;
break;
}
}
}
typedef nsresult (*vtable_func)(nsISupports *, uint32_t, uint32_t, uint32_t, uint32_t, double, double);
+MOZ_ASAN_BLACKLIST
EXPORT_XPCOM_API(nsresult)
NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
uint32_t paramCount, nsXPTCVariant* params)
{
vtable_func *vtable = *reinterpret_cast<vtable_func **>(that);
vtable_func method = vtable[methodIndex];
uint32_t overflow = invoke_count_words (paramCount, params);
uint32_t *stack_space = reinterpret_cast<uint32_t *>(__builtin_alloca((overflow + 8 /* 4 32-bits gpr + 2 64-bits fpr */) * 4));
--- a/xpcom/reflect/xptcall/md/unix/xptcinvoke_linux_s390x.cpp
+++ b/xpcom/reflect/xptcall/md/unix/xptcinvoke_linux_s390x.cpp
@@ -159,16 +159,17 @@ invoke_copy_to_stack(uint32_t paramCount
*((void**) d_ov ) = s->val.p, d_ov++;
break;
}
}
}
typedef nsresult (*vtable_func)(nsISupports *, uint64_t, uint64_t, uint64_t, uint64_t, double, double, double, double);
+MOZ_ASAN_BLACKLIST
EXPORT_XPCOM_API(nsresult)
NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
uint32_t paramCount, nsXPTCVariant* params)
{
vtable_func *vtable = *reinterpret_cast<vtable_func **>(that);
vtable_func method = vtable[methodIndex];
uint64_t overflow = invoke_count_words (paramCount, params);
uint64_t *stack_space = reinterpret_cast<uint64_t *>(__builtin_alloca((overflow + 8 /* 4 64-bits gpr + 4 64-bits fpr */) * 8));
--- a/xpcom/reflect/xptcall/md/unix/xptcinvoke_x86_64_solaris.cpp
+++ b/xpcom/reflect/xptcall/md/unix/xptcinvoke_x86_64_solaris.cpp
@@ -95,16 +95,17 @@ invoke_copy_to_stack(uint64_t * d, uint3
if (nr_gpr < GPR_COUNT)
gpregs[nr_gpr++] = value;
else
*d++ = value;
}
}
}
+MOZ_ASAN_BLACKLIST
EXPORT_XPCOM_API(nsresult)
NS_InvokeByIndex(nsISupports * that, uint32_t methodIndex,
uint32_t paramCount, nsXPTCVariant * params)
{
uint32_t nr_gpr, nr_fpr, nr_stack;
invoke_count_words(paramCount, params, nr_gpr, nr_fpr, nr_stack);
// Stack, if used, must be 16-bytes aligned
--- a/xpcom/reflect/xptcall/md/unix/xptcinvoke_x86_64_unix.cpp
+++ b/xpcom/reflect/xptcall/md/unix/xptcinvoke_x86_64_unix.cpp
@@ -108,16 +108,17 @@ invoke_copy_to_stack(uint64_t * d, uint3
// 32-byte alignment instead of 16-byte). This seems to be the best
// available workaround, given that this code, which should perhaps
// better be written in assembly, is written in C++.
#ifndef __clang__
#pragma GCC push_options
#pragma GCC target ("no-avx")
#endif
+MOZ_ASAN_BLACKLIST
EXPORT_XPCOM_API(nsresult)
NS_InvokeByIndex(nsISupports * that, uint32_t methodIndex,
uint32_t paramCount, nsXPTCVariant * params)
{
uint32_t nr_stack;
invoke_count_words(paramCount, params, nr_stack);
// Stack, if used, must be 16-bytes aligned