Commit 68a9738a by Jakub Jelinek Committed by Jakub Jelinek

sanitizer.def: Add comment about importance of ordering of BUILT_IN_ASAN_REPORT* builtins.

	* sanitizer.def: Add comment about importance of ordering of
	BUILT_IN_ASAN_REPORT* builtins.
	* cfgcleanup.c (old_insns_match_p): Don't cross-jump __asan_report_*
	builtins.

From-SVN: r194391
parent 2b2571c9
2012-12-11 Jakub Jelinek <jakub@redhat.com> 2012-12-11 Jakub Jelinek <jakub@redhat.com>
* sanitizer.def: Add comment about importance of ordering of
BUILT_IN_ASAN_REPORT* builtins.
* cfgcleanup.c (old_insns_match_p): Don't cross-jump __asan_report_*
builtins.
* sanitizer.def (BUILT_IN_ASAN_HANDLE_NO_RETURN): New builtin. * sanitizer.def (BUILT_IN_ASAN_HANDLE_NO_RETURN): New builtin.
* asan.c (instrument_builtin_call): Change is_gimple_builtin_call * asan.c (instrument_builtin_call): Change is_gimple_builtin_call
gcc_assert to gcc_checking_assert. gcc_assert to gcc_checking_assert.
...@@ -1138,6 +1138,28 @@ old_insns_match_p (int mode ATTRIBUTE_UNUSED, rtx i1, rtx i2) ...@@ -1138,6 +1138,28 @@ old_insns_match_p (int mode ATTRIBUTE_UNUSED, rtx i1, rtx i2)
CALL_INSN_FUNCTION_USAGE (i2)) CALL_INSN_FUNCTION_USAGE (i2))
|| SIBLING_CALL_P (i1) != SIBLING_CALL_P (i2)) || SIBLING_CALL_P (i1) != SIBLING_CALL_P (i2))
return dir_none; return dir_none;
/* For address sanitizer, never crossjump __asan_report_* builtins,
otherwise errors might be reported on incorrect lines. */
if (flag_asan)
{
rtx call = get_call_rtx_from (i1);
if (call && GET_CODE (XEXP (XEXP (call, 0), 0)) == SYMBOL_REF)
{
rtx symbol = XEXP (XEXP (call, 0), 0);
if (SYMBOL_REF_DECL (symbol)
&& TREE_CODE (SYMBOL_REF_DECL (symbol)) == FUNCTION_DECL)
{
if ((DECL_BUILT_IN_CLASS (SYMBOL_REF_DECL (symbol))
== BUILT_IN_NORMAL)
&& DECL_FUNCTION_CODE (SYMBOL_REF_DECL (symbol))
>= BUILT_IN_ASAN_REPORT_LOAD1
&& DECL_FUNCTION_CODE (SYMBOL_REF_DECL (symbol))
<= BUILT_IN_ASAN_REPORT_STORE16)
return dir_none;
}
}
}
} }
#ifdef STACK_REGS #ifdef STACK_REGS
......
...@@ -29,6 +29,8 @@ along with GCC; see the file COPYING3. If not see ...@@ -29,6 +29,8 @@ along with GCC; see the file COPYING3. If not see
/* Address Sanitizer */ /* Address Sanitizer */
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_INIT, "__asan_init", DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_INIT, "__asan_init",
BT_FN_VOID, ATTR_NOTHROW_LEAF_LIST) BT_FN_VOID, ATTR_NOTHROW_LEAF_LIST)
/* Do not reorder the BUILT_IN_ASAN_REPORT* builtins, e.g. cfgcleanup.c
relies on this order. */
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_LOAD1, "__asan_report_load1", DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_LOAD1, "__asan_report_load1",
BT_FN_VOID_PTR, ATTR_NORETURN_NOTHROW_LEAF_LIST) BT_FN_VOID_PTR, ATTR_NORETURN_NOTHROW_LEAF_LIST)
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_LOAD2, "__asan_report_load2", DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_LOAD2, "__asan_report_load2",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment