Enable -fsanitize-recover for KASan.
2014-10-28 Yury Gribov <y.gribov@samsung.com> gcc/ * asan.c (report_error_func): Add noabort path. (check_func): Ditto. Formatting. (asan_expand_check_ifn): Handle noabort path. * common.opt (flag_sanitize_recover): Add SANITIZE_KERNEL_ADDRESS to default value. * doc/invoke.texi (-fsanitize-recover=): Mention KASan. * opts.c (finish_options): Reword comment. * sanitizer.def: Add noabort ASan builtins. gcc/testsuite/ * c-c++-common/asan/kasan-recover-1.c: New test. * c-c++-common/asan/kasan-recover-2.c: New test. * c-c++-common/asan/instrument-with-calls-1.c: Get rid of -save-temps. * c-c++-common/asan/instrument-with-calls-2.c: Likewise. * c-c++-common/asan/instrument-with-calls-3.c: Likewise. * c-c++-common/asan/kasan-recover-1.c: Likewise. * c-c++-common/asan/kasan-recover-2.c: Likewise. * c-c++-common/asan/no-asan-globals.c: Likewise. * c-c++-common/asan/no-instrument-reads.c: Likewise. * c-c++-common/asan/no-instrument-writes.c: Likewise. * c-c++-common/asan/no-use-after-return.c: Likewise. From-SVN: r216778
This commit is contained in:
parent
fd960af2df
commit
fed4de37b8
@ -1,3 +1,14 @@
|
|||||||
|
2014-10-28 Yury Gribov <y.gribov@samsung.com>
|
||||||
|
|
||||||
|
* asan.c (report_error_func): Add noabort path.
|
||||||
|
(check_func): Ditto. Formatting.
|
||||||
|
(asan_expand_check_ifn): Handle noabort path.
|
||||||
|
* common.opt (flag_sanitize_recover): Add SANITIZE_KERNEL_ADDRESS
|
||||||
|
to default value.
|
||||||
|
* doc/invoke.texi (-fsanitize-recover=): Mention KASan.
|
||||||
|
* opts.c (finish_options): Reword comment.
|
||||||
|
* sanitizer.def: Add noabort ASan builtins.
|
||||||
|
|
||||||
2014-10-28 Yury Gribov <y.gribov@samsung.com>
|
2014-10-28 Yury Gribov <y.gribov@samsung.com>
|
||||||
|
|
||||||
* asan.c (set_asan_shadow_offset): New function.
|
* asan.c (set_asan_shadow_offset): New function.
|
||||||
|
77
gcc/asan.c
77
gcc/asan.c
@ -1392,44 +1392,72 @@ asan_protect_global (tree decl)
|
|||||||
IS_STORE is either 1 (for a store) or 0 (for a load). */
|
IS_STORE is either 1 (for a store) or 0 (for a load). */
|
||||||
|
|
||||||
static tree
|
static tree
|
||||||
report_error_func (bool is_store, HOST_WIDE_INT size_in_bytes, int *nargs)
|
report_error_func (bool is_store, bool recover_p, HOST_WIDE_INT size_in_bytes,
|
||||||
|
int *nargs)
|
||||||
{
|
{
|
||||||
static enum built_in_function report[2][6]
|
static enum built_in_function report[2][2][6]
|
||||||
= { { BUILT_IN_ASAN_REPORT_LOAD1, BUILT_IN_ASAN_REPORT_LOAD2,
|
= { { { BUILT_IN_ASAN_REPORT_LOAD1, BUILT_IN_ASAN_REPORT_LOAD2,
|
||||||
BUILT_IN_ASAN_REPORT_LOAD4, BUILT_IN_ASAN_REPORT_LOAD8,
|
BUILT_IN_ASAN_REPORT_LOAD4, BUILT_IN_ASAN_REPORT_LOAD8,
|
||||||
BUILT_IN_ASAN_REPORT_LOAD16, BUILT_IN_ASAN_REPORT_LOAD_N },
|
BUILT_IN_ASAN_REPORT_LOAD16, BUILT_IN_ASAN_REPORT_LOAD_N },
|
||||||
{ BUILT_IN_ASAN_REPORT_STORE1, BUILT_IN_ASAN_REPORT_STORE2,
|
{ BUILT_IN_ASAN_REPORT_STORE1, BUILT_IN_ASAN_REPORT_STORE2,
|
||||||
BUILT_IN_ASAN_REPORT_STORE4, BUILT_IN_ASAN_REPORT_STORE8,
|
BUILT_IN_ASAN_REPORT_STORE4, BUILT_IN_ASAN_REPORT_STORE8,
|
||||||
BUILT_IN_ASAN_REPORT_STORE16, BUILT_IN_ASAN_REPORT_STORE_N } };
|
BUILT_IN_ASAN_REPORT_STORE16, BUILT_IN_ASAN_REPORT_STORE_N } },
|
||||||
|
{ { BUILT_IN_ASAN_REPORT_LOAD1_NOABORT,
|
||||||
|
BUILT_IN_ASAN_REPORT_LOAD2_NOABORT,
|
||||||
|
BUILT_IN_ASAN_REPORT_LOAD4_NOABORT,
|
||||||
|
BUILT_IN_ASAN_REPORT_LOAD8_NOABORT,
|
||||||
|
BUILT_IN_ASAN_REPORT_LOAD16_NOABORT,
|
||||||
|
BUILT_IN_ASAN_REPORT_LOAD_N_NOABORT },
|
||||||
|
{ BUILT_IN_ASAN_REPORT_STORE1_NOABORT,
|
||||||
|
BUILT_IN_ASAN_REPORT_STORE2_NOABORT,
|
||||||
|
BUILT_IN_ASAN_REPORT_STORE4_NOABORT,
|
||||||
|
BUILT_IN_ASAN_REPORT_STORE8_NOABORT,
|
||||||
|
BUILT_IN_ASAN_REPORT_STORE16_NOABORT,
|
||||||
|
BUILT_IN_ASAN_REPORT_STORE_N_NOABORT } } };
|
||||||
if (size_in_bytes == -1)
|
if (size_in_bytes == -1)
|
||||||
{
|
{
|
||||||
*nargs = 2;
|
*nargs = 2;
|
||||||
return builtin_decl_implicit (report[is_store][5]);
|
return builtin_decl_implicit (report[recover_p][is_store][5]);
|
||||||
}
|
}
|
||||||
*nargs = 1;
|
*nargs = 1;
|
||||||
return builtin_decl_implicit (report[is_store][exact_log2 (size_in_bytes)]);
|
int size_log2 = exact_log2 (size_in_bytes);
|
||||||
|
return builtin_decl_implicit (report[recover_p][is_store][size_log2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Construct a function tree for __asan_{load,store}{1,2,4,8,16,_n}.
|
/* Construct a function tree for __asan_{load,store}{1,2,4,8,16,_n}.
|
||||||
IS_STORE is either 1 (for a store) or 0 (for a load). */
|
IS_STORE is either 1 (for a store) or 0 (for a load). */
|
||||||
|
|
||||||
static tree
|
static tree
|
||||||
check_func (bool is_store, int size_in_bytes, int *nargs)
|
check_func (bool is_store, bool recover_p, HOST_WIDE_INT size_in_bytes,
|
||||||
|
int *nargs)
|
||||||
{
|
{
|
||||||
static enum built_in_function check[2][6]
|
static enum built_in_function check[2][2][6]
|
||||||
= { { BUILT_IN_ASAN_LOAD1, BUILT_IN_ASAN_LOAD2,
|
= { { { BUILT_IN_ASAN_LOAD1, BUILT_IN_ASAN_LOAD2,
|
||||||
BUILT_IN_ASAN_LOAD4, BUILT_IN_ASAN_LOAD8,
|
BUILT_IN_ASAN_LOAD4, BUILT_IN_ASAN_LOAD8,
|
||||||
BUILT_IN_ASAN_LOAD16, BUILT_IN_ASAN_LOADN },
|
BUILT_IN_ASAN_LOAD16, BUILT_IN_ASAN_LOADN },
|
||||||
{ BUILT_IN_ASAN_STORE1, BUILT_IN_ASAN_STORE2,
|
{ BUILT_IN_ASAN_STORE1, BUILT_IN_ASAN_STORE2,
|
||||||
BUILT_IN_ASAN_STORE4, BUILT_IN_ASAN_STORE8,
|
BUILT_IN_ASAN_STORE4, BUILT_IN_ASAN_STORE8,
|
||||||
BUILT_IN_ASAN_STORE16, BUILT_IN_ASAN_STOREN } };
|
BUILT_IN_ASAN_STORE16, BUILT_IN_ASAN_STOREN } },
|
||||||
|
{ { BUILT_IN_ASAN_LOAD1_NOABORT,
|
||||||
|
BUILT_IN_ASAN_LOAD2_NOABORT,
|
||||||
|
BUILT_IN_ASAN_LOAD4_NOABORT,
|
||||||
|
BUILT_IN_ASAN_LOAD8_NOABORT,
|
||||||
|
BUILT_IN_ASAN_LOAD16_NOABORT,
|
||||||
|
BUILT_IN_ASAN_LOADN_NOABORT },
|
||||||
|
{ BUILT_IN_ASAN_STORE1_NOABORT,
|
||||||
|
BUILT_IN_ASAN_STORE2_NOABORT,
|
||||||
|
BUILT_IN_ASAN_STORE4_NOABORT,
|
||||||
|
BUILT_IN_ASAN_STORE8_NOABORT,
|
||||||
|
BUILT_IN_ASAN_STORE16_NOABORT,
|
||||||
|
BUILT_IN_ASAN_STOREN_NOABORT } } };
|
||||||
if (size_in_bytes == -1)
|
if (size_in_bytes == -1)
|
||||||
{
|
{
|
||||||
*nargs = 2;
|
*nargs = 2;
|
||||||
return builtin_decl_implicit (check[is_store][5]);
|
return builtin_decl_implicit (check[recover_p][is_store][5]);
|
||||||
}
|
}
|
||||||
*nargs = 1;
|
*nargs = 1;
|
||||||
return builtin_decl_implicit (check[is_store][exact_log2 (size_in_bytes)]);
|
int size_log2 = exact_log2 (size_in_bytes);
|
||||||
|
return builtin_decl_implicit (check[recover_p][is_store][size_log2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Split the current basic block and create a condition statement
|
/* Split the current basic block and create a condition statement
|
||||||
@ -2550,6 +2578,9 @@ asan_expand_check_ifn (gimple_stmt_iterator *iter, bool use_calls)
|
|||||||
gimple g = gsi_stmt (*iter);
|
gimple g = gsi_stmt (*iter);
|
||||||
location_t loc = gimple_location (g);
|
location_t loc = gimple_location (g);
|
||||||
|
|
||||||
|
bool recover_p
|
||||||
|
= (flag_sanitize & flag_sanitize_recover & SANITIZE_KERNEL_ADDRESS) != 0;
|
||||||
|
|
||||||
HOST_WIDE_INT flags = tree_to_shwi (gimple_call_arg (g, 0));
|
HOST_WIDE_INT flags = tree_to_shwi (gimple_call_arg (g, 0));
|
||||||
gcc_assert (flags < ASAN_CHECK_LAST);
|
gcc_assert (flags < ASAN_CHECK_LAST);
|
||||||
bool is_scalar_access = (flags & ASAN_CHECK_SCALAR_ACCESS) != 0;
|
bool is_scalar_access = (flags & ASAN_CHECK_SCALAR_ACCESS) != 0;
|
||||||
@ -2578,7 +2609,7 @@ asan_expand_check_ifn (gimple_stmt_iterator *iter, bool use_calls)
|
|||||||
tree base_addr = gimple_assign_lhs (g);
|
tree base_addr = gimple_assign_lhs (g);
|
||||||
|
|
||||||
int nargs;
|
int nargs;
|
||||||
tree fun = check_func (is_store, size_in_bytes, &nargs);
|
tree fun = check_func (is_store, recover_p, size_in_bytes, &nargs);
|
||||||
if (nargs == 1)
|
if (nargs == 1)
|
||||||
g = gimple_build_call (fun, 1, base_addr);
|
g = gimple_build_call (fun, 1, base_addr);
|
||||||
else
|
else
|
||||||
@ -2639,7 +2670,7 @@ asan_expand_check_ifn (gimple_stmt_iterator *iter, bool use_calls)
|
|||||||
basic_block then_bb, else_bb;
|
basic_block then_bb, else_bb;
|
||||||
gsi = create_cond_insert_point (&gsi, /*before_p*/false,
|
gsi = create_cond_insert_point (&gsi, /*before_p*/false,
|
||||||
/*then_more_likely_p=*/false,
|
/*then_more_likely_p=*/false,
|
||||||
/*create_then_fallthru_edge=*/false,
|
/*create_then_fallthru_edge*/recover_p,
|
||||||
&then_bb,
|
&then_bb,
|
||||||
&else_bb);
|
&else_bb);
|
||||||
|
|
||||||
@ -2748,7 +2779,7 @@ asan_expand_check_ifn (gimple_stmt_iterator *iter, bool use_calls)
|
|||||||
/* Generate call to the run-time library (e.g. __asan_report_load8). */
|
/* Generate call to the run-time library (e.g. __asan_report_load8). */
|
||||||
gsi = gsi_start_bb (then_bb);
|
gsi = gsi_start_bb (then_bb);
|
||||||
int nargs;
|
int nargs;
|
||||||
tree fun = report_error_func (is_store, size_in_bytes, &nargs);
|
tree fun = report_error_func (is_store, recover_p, size_in_bytes, &nargs);
|
||||||
g = gimple_build_call (fun, nargs, base_addr, len);
|
g = gimple_build_call (fun, nargs, base_addr, len);
|
||||||
gimple_set_location (g, loc);
|
gimple_set_location (g, loc);
|
||||||
gsi_insert_after (&gsi, g, GSI_NEW_STMT);
|
gsi_insert_after (&gsi, g, GSI_NEW_STMT);
|
||||||
|
@ -213,7 +213,7 @@ unsigned int flag_sanitize
|
|||||||
|
|
||||||
; What sanitizers should recover from errors
|
; What sanitizers should recover from errors
|
||||||
Variable
|
Variable
|
||||||
unsigned int flag_sanitize_recover = SANITIZE_UNDEFINED | SANITIZE_NONDEFAULT
|
unsigned int flag_sanitize_recover = SANITIZE_UNDEFINED | SANITIZE_NONDEFAULT | SANITIZE_KERNEL_ADDRESS
|
||||||
|
|
||||||
; Flag whether a prefix has been added to dump_base_name
|
; Flag whether a prefix has been added to dump_base_name
|
||||||
Variable
|
Variable
|
||||||
|
@ -5662,13 +5662,13 @@ and program will exit after that with non-zero exit code.
|
|||||||
|
|
||||||
Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
|
Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
|
||||||
except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
|
except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
|
||||||
@option{-fsanitize=float-cast-overflow} and @option{-fsanitize=float-divide-by-zero}.
|
@option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero} and
|
||||||
For these sanitizers error recovery is turned on by default.
|
@option{-fsanitize=kernel-address}. For these sanitizers error recovery is turned on by default.
|
||||||
|
|
||||||
Syntax without explicit @var{opts} parameter is deprecated. It is equivalent to
|
Syntax without explicit @var{opts} parameter is deprecated. It is equivalent to
|
||||||
@option{-fsanitize-recover=undefined,float-cast-overflow,float-divide-by-zero}.
|
@option{-fsanitize-recover=undefined,float-cast-overflow,float-divide-by-zero,kernel-address}.
|
||||||
Similarly @option{-fno-sanitize-recover} is equivalent to
|
Similarly @option{-fno-sanitize-recover} is equivalent to
|
||||||
@option{-fno-sanitize-recover=undefined,float-cast-overflow,float-divide-by-zero}.
|
@option{-fno-sanitize-recover=undefined,float-cast-overflow,float-divide-by-zero,kernel-address}.
|
||||||
|
|
||||||
@item -fsanitize-undefined-trap-on-error
|
@item -fsanitize-undefined-trap-on-error
|
||||||
@opindex fsanitize-undefined-trap-on-error
|
@opindex fsanitize-undefined-trap-on-error
|
||||||
|
@ -877,7 +877,7 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
|
|||||||
if (opts->x_dwarf_split_debug_info)
|
if (opts->x_dwarf_split_debug_info)
|
||||||
opts->x_debug_generate_pub_sections = 2;
|
opts->x_debug_generate_pub_sections = 2;
|
||||||
|
|
||||||
/* Userspace and kernel ASan conflict with each other and with TSan. */
|
/* Userspace and kernel ASan conflict with each other. */
|
||||||
|
|
||||||
if ((opts->x_flag_sanitize & SANITIZE_USER_ADDRESS)
|
if ((opts->x_flag_sanitize & SANITIZE_USER_ADDRESS)
|
||||||
&& (opts->x_flag_sanitize & SANITIZE_KERNEL_ADDRESS))
|
&& (opts->x_flag_sanitize & SANITIZE_KERNEL_ADDRESS))
|
||||||
@ -885,6 +885,8 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
|
|||||||
"-fsanitize=address is incompatible with "
|
"-fsanitize=address is incompatible with "
|
||||||
"-fsanitize=kernel-address");
|
"-fsanitize=kernel-address");
|
||||||
|
|
||||||
|
/* And with TSan. */
|
||||||
|
|
||||||
if ((opts->x_flag_sanitize & SANITIZE_ADDRESS)
|
if ((opts->x_flag_sanitize & SANITIZE_ADDRESS)
|
||||||
&& (opts->x_flag_sanitize & SANITIZE_THREAD))
|
&& (opts->x_flag_sanitize & SANITIZE_THREAD))
|
||||||
error_at (loc,
|
error_at (loc,
|
||||||
|
@ -57,6 +57,44 @@ DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_STORE16, "__asan_report_store16",
|
|||||||
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_STORE_N, "__asan_report_store_n",
|
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_STORE_N, "__asan_report_store_n",
|
||||||
BT_FN_VOID_PTR_PTRMODE,
|
BT_FN_VOID_PTR_PTRMODE,
|
||||||
ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST)
|
ATTR_TMPURE_NORETURN_NOTHROW_LEAF_LIST)
|
||||||
|
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_LOAD1_NOABORT,
|
||||||
|
"__asan_report_load1_noabort",
|
||||||
|
BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
||||||
|
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_LOAD2_NOABORT,
|
||||||
|
"__asan_report_load2_noabort",
|
||||||
|
BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
||||||
|
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_LOAD4_NOABORT,
|
||||||
|
"__asan_report_load4_noabort",
|
||||||
|
BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
||||||
|
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_LOAD8_NOABORT,
|
||||||
|
"__asan_report_load8_noabort",
|
||||||
|
BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
||||||
|
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_LOAD16_NOABORT,
|
||||||
|
"__asan_report_load16_noabort",
|
||||||
|
BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
||||||
|
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_LOAD_N_NOABORT,
|
||||||
|
"__asan_report_load_n_noabort",
|
||||||
|
BT_FN_VOID_PTR_PTRMODE,
|
||||||
|
ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
||||||
|
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_STORE1_NOABORT,
|
||||||
|
"__asan_report_store1_noabort",
|
||||||
|
BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
||||||
|
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_STORE2_NOABORT,
|
||||||
|
"__asan_report_store2_noabort",
|
||||||
|
BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
||||||
|
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_STORE4_NOABORT,
|
||||||
|
"__asan_report_store4_noabort",
|
||||||
|
BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
||||||
|
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_STORE8_NOABORT,
|
||||||
|
"__asan_report_store8_noabort",
|
||||||
|
BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
||||||
|
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_STORE16_NOABORT,
|
||||||
|
"__asan_report_store16_noabort",
|
||||||
|
BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
||||||
|
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REPORT_STORE_N_NOABORT,
|
||||||
|
"__asan_report_store_n_noabort",
|
||||||
|
BT_FN_VOID_PTR_PTRMODE,
|
||||||
|
ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
||||||
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_LOAD1, "__asan_load1",
|
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_LOAD1, "__asan_load1",
|
||||||
BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
||||||
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_LOAD2, "__asan_load2",
|
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_LOAD2, "__asan_load2",
|
||||||
@ -81,6 +119,30 @@ DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_STORE16, "__asan_store16",
|
|||||||
BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
||||||
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_STOREN, "__asan_storeN",
|
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_STOREN, "__asan_storeN",
|
||||||
BT_FN_VOID_PTR_PTRMODE, ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
BT_FN_VOID_PTR_PTRMODE, ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
||||||
|
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_LOAD1_NOABORT, "__asan_load1_noabort",
|
||||||
|
BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
||||||
|
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_LOAD2_NOABORT, "__asan_load2_noabort",
|
||||||
|
BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
||||||
|
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_LOAD4_NOABORT, "__asan_load4_noabort",
|
||||||
|
BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
||||||
|
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_LOAD8_NOABORT, "__asan_load8_noabort",
|
||||||
|
BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
||||||
|
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_LOAD16_NOABORT, "__asan_load16_noabort",
|
||||||
|
BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
||||||
|
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_LOADN_NOABORT, "__asan_loadN_noabort",
|
||||||
|
BT_FN_VOID_PTR_PTRMODE, ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
||||||
|
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_STORE1_NOABORT, "__asan_store1_noabort",
|
||||||
|
BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
||||||
|
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_STORE2_NOABORT, "__asan_store2_noabort",
|
||||||
|
BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
||||||
|
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_STORE4_NOABORT, "__asan_store4_noabort",
|
||||||
|
BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
||||||
|
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_STORE8_NOABORT, "__asan_store8_noabort",
|
||||||
|
BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
||||||
|
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_STORE16_NOABORT, "__asan_store16_noabort",
|
||||||
|
BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
||||||
|
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_STOREN_NOABORT, "__asan_storeN_noabort",
|
||||||
|
BT_FN_VOID_PTR_PTRMODE, ATTR_TMPURE_NOTHROW_LEAF_LIST)
|
||||||
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REGISTER_GLOBALS,
|
DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_REGISTER_GLOBALS,
|
||||||
"__asan_register_globals",
|
"__asan_register_globals",
|
||||||
BT_FN_VOID_PTR_PTRMODE, ATTR_NOTHROW_LEAF_LIST)
|
BT_FN_VOID_PTR_PTRMODE, ATTR_NOTHROW_LEAF_LIST)
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
2014-10-28 Yury Gribov <y.gribov@samsung.com>
|
||||||
|
|
||||||
|
* c-c++-common/asan/kasan-recover-1.c: New test.
|
||||||
|
* c-c++-common/asan/kasan-recover-2.c: New test.
|
||||||
|
* c-c++-common/asan/instrument-with-calls-1.c: Get rid of -save-temps.
|
||||||
|
* c-c++-common/asan/instrument-with-calls-2.c: Likewise.
|
||||||
|
* c-c++-common/asan/instrument-with-calls-3.c: Likewise.
|
||||||
|
* c-c++-common/asan/kasan-recover-1.c: Likewise.
|
||||||
|
* c-c++-common/asan/kasan-recover-2.c: Likewise.
|
||||||
|
* c-c++-common/asan/no-asan-globals.c: Likewise.
|
||||||
|
* c-c++-common/asan/no-instrument-reads.c: Likewise.
|
||||||
|
* c-c++-common/asan/no-instrument-writes.c: Likewise.
|
||||||
|
* c-c++-common/asan/no-use-after-return.c: Likewise.
|
||||||
|
|
||||||
2014-10-28 Yury Gribov <y.gribov@samsung.com>
|
2014-10-28 Yury Gribov <y.gribov@samsung.com>
|
||||||
|
|
||||||
* c-c++-common/asan/shadow-offset-1.c: New test.
|
* c-c++-common/asan/shadow-offset-1.c: New test.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* { dg-do assemble } */
|
/* { dg-do compile } */
|
||||||
/* { dg-options "--param asan-instrumentation-with-call-threshold=0 -save-temps" } */
|
/* { dg-options "--param asan-instrumentation-with-call-threshold=0" } */
|
||||||
|
|
||||||
void f(char *a, int *b) {
|
void f(char *a, int *b) {
|
||||||
*b = *a;
|
*b = *a;
|
||||||
@ -7,4 +7,3 @@ void f(char *a, int *b) {
|
|||||||
|
|
||||||
/* { dg-final { scan-assembler "__asan_load1" } } */
|
/* { dg-final { scan-assembler "__asan_load1" } } */
|
||||||
/* { dg-final { scan-assembler "__asan_store4" } } */
|
/* { dg-final { scan-assembler "__asan_store4" } } */
|
||||||
/* { dg-final { cleanup-saved-temps } } */
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* { dg-do assemble } */
|
/* { dg-do compile } */
|
||||||
/* { dg-options "--param asan-instrumentation-with-call-threshold=1 -save-temps" } */
|
/* { dg-options "--param asan-instrumentation-with-call-threshold=1" } */
|
||||||
|
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
@ -13,4 +13,3 @@ void f(int *a, int *b) {
|
|||||||
/* { dg-final { scan-assembler-not "__asan_report_store4" } } */
|
/* { dg-final { scan-assembler-not "__asan_report_store4" } } */
|
||||||
/* { dg-final { scan-assembler "__asan_load4" } } */
|
/* { dg-final { scan-assembler "__asan_load4" } } */
|
||||||
/* { dg-final { scan-assembler-not "__asan_report_load4" } } */
|
/* { dg-final { scan-assembler-not "__asan_report_load4" } } */
|
||||||
/* { dg-final { cleanup-saved-temps } } */
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* { dg-do assemble } */
|
/* { dg-do compile } */
|
||||||
/* { dg-options "--param asan-instrumentation-with-call-threshold=0 -save-temps" } */
|
/* { dg-options "--param asan-instrumentation-with-call-threshold=0" } */
|
||||||
|
|
||||||
struct A {
|
struct A {
|
||||||
char x[7];
|
char x[7];
|
||||||
@ -11,5 +11,4 @@ void f(struct A *x, struct A *y) {
|
|||||||
|
|
||||||
/* { dg-final { scan-assembler "__asan_loadN" } } */
|
/* { dg-final { scan-assembler "__asan_loadN" } } */
|
||||||
/* { dg-final { scan-assembler "__asan_storeN" } } */
|
/* { dg-final { scan-assembler "__asan_storeN" } } */
|
||||||
/* { dg-final { cleanup-saved-temps } } */
|
|
||||||
|
|
||||||
|
11
gcc/testsuite/c-c++-common/asan/kasan-recover-1.c
Normal file
11
gcc/testsuite/c-c++-common/asan/kasan-recover-1.c
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
/* { dg-do compile } */
|
||||||
|
/* { dg-options "-fno-sanitize=address -fsanitize=kernel-address --param asan-instrumentation-with-call-threshold=100" } */
|
||||||
|
|
||||||
|
void
|
||||||
|
foo (int *p)
|
||||||
|
{
|
||||||
|
*p = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* { dg-final { scan-assembler "__asan_report_store4_noabort" } } */
|
||||||
|
|
11
gcc/testsuite/c-c++-common/asan/kasan-recover-2.c
Normal file
11
gcc/testsuite/c-c++-common/asan/kasan-recover-2.c
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
/* { dg-do compile } */
|
||||||
|
/* { dg-options "-fno-sanitize=address -fsanitize=kernel-address" } */
|
||||||
|
|
||||||
|
void
|
||||||
|
foo (int *p)
|
||||||
|
{
|
||||||
|
*p = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* { dg-final { scan-assembler "__asan_store4_noabort" } } */
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
/* { dg-do assemble } */
|
/* { dg-do compile } */
|
||||||
/* { dg-options "-save-temps --param asan-globals=0" } */
|
/* { dg-options "--param asan-globals=0" } */
|
||||||
|
|
||||||
volatile int ten = 10;
|
volatile int ten = 10;
|
||||||
|
|
||||||
@ -10,4 +10,3 @@ int main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* { dg-final { scan-assembler-not "__asan_register_globals" } } */
|
/* { dg-final { scan-assembler-not "__asan_register_globals" } } */
|
||||||
/* { dg-final { cleanup-saved-temps } } */
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* { dg-do assemble } */
|
/* { dg-do compile } */
|
||||||
/* { dg-options "--param asan-instrument-reads=0 -save-temps" } */
|
/* { dg-options "--param asan-instrument-reads=0" } */
|
||||||
|
|
||||||
volatile int ten = 10;
|
volatile int ten = 10;
|
||||||
|
|
||||||
@ -10,4 +10,3 @@ int main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* { dg-final { scan-assembler-not "__asan_load" } } */
|
/* { dg-final { scan-assembler-not "__asan_load" } } */
|
||||||
/* { dg-final { cleanup-saved-temps } } */
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* { dg-do assemble } */
|
/* { dg-do compile } */
|
||||||
/* { dg-options "--param asan-instrument-writes=0 -save-temps" } */
|
/* { dg-options "--param asan-instrument-writes=0" } */
|
||||||
|
|
||||||
volatile int ten = 10;
|
volatile int ten = 10;
|
||||||
|
|
||||||
@ -10,4 +10,3 @@ int main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* { dg-final { scan-assembler-not "__asan_store" } } */
|
/* { dg-final { scan-assembler-not "__asan_store" } } */
|
||||||
/* { dg-final { cleanup-saved-temps } } */
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* { dg-do assemble } */
|
/* { dg-do compile } */
|
||||||
/* { dg-options "--param asan-use-after-return=0 -save-temps" } */
|
/* { dg-options "--param asan-use-after-return=0" } */
|
||||||
|
|
||||||
extern void f(char *);
|
extern void f(char *);
|
||||||
|
|
||||||
@ -10,4 +10,3 @@ int main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* { dg-final { scan-assembler-not "__asan_option_detect_stack_use_after_return" } } */
|
/* { dg-final { scan-assembler-not "__asan_option_detect_stack_use_after_return" } } */
|
||||||
/* { dg-final { cleanup-saved-temps } } */
|
|
||||||
|
Loading…
Reference in New Issue
Block a user