This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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(-)

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));
-- 
1.7.11.7


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]