Patchwork [09/13] Don't forget to protect 32 bytes aligned global variables.

login
register
mail settings
Submitter Dodji Seketeli
Date Nov. 1, 2012, 7:52 p.m.
Message ID <1351799566-31447-10-git-send-email-dodji@redhat.com>
Download mbox | patch
Permalink /patch/196359/
State New
Headers show

Comments

Dodji Seketeli - Nov. 1, 2012, 7:52 p.m.
From: wmi <wmi@138bc75d-0d04-0410-961f-82ee72b054a4>

It appeared that we were forgetting to protect global variables that
are already 32 bytes aligned.  Fixed thus.

	* varasm.c (assemble_variable): Set asan_protected even
	for decls that are already ASAN_RED_ZONE_SIZE or more
	bytes aligned.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/asan@192830 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog.asan | 15 +++++++++++++++
 gcc/varasm.c       |  6 +++---
 2 files changed, 18 insertions(+), 3 deletions(-)

Patch

diff --git a/gcc/ChangeLog.asan b/gcc/ChangeLog.asan
index 3da0a0b..57670f7 100644
--- a/gcc/ChangeLog.asan
+++ b/gcc/ChangeLog.asan
@@ -1,3 +1,18 @@ 
+2012-10-25  Wei Mi  <wmi@google.com>
+
+	* varasm.c (assemble_variable): Set asan_protected even 
+	for decls that are already ASAN_RED_ZONE_SIZE or more 
+	bytes aligned.
+
+2012-10-19  Diego Novillo  <dnovillo@google.com>
+
+	Merge from trunk rev 192612.
+
+2012-10-18  Xinliang David Li  <davidxl@google.com>
+
+	* asan.c (asan_init_shadow_ptr_types): change shadow type
+	to signed type.
+
 2012-10-18  Jakub Jelinek  <jakub@redhat.com>
 
 	* asan.c (build_check_stmt): Unshare base.
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 8a533ed..641ce0c 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -1991,11 +1991,11 @@  assemble_variable (tree decl, int top_level ATTRIBUTE_UNUSED,
   align_variable (decl, dont_output_data);
 
   if (flag_asan
-      && asan_protect_global (decl)
-      && DECL_ALIGN (decl) < ASAN_RED_ZONE_SIZE * BITS_PER_UNIT)
+      && asan_protect_global (decl))
     {
       asan_protected = true;
-      DECL_ALIGN (decl) = ASAN_RED_ZONE_SIZE * BITS_PER_UNIT;
+      DECL_ALIGN (decl) = MAX (DECL_ALIGN (decl), 
+                               ASAN_RED_ZONE_SIZE * BITS_PER_UNIT);
     }
 
   set_mem_align (decl_rtl, DECL_ALIGN (decl));