2016-06-10 Maxim Ostapenko <m.ostapenko@samsung.com>
PR sanitizer/71480
* varasm.c (place_block_symbol): Adjust alignment for asan protected
STRING_CSTs even if TREE_CONSTANT_POOL_ADDRESS_P.
* c-c++-common/asan/pr71480.c: New test.
Change-Id: Icbfd5b352bcc46a376c7c8bee62f73e54d4d87c2
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@237306
138bc75d-0d04-0410-961f-
82ee72b054a4
+2016-06-10 Maxim Ostapenko <m.ostapenko@samsung.com>
+
+ PR sanitizer/71480
+ * varasm.c (place_block_symbol): Adjust alignment for asan protected
+ STRING_CSTs even if TREE_CONSTANT_POOL_ADDRESS_P.
+
2015-02-09 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/64981
+2016-06-10 Maxim Ostapenko <m.ostapenko@samsung.com>
+
+ PR sanitizer/71480
+ * c-c++-common/asan/pr71480.c: New test.
+
2015-02-09 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/64981
--- /dev/null
+/* { dg-do run } */
+
+__attribute__ ((noinline, noclone)) int
+foo (char *c)
+{
+ asm volatile ("" : : "r" (c) : "memory");
+ return 1;
+}
+
+__attribute__ ((noinline, noclone)) void
+bar (char *c)
+{
+ asm volatile ("" : : "r" (c) : "memory");
+}
+
+int main ()
+{
+ char tpl[20] = "/tmp/test.XXXXXX";
+ char tpl2[20] = "/tmp/test.XXXXXX";
+ int fd = foo (tpl);
+ int fd2 = foo (tpl2);
+ if (fd == -1)
+ {
+ if (fd2 != -1)
+ bar (tpl2);
+ return 1;
+ }
+
+ if (fd2 == -1)
+ return 1;
+
+ bar (tpl);
+ bar (tpl2);
+
+ if (__builtin_strcmp (tpl, "/tmp/test.XXXXXX") != 0)
+ return 1;
+
+ if (__builtin_strcmp (tpl, tpl2) != 0)
+ return 1;
+
+ return 0;
+}
if ((flag_sanitize & SANITIZE_ADDRESS)
&& TREE_CODE (DECL_INITIAL (decl)) == STRING_CST
&& asan_protect_global (DECL_INITIAL (decl)))
- size += asan_red_zone_size (size);
+ {
+ size += asan_red_zone_size (size);
+ alignment = MAX (alignment,
+ ASAN_RED_ZONE_SIZE * BITS_PER_UNIT);
+ }
}
else
{