diff options
author | chefmax <chefmax@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-11-08 22:15:35 +0000 |
---|---|---|
committer | Dongkyun Son <dongkyun.s@samsung.com> | 2017-08-03 11:49:56 +0000 |
commit | a49bc19f21d2e256e70a1a5ad17d0c6301d9b02b (patch) | |
tree | 9859c9a4da528b7e90f0d8020fdc3e9fadfc3577 | |
parent | d3cbdccd2a752a93f62f1e6034f09f49dcea8ccd (diff) | |
download | linaro-gcc-a49bc19f21d2e256e70a1a5ad17d0c6301d9b02b.tar.gz linaro-gcc-a49bc19f21d2e256e70a1a5ad17d0c6301d9b02b.tar.bz2 linaro-gcc-a49bc19f21d2e256e70a1a5ad17d0c6301d9b02b.zip |
gcc/
* asan.h (ASAN_STACK_MAGIC_PARTIAL): Remove.
* asan.c (ASAN_STACK_MAGIC_PARTIAL): Replace with
ASAN_STACK_MAGIC_MIDDLE.
gcc/testsuite/
* c-c++-common/asan/null-deref-1.c: Adjust testcase.
Change-Id: I348a6339d17a2cb7faf293cefdc615d1d53d237a
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241983 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/asan.c | 13 | ||||
-rw-r--r-- | gcc/asan.h | 10 | ||||
-rw-r--r-- | gcc/sanitizer.def | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/asan/null-deref-1.c | 4 |
6 files changed, 30 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8772afc63b5..fd9a0353512 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -15,6 +15,14 @@ * c-family/c-semantics.c (pop_stmt_list): Support single-statement lists extraction with STATEMENT_LIST_END in the end. +2016-11-09 Maxim Ostapenko <m.ostapenko@samsung.com> + + * asan.h (ASAN_STACK_MAGIC_PARTIAL): Remove. + * asan.c (ASAN_STACK_MAGIC_PARTIAL): Replace with + ASAN_STACK_MAGIC_MIDDLE. + (asan_global_struct): Increase the size of fields. + (asan_add_global): Add new field constructor. + 2017-04-13 Denis Khalikov <d.khalikov@partner.samsung.com> PR sanitizer/80414 diff --git a/gcc/asan.c b/gcc/asan.c index 0f55dc03e9c..89ee451e3d3 100644 --- a/gcc/asan.c +++ b/gcc/asan.c @@ -1212,7 +1212,7 @@ asan_emit_stack_protection (rtx base, rtx pbase, unsigned int alignb, shadow_bytes[i] = offset - aoff; } else - shadow_bytes[i] = ASAN_STACK_MAGIC_PARTIAL; + shadow_bytes[i] = ASAN_STACK_MAGIC_MIDDLE; emit_move_insn (shadow_mem, asan_shadow_cst (shadow_bytes)); offset = aoff; } @@ -2189,19 +2189,20 @@ asan_dynamic_init_call (bool after_p) const void *__module_name; uptr __has_dynamic_init; __asan_global_source_location *__location; + char *__odr_indicator; } type. */ static tree asan_global_struct (void) { - static const char *field_names[7] + static const char *field_names[8] = { "__beg", "__size", "__size_with_redzone", - "__name", "__module_name", "__has_dynamic_init", "__location"}; - tree fields[7], ret; + "__name", "__module_name", "__has_dynamic_init", "__location", "__odr_indicator"}; + tree fields[8], ret; int i; ret = make_node (RECORD_TYPE); - for (i = 0; i < 7; i++) + for (i = 0; i < 8; i++) { fields[i] = build_decl (UNKNOWN_LOCATION, FIELD_DECL, @@ -2314,6 +2315,8 @@ asan_add_global (tree decl, tree type, vec<constructor_elt, va_gc> *v) else locptr = build_int_cst (uptr, 0); CONSTRUCTOR_APPEND_ELT (vinner, NULL_TREE, locptr); + /* TODO: support ODR indicators. */ + CONSTRUCTOR_APPEND_ELT (vinner, NULL_TREE, build_int_cst (uptr, 0)); init = build_constructor (type, vinner); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, init); } diff --git a/gcc/asan.h b/gcc/asan.h index 7ec693f2b3c..6f8984474ac 100644 --- a/gcc/asan.h +++ b/gcc/asan.h @@ -50,11 +50,11 @@ extern alias_set_type asan_shadow_set; the frame. Middle is for padding in between variables, right is above the last protected variable and partial immediately after variables up to ASAN_RED_ZONE_SIZE alignment. */ -#define ASAN_STACK_MAGIC_LEFT 0xf1 -#define ASAN_STACK_MAGIC_MIDDLE 0xf2 -#define ASAN_STACK_MAGIC_RIGHT 0xf3 -#define ASAN_STACK_MAGIC_PARTIAL 0xf4 -#define ASAN_STACK_MAGIC_USE_AFTER_RET 0xf5 +#define ASAN_STACK_MAGIC_LEFT 0xf1 +#define ASAN_STACK_MAGIC_MIDDLE 0xf2 +#define ASAN_STACK_MAGIC_RIGHT 0xf3 +#define ASAN_STACK_MAGIC_USE_AFTER_RET 0xf5 +#define ASAN_STACK_MAGIC_USE_AFTER_SCOPE 0xf8 #define ASAN_STACK_FRAME_MAGIC 0x41b58ab3 #define ASAN_STACK_RETIRED_MAGIC 0x45e0360e diff --git a/gcc/sanitizer.def b/gcc/sanitizer.def index 303c1e46df4..b229d5c94ff 100644 --- a/gcc/sanitizer.def +++ b/gcc/sanitizer.def @@ -167,7 +167,7 @@ DEF_SANITIZER_BUILTIN(BUILT_IN_ASAN_AFTER_DYNAMIC_INIT, BT_FN_VOID, ATTR_NOTHROW_LEAF_LIST) /* Thread Sanitizer */ -DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_INIT, "__tsan_init", +DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_INIT, "__tsan_init", BT_FN_VOID, ATTR_NOTHROW_LEAF_LIST) DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_FUNC_ENTRY, "__tsan_func_entry", BT_FN_VOID_PTR, ATTR_NOTHROW_LEAF_LIST) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e631179e848..0123658efd6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,7 +1,12 @@ + 2017-07-06 Vyacheslav Barinov <v.barinov@samsung.com> * g++.dg/ext/statement-list-end.C: New. +2016-11-09 Maxim Ostapenko <m.ostapenko@samsung.com> + + * c-c++-common/asan/null-deref-1.c: Adjust testcase. + 2017-04-13 Denis Khalikov <d.khalikov@partner.samsung.com> PR sanitizer/80414 @@ -762,7 +767,7 @@ * g++.dg/torture/pr77822.C: New test. 2016-11-20 Harald Anlauf <anlauf@gmx.de> - + PR fortran/69741 * gfortran.dg/forall_18.f90: New testcase. diff --git a/gcc/testsuite/c-c++-common/asan/null-deref-1.c b/gcc/testsuite/c-c++-common/asan/null-deref-1.c index 45d35ac2de3..f4f8f37a795 100644 --- a/gcc/testsuite/c-c++-common/asan/null-deref-1.c +++ b/gcc/testsuite/c-c++-common/asan/null-deref-1.c @@ -17,6 +17,6 @@ int main() } /* { dg-output "ERROR: AddressSanitizer:? SEGV on unknown address\[^\n\r]*" } */ -/* { dg-output "0x\[0-9a-f\]+ \[^\n\r]*pc 0x\[0-9a-f\]+\[^\n\r]*(\n|\r\n|\r)" } */ -/* { dg-output "\[^\n\r]* #0 0x\[0-9a-f\]+ +(in \[^\n\r]*NullDeref\[^\n\r]* (\[^\n\r]*null-deref-1.c:10|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */ +/* { dg-output "0x\[0-9a-f\]+ \[^\n\r]*pc 0x\[0-9a-f\]+.*(\n|\r\n|\r)" } */ +/* { dg-output " #0 0x\[0-9a-f\]+ +(in \[^\n\r]*NullDeref\[^\n\r]* (\[^\n\r]*null-deref-1.c:10|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */ /* { dg-output " #1 0x\[0-9a-f\]+ +(in _*main (\[^\n\r]*null-deref-1.c:15|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */ |