summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2018-01-09 11:47:26 +0000
committerDongkyun Son <dongkyun.s@samsung.com>2019-07-22 20:54:34 +0900
commit8474d5b72c9754d1875750f54554a47d5e85515c (patch)
treeb45fcb00709b606ed1156df95279a5775c0b8c9c
parent6a8a3da5ad28e8460d0de79c329c2cb7fbad6b93 (diff)
downloadlinaro-gcc-8474d5b72c9754d1875750f54554a47d5e85515c.tar.gz
linaro-gcc-8474d5b72c9754d1875750f54554a47d5e85515c.tar.bz2
linaro-gcc-8474d5b72c9754d1875750f54554a47d5e85515c.zip
Add gcc_assert about stack alignment (PR sanitizer/82517).
2018-01-09 Martin Liska <mliska@suse.cz> PR sanitizer/82517 * asan.c (shadow_mem_size): Add gcc_assert. (cherry picked from e56a070cadd948b81a5b769e17c8c1162829de27) Change-Id: I0f97457dfc30b6afbde93ff53e2b5d923946a122 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@256378 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/asan.c5
2 files changed, 10 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c5a8c80c420..4c738e35e7f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2018-01-09 Martin Liska <mliska@suse.cz>
+
+ PR sanitizer/82517
+ * asan.c (shadow_mem_size): Add gcc_assert.
+
2017-07-03 Martin Liska <mliska@suse.cz>
* asan.c (asan_emit_stack_protection): Unpoison just red zones
diff --git a/gcc/asan.c b/gcc/asan.c
index 20eae754dcf..cb5a21f2aa3 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -1043,6 +1043,11 @@ asan_function_start (void)
static unsigned HOST_WIDE_INT
shadow_mem_size (unsigned HOST_WIDE_INT size)
{
+ /* It must be possible to align stack variables to granularity
+ of shadow memory. */
+ gcc_assert (BITS_PER_UNIT
+ * ASAN_SHADOW_GRANULARITY <= MAX_SUPPORTED_STACK_ALIGNMENT);
+
return ROUND_UP (size, ASAN_SHADOW_GRANULARITY) / ASAN_SHADOW_GRANULARITY;
}