From: Martin Liska Date: Tue, 9 Jan 2018 11:47:26 +0000 (+0100) Subject: Add gcc_assert about stack alignment (PR sanitizer/82517). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=aa5bfa8d5d9b5751bc6b1854d663fbf777849711;p=gcc.git Add gcc_assert about stack alignment (PR sanitizer/82517). 2018-01-09 Martin Liska PR sanitizer/82517 * asan.c (shadow_mem_size): Add gcc_assert. From-SVN: r256378 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0def5335339..0d9089b5761 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-01-09 Martin Liska + + PR sanitizer/82517 + * asan.c (shadow_mem_size): Add gcc_assert. + 2018-01-09 Georg-Johann Lay Don't save registers in main(). diff --git a/gcc/asan.c b/gcc/asan.c index 53630088b76..df9bc7b3404 100644 --- a/gcc/asan.c +++ b/gcc/asan.c @@ -1228,6 +1228,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; }