re PR sanitizer/77396 (address sanitizer crashes if all static global variables are optimized)
PR sanitizer/77396 * asan/asan_globals.cc: Cherry-pick upstream r280657. * g++.dg/asan/pr77396-2.C: New test. From-SVN: r239998
This commit is contained in:
parent
3f8257db2e
commit
0ce483917f
|
@ -1,3 +1,8 @@
|
||||||
|
2016-09-05 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
PR sanitizer/77396
|
||||||
|
* g++.dg/asan/pr77396-2.C: New test.
|
||||||
|
|
||||||
2016-09-05 Uros Bizjak <ubizjak@gmail.com>
|
2016-09-05 Uros Bizjak <ubizjak@gmail.com>
|
||||||
|
|
||||||
PR rtl-optimization/77452
|
PR rtl-optimization/77452
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
// PR sanitizer/77396
|
||||||
|
// { dg-do run }
|
||||||
|
// { dg-set-target-env-var ASAN_OPTIONS "check_initialization_order=true" }
|
||||||
|
|
||||||
|
struct S { S () { asm volatile ("" : : : "memory"); } };
|
||||||
|
static S c;
|
||||||
|
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -1,3 +1,8 @@
|
||||||
|
2016-09-05 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
PR sanitizer/77396
|
||||||
|
* asan/asan_globals.cc: Cherry-pick upstream r280657.
|
||||||
|
|
||||||
2016-08-12 Jakub Jelinek <jakub@redhat.com>
|
2016-08-12 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
PR sanitizer/71042
|
PR sanitizer/71042
|
||||||
|
|
|
@ -248,10 +248,10 @@ void __asan_unregister_globals(__asan_global *globals, uptr n) {
|
||||||
// initializer can only touch global variables in the same TU.
|
// initializer can only touch global variables in the same TU.
|
||||||
void __asan_before_dynamic_init(const char *module_name) {
|
void __asan_before_dynamic_init(const char *module_name) {
|
||||||
if (!flags()->check_initialization_order ||
|
if (!flags()->check_initialization_order ||
|
||||||
!CanPoisonMemory())
|
!CanPoisonMemory() ||
|
||||||
|
!dynamic_init_globals)
|
||||||
return;
|
return;
|
||||||
bool strict_init_order = flags()->strict_init_order;
|
bool strict_init_order = flags()->strict_init_order;
|
||||||
CHECK(dynamic_init_globals);
|
|
||||||
CHECK(module_name);
|
CHECK(module_name);
|
||||||
CHECK(asan_inited);
|
CHECK(asan_inited);
|
||||||
BlockingMutexLock lock(&mu_for_globals);
|
BlockingMutexLock lock(&mu_for_globals);
|
||||||
|
@ -274,7 +274,8 @@ void __asan_before_dynamic_init(const char *module_name) {
|
||||||
// TU are poisoned. It simply unpoisons all dynamically initialized globals.
|
// TU are poisoned. It simply unpoisons all dynamically initialized globals.
|
||||||
void __asan_after_dynamic_init() {
|
void __asan_after_dynamic_init() {
|
||||||
if (!flags()->check_initialization_order ||
|
if (!flags()->check_initialization_order ||
|
||||||
!CanPoisonMemory())
|
!CanPoisonMemory() ||
|
||||||
|
!dynamic_init_globals)
|
||||||
return;
|
return;
|
||||||
CHECK(asan_inited);
|
CHECK(asan_inited);
|
||||||
BlockingMutexLock lock(&mu_for_globals);
|
BlockingMutexLock lock(&mu_for_globals);
|
||||||
|
|
Loading…
Reference in New Issue